query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
sequencelengths 0
101
| negative_scores
sequencelengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
---|---|---|---|---|---|---|
Enable watching of css files in Sass 3.3+ | def watched_directories
[File.dirname(archive_file)]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_sass\n Dir[\"#{RAILS_ROOT}/public/stylesheets/sass/**/*.sass\"]\n end",
"def sass_files\n [\n styles_scss, components_scss, pages_scss\n ].flatten!\n end",
"def css_to_scss\n Proc.new {|task| task.sub(/^#{CSS_DIR}/, SASS_DIR).\n sub(/\\.css$/, '.scss')}\nend",
"def sass_options\n { \n :load_paths => [ theme_stylesheets_path, Sass::Plugin.options[:load_paths] ].flatten \n }\n end",
"def start_watch_files\n coffee_files.each do |file|\n @notifier.watch(file, :modify) do\n CoffeeCompiler.compile_file(file, true, true)\n end\n end\n end",
"def sass_file?; end",
"def sass_file?; end",
"def sass *sass_names\n install_deps 'haml', :type => Gem\n\n sass_names.flatten.each do |name|\n sass_file = \"public/stylesheets/sass/#{name}.sass\"\n css_file = \"public/stylesheets/#{name}.css\"\n sass_cmd = \"cd #{self.checkout_path} && sass #{sass_file} #{css_file}\"\n\n @shell.call sass_cmd\n end\n end",
"def update_stylesheets\n return if options[:never_update]\n\n @@checked_for_updates = true\n Dir.glob(File.join(options[:template_location], \"**\", \"*.sass\")).entries.each do |file|\n\n # Get the relative path to the file with no extension\n name = file.sub(options[:template_location] + \"/\", \"\")[0...-5]\n\n if !forbid_update?(name) && (options[:always_update] || stylesheet_needs_update?(name))\n css = css_filename(name)\n File.delete(css) if File.exists?(css)\n\n filename = template_filename(name)\n engine = Engine.new(File.read(filename), engine_options(:filename => filename))\n result = begin\n engine.render\n rescue Exception => e\n exception_string(e)\n end\n\n # Create any directories that might be necessary\n dirs = [options[:css_location]]\n name.split(\"/\")[0...-1].each { |dir| dirs << \"#{dirs[-1]}/#{dir}\" }\n dirs.each { |dir| Dir.mkdir(dir) unless File.exist?(dir) }\n\n # Finally, write the file\n File.open(css, 'w') do |file|\n file.print(result)\n end\n end\n end\n end",
"def sass_example(file)\n file = File.new(Dir.glob(File.join(Sinatra::Application.root , '../sass', \"#{file}.{sass,scss}\").to_s).first)\n\n code_toggle file.read(), Pathname.new(file.path).relative_path_from(Pathname.new(Sinatra::Application.root)), file.mtime\n end",
"def watch!\n start_watch true\n end",
"def build_css\n Dir[\"#{@src_dir}/stylesheets/**/*.{sass,scss}\"].each do |path|\n file_dir, template = source_template_from_path(path.sub(/^#{@src_dir}\\/stylesheets/, ''))\n\n if !template.match(/(^|\\/)\\_/)\n save_stylesheet(File.join(file_dir, template), generate_css(template, file_dir))\n end\n end\n end",
"def setup\n @config_manager = Sassconf::ConfigManager.new\n @sass_executor = Sassconf::SassExecutor.new(SCSS_PATH, CSS_PATH)\n end",
"def also_reload(*glob)\n Dir[*glob].each { |path| Watcher::List.for(self).watch_file(path) }\n end",
"def watch!(*globs)\n @watchlist.accept!(globs)\n end",
"def all_scss_into_one_file\n File.open(base_scss_file, 'w') do |file|\n sass_files.each do |sass_file|\n file.write(\"/* file: #{sass_file} */\\n\") if development?\n file.write(File.read(sass_file))\n end\n end\n end",
"def sass_options\n @sass_options ||= {\n line_comments: false,\n syntax: :sass,\n style: :compressed\n }\n end",
"def refresh_watchers()\r\n paths = []\r\n\r\n # A list of all file paths the user passed in.\r\n unresolved_paths = @path.split(',')\r\n unresolved_paths = unresolved_paths.size == 0 ? @path : unresolved_paths\r\n\r\n # Glob all file paths and keep all readable files.\r\n for unresolved_path in unresolved_paths\r\n paths += Dir.glob(unresolved_path.strip).select do |resource|\r\n File.file?(resource) && File.readable?(resource)\r\n end\r\n end\r\n\r\n watched = @watched_files.keys\r\n\r\n # Files we are not yet watching.\r\n new_files = paths - watched\r\n\r\n # Files we are watching that no longer exist.\r\n dead_files = watched - paths\r\n\r\n start_watches(new_files)\r\n stop_watches(dead_files, true)\r\n end",
"def watch\n paths = [ Rails.root.join('app'), Rails.root.join('lib') ]\n @worker.log \"Watching files in #{paths}\"\n\n reloader = ActiveSupport::FileUpdateChecker.new(paths) { rework }\n Rails.application.reloaders << reloader\n\n ActionDispatch::Reloader.to_prepare do\n reloader.execute_if_updated\n end\n\n true\n end",
"def sass_options(uri, importer, options)\n options.merge!(:filename => uri.gsub(%r{\\*/},\"*\\\\/\"), :syntax => :scss, :importer => importer)\n end",
"def css\n css_files = []\n @assets.each do |type, path|\n case type\n when :folder\n # Don't import any css/scss files that start with an underscore, so scss partials\n # aren't imported by default:\n # http://sass-lang.com/guide\n css_files += Dir[\"#{path}/**/[^_]*.{css,scss}\"].sort.map do |folder|\n '/assets' + folder[path.size..-1].gsub(/[.]scss$/, '')\n end\n when :css_file\n css_files << path\n end\n end\n\n css_files.uniq\n end",
"def compile_css(debug: false)\n require 'compass'\n require 'compass/sass_compiler'\n require 'sass-css-importer'\n\n Compass.configuration.add_import_path \"#{$css_source}/imports\"\n configs = {}\n configs[:project_path] = \".\"\n configs[:http_path] = \"/\"\n configs[:sass_path] = $css_source\n configs[:css_path] = $css_dest\n configs[:cache_path] = $cache_dir\n configs[:images_path] = \"static/images/\"\n configs[:output_style] = debug ? :nested : :compressed\n configs[:line_comments] = debug ? true : false\n Compass.add_configuration(configs, \"basho_docs_configs\")\n\n # This will grab every .scss file in the $css_source directory, and run them\n # through Compass, generating equivalently-named .css files in the static/css\n # directory. We should try to keep the number of compiled sources to a minimum\n # though, and simply add new/parsed scss/css files to `all.scss`.\n compiler = Compass.sass_compiler({\n :only_sass_files => Dir.glob(\"#{$css_source}/*.scss\")\n })\n compiler.compile!\nend",
"def watch\n @listener ||= Listen.to(\n File.dirname(PATH),\n only: /\\A#{File.basename(PATH)}\\z/\n ) do |modified, added, removed|\n next if modified.empty? && added.empty? && removed.empty?\n\n reload\n end\n\n @listener.start\n end",
"def run_all\n run_on_change(\n Watcher.match_files(\n self, \n Dir.glob(File.join(::Guard.listener.directory, '**', '*.s[ac]ss')).\n map {|f| f[::Guard.listener.directory.size+1..-1] }.\n reject {|f| partial?(f) }\n )\n )\n end",
"def start_watching\n start_runner\n loop do\n if @files.detect { |file| File.exists?(file) && File.stat(file).mtime > @time }\n puts \"reloading sketch...\"\n $app && $app.close\n @time = Time.now\n GC.start\n start_runner\n reload_files_to_watch\n end\n sleep 0.33\n end\n end",
"def check_for_sass_files!(compiler)\n if compiler.sass_files.empty?\n message = \"Nothing to compile. If you're trying to start a new project, you have left off the directory argument.\\n\"\n message << \"Run \\\"compass -h\\\" to get help.\"\n raise Compass::Error, message\n end\n end",
"def sass_file_url; end",
"def render\n Dir.glob(File.join(@working_dir, STYLES_DIR, '**/*')) do |filename|\n @filename = filename\n if @filename.end_with?(\".sass\")\n render_sass :sass\n elsif @filename.end_with?(\".scss\")\n render_sass :scss\n end\n end\n end",
"def sass_options\n\t\t\t\t# NOTE: For Sassc importer is now a **class** and not an instance.\n\n\t\t\t\t# Allow the use of custom SASS importers, making sure the\n\t\t\t\t# custom importer is a `Sprockets::Sass::Importer`\n\t\t\t\tif default_sass_options.has_key?(:importer) &&\n\t\t\t\t\t (default_sass_options[:importer] <= Importer)\t# Check if the :importer class is Importer or inherits from Importer\n\t\t\t\t\timporter = default_sass_options[:importer]\n\t\t\t\telse\n\t\t\t\t\t# Pass the Importer class\n\t\t\t\t\timporter = Importer\n\t\t\t\tend\n\n\t\t\t\topts = merge_sass_options(default_sass_options, options).merge(\n\t\t\t\t\tfilename: eval_file,\n\t\t\t\t\tsyntax: syntax,\n\t\t\t\t\timporter: importer,\n\t\t\t\t\t\n\t\t\t\t\t# 2016-01-28\n\t\t\t\t\t# cache_store: cache_store,\n\t\t\t\t\t\n\t\t\t\t\t# Based on sassc-rails implementation.\n\t\t\t\t\tsprockets: { context: context },\n\t\t\t\t\t\n\t\t\t\t\t# `custom.sprockets_context` is kept to be backward-compatible\n\t\t\t\t\t# with sprockets-sass setup.\n\t\t\t\t\tcustom: { :sprockets_context => context }\n\t\t\t\t)\n\t\t\t\t\n\t\t\t\tif opts[:inline_source_maps]\n\t\t\t\t\t# inline_source_maps: true,\t# sassc-rails property\n\t\t\t\t\topts.merge!({\n\t\t\t\t\t\tsource_map_file: \".\",\n\t\t\t\t\t\tsource_map_embed: true,\n\t\t\t\t\t\tsource_map_contents: true\t\t\t\t\t\t\n\t\t\t\t\t})\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\topts\n\t\t\tend",
"def watch()\n merge(watch: 'true')\n end",
"def watch()\n merge(watch: 'true')\n end",
"def watch(&block)\n\n # Startup File Watcher\n script_changed = lambda { |modified, added, removed|\n\n @log.debug \"File(s) changed! - #{modified.join(\", \")}\" unless (modified.nil? || modified.empty?)\n @log.debug \"File(s) added! - #{added.join(\", \")}\" unless (added.nil? || added.empty?)\n @log.debug \"File(s) removed! - #{removed.join(\", \")}\" unless (removed.nil? || removed.empty?)\n\n block.call(modified, added, removed)\n }\n\n pig_listener = Listen.to(@project_root_path,\n :ignore => /(^\\..*$|logs.*)/)\n\n pig_listener.change(&script_changed)\n pig_listener.start\n\n\tend",
"def refresh_css(interval=5)\n return if @next_reload && @next_reload > Time.new\n mode = File::RDWR|File::CREAT\n File.open(File.join(@context.public_root, 'bundle.css'), mode) do |f|\n f.flock(File::LOCK_EX) # Avoid race condition\n now = Time.new\n if !@next_reload || @next_reload < now\n @next_reload = now + interval\n @ctx_app_root ||= @context.app_root\n f.rewind\n compile_css(f, true)\n f.flush.truncate(f.pos)\n end # if\n end # open\n end",
"def watchable_files; end",
"def css\n project_file_read(\"all.css\")\nend",
"def when_sprockets_available\n if !SKIP_SPROCKETS\n yield\n end\nend",
"def start\n options[:api_version] ||= '1.4'\n options[:host] ||= '0.0.0.0'\n options[:port] ||= '35729'\n options[:apply_js_live] ||= true\n options[:apply_css_live] ||= true\n \n @reactor = Reactor.new(options)\n \n create_updater\n UI.info \"Guard::Compass is watching at your stylesheets.\"\n true\n end",
"def reload!\n suppress_warnings do \n Dir['./**/*.rb'].each do |f| \n load f\n end\n end\n nil\nend",
"def watcher_css(object)\n \"#{object.class.to_s.underscore}-#{object.id}-watcher\"\n end",
"def watching?; @@watching == $$; end",
"def setup\n @config_manager = Sassconf::ConfigManager.new\n end",
"def components_scss\n Dir[src_path.join('components', '**', '*.scss').to_s]\n end",
"def stylesheet\n @stylesheet ||= Dir.glob(root+'/**/parts.*css').first\n end",
"def css_files\n files = [\"#{url_location}/codemirror.css\", \"#{url_location}/application.css\"]\n\n if Raddocs.configuration.include_bootstrap\n files << \"#{url_location}/bootstrap.min.css\"\n end\n\n Dir.glob(File.join(docs_dir, \"styles\", \"*.css\")).each do |css_file|\n basename = Pathname.new(css_file).basename\n files << \"#{url_location}/custom-css/#{basename}\"\n end\n\n files.concat Array(Raddocs.configuration.external_css)\n\n files\n end",
"def watch\n start_watch\n end",
"def watch(opts)\n @watcher.set_files(opts[:files]) if opts[:files]\n @watcher.watch(method(:files_changed))\n end",
"def watch(*globs)\n @watchlist.accept(globs) unless globs.empty?\n @watchlist\n end",
"def run_all\n run_on_changes(Watcher.match_files(self, Dir.glob('**{,/*/**}/*.coffee')))\n end",
"def css_path_for(sass_path)\n sass_path \\\n .gsub(\"#{RAILS_ROOT}/public/stylesheets/sass/\",\"#{RAILS_ROOT}/public/stylesheets/\") \\\n .gsub(\".sass\",\".css\")\n end",
"def start\n create_updater\n if options[:compile_on_start]\n reporter.announce \"Guard::Compass is going to compile your stylesheets.\"\n perform\n else\n reporter.announce \"Guard::Compass is waiting to compile your stylesheets.\"\n end\n true\n end",
"def stylesheets\n Dir[Dir.pwd + '/*.css'].map { |path| File.read(path) }\n end",
"def stylesheets\n Dir[Dir.pwd + '/*.css'].map { |path| File.read(path) }\n end",
"def configure_compass\n ::Compass.configuration do |config|\n config.project_path = root_path\n config.images_dir = build_path.relative_path_from(root_path).to_s\n config.images_path = root_path.join('app').to_s\n config.http_images_dir = '/'\n config.sass_options = {:cache_location => tmp_path.join('sass-cache')}\n\n config.on_sprite_generated do |sprite_data|\n FileUtils.rm(Dir[build_path.join('images-*.png')])\n end\n end\n end",
"def add_sass_load_path!(*paths)\n Sass.load_paths << File.join(*paths)\n end",
"def monitored_paths\n paths = Dir['**/*'].select do |path|\n watch = false\n @script.rules.reverse.each do |r|\n rule_watches = r.watch(path)\n if false\n $stderr.print \"watch \", path, \" \", rule_watches, \"\\n\"\n end\n next if rule_watches.nil?\n watch = rule_watches\n break\n end\n watch\n end\n paths.each do |path|\n # $stderr.print \"lookup #{path}\\n\"\n @script.depends_on(path).each do |dependence|\n # $stderr.print \"add #{dependence} for #{path}\\n\"\n paths << dependence\n end\n end\n paths.push(@script.path).compact!\n paths.uniq!\n # $stderr.print \"watch #{paths.map {|path| Pathname(path).expand_path }.join(' ')}\\n\"\n paths.map {|path| Pathname(path).expand_path }\n end",
"def add_sass_functions!(asset_roots)\n Sass::Script::Functions.send(:include, asset_roots)\n end",
"def compile(opts={})\n app = Rails.application\n env = app.assets || Sprockets::Railtie.build_environment(app)\n\n pathname = Pathname.new(\"app/assets/stylesheets/#{@target}.scss\")\n\n context = env.context_class.new(\n environment: env,\n filename: \"#{@target}.scss\",\n pathname: pathname,\n metadata: {}\n )\n\n debug_opts = Rails.env.production? ? {} : {\n line_numbers: true,\n # debug_info: true, # great with Firebug + FireSass, but not helpful elsewhere\n style: :expanded\n }\n\n importer_class = opts[:safe] ? NilavuSafeSassImporter : NilavuSassImporter\n\n css = ::Sass::Engine.new(@scss, {\n syntax: :scss,\n cache: false,\n read_cache: false,\n style: :compressed,\n filesystem_importer: importer_class,\n load_paths: context.environment.paths.map { |path| importer_class.new(path.to_s) },\n sprockets: {\n context: context,\n environment: context.environment\n }\n }.merge(debug_opts)).render\n\n css_output = css\n if opts[:rtl]\n begin\n require 'r2'\n css_output = R2.r2(css) if defined?(R2)\n rescue; end\n end\n css_output\n end",
"def include_css(path)\n if !AppConfig.force_all_css and (use_cache? or browser_is? :ie)\n \"min/#{path}.css\"\n else\n result = []\n Dir[\"#{RAILS_ROOT}/public/stylesheets/#{path}/**/*.css\"].each do |css|\n result << css.gsub(\"#{RAILS_ROOT}/public/stylesheets/\", \"\")\n end\n return result\n end\n end",
"def boilerplate(page)\n if page.path =~ /^\\w+\\.sass$/\n name = File.join(Config.root, 'views', 'style', $&)\n page.content = File.read(name) if File.file?(name)\n end\n end",
"def start\n puts \"Watching these files for changes #{glob}...\"\n configure_directory_watcher\n setup_graceful_exit\n \n directory_watcher.start.join\n end",
"def css_to_sass(css_data)\n sass = nil\n Tempfile.open(\"css_to_sass\") do |file|\n # Write the css\n file.write css_data\n\n # Rewind back to the start\n file.rewind\n\n # Use the std sass command line to convert a CSS file to SASS\n command = \"sass-convert #{file.path}\"\n sass = `#{command}`\n end\n sass\n end",
"def add_css_override\n file = \"app/assets/stylesheets/admin/admin.scss\"\n template(file, file)\n end",
"def cycle\n before_cycle\n\n rotation{|file| @watcher.watch(file) }\n @watcher.changed_files{|f| safe_load(f) }\n\n after_cycle\n end",
"def sass_file?\n SASS_FILE_EXTS.include?(extname)\n end",
"def on_stylesheet_saved(filename)\r\n source = @site.config['destination']\r\n @site.static_files <<\r\n CompassFile.new(\r\n @site,\r\n source,\r\n File.dirname(filename)[source.length..-1],\r\n File.basename(filename)\r\n )\r\n nil\r\n end",
"def syntax\n :sass\n end",
"def watch_file\n if sync_up? && (@watcher.nil? || [email protected]?)\n BBLib.logger.debug(\"Spinning up a configuration watcher for #{path}\")\n @watcher = Thread.new do\n loop do\n break unless sync_up?\n if path && File.exist?(path) && File.mtime(path) > last_refresh\n reload\n end\n sleep(interval)\n end\n end\n end\n end",
"def convert_css(stylesheets)\n FileUtils.mkdir_p(File.join(stylesheets))\n Dir.foreach @base_theme_directory do |file|\n next unless /^#{@prefix}\\..*\\.css$/ =~ file\n next if [\"{#{@prefix}.all.css\", \"#{@prefix}.base.css\"].include? file\n css = File.read(File.join(@base_theme_directory, file))\n\n if \"{#{@prefix}.autocomplete.css\".include? file\n # Removing autocomplete image to add it later by script\n if css[112..135] == \".ui-autocomplete-loading\"\n css[220, 0] = \"*/\"\n css[112, 0] = \"/*\"\n end\n end\n\n open File.join(stylesheets, '_' + file.gsub(/\\.css$/, '.scss').gsub(/^#{@prefix}\\./, '')), 'w' do |f|\n if file == @theme_filename\n f.print(self.class.theme_css2sass(@base_theme))\n else\n f.print(self.class.css2sass(css))\n end\n f.close\n end\n end\n end",
"def namespace_by_filename\n rename_body\n indent_sass\n namespace_sass\n\n # remove the @char style css directives (can't be indented)\n move_css_directives\n puts sass\n end",
"def reload\n Dir.glob('**/*').each { |file| reload_file(file) }\n end",
"def syntax\n :scss\n end",
"def configure_compass(config)\r\n ::Compass.add_configuration(config, 'Jekyll::Compass')\r\n\r\n ::Compass.configuration.on_stylesheet_saved(\r\n &method(:on_stylesheet_saved)\r\n )\r\n ::Compass.configuration.on_sprite_saved(\r\n &method(:on_sprite_saved)\r\n )\r\n ::Compass.configuration.on_sprite_removed(\r\n &method(:on_sprite_removed)\r\n )\r\n nil\r\n end",
"def syntax(path)\n path.to_s.include?('.sass') ? :sass : :scss\n end",
"def compile_for_project(contents, options = {})\n Compass.add_project_configuration\n options[:syntax] ||= :scss\n Sass::Engine.new(contents, Compass.configuration.to_sass_engine_options.merge(options)).render\n end",
"def sass_code\n @sass_code ||= File.read(sass_file)\n end",
"def sass_options\n ctx = @context\n\n preexisting_load_paths = begin\n ::Sass.load_paths\n rescue\n []\n end\n\n more_opts = {\n load_paths: preexisting_load_paths + ctx.app.config[:sass_assets_paths],\n filename: eval_file,\n line: line,\n syntax: syntax,\n custom: {}.merge!(options[:custom] || {}).merge!(\n middleman_context: ctx.app,\n current_resource: ctx.current_resource\n )\n }\n\n if ctx.app.config[:sass_source_maps] || (ctx.app.config[:sass_source_maps].nil? && ctx.app.development?)\n more_opts[:source_map_file] = '.'\n more_opts[:source_map_embed] = true\n more_opts[:source_map_contents] = true\n end\n\n if ctx.is_a?(::Middleman::TemplateContext) && file\n more_opts[:css_filename] = file.sub(/\\.s[ac]ss$/, '')\n end\n\n {}.merge!(options).merge!(more_opts)\n end",
"def pages_scss\n Dir[src_path.join('pages', '**', '*.scss').to_s]\n end",
"def stylesheets\n sort(css.clone.concat(sass_without_partials), config['order_css'] || [])\n end",
"def render_sass type\n template = File.open(@filename).read\n begin\n css = Sass::Engine.new(template, syntax: type).render\n rescue Exception => ex\n error \"In #{@filename}\\n #{ex}\"\n end\n @filename.gsub!(/(sass|scss)$/, 'css')\n File.open(@filename, \"w\") {|out| out.puts css }\n end",
"def copy_stylesheets\n FileUtils.mkdir_p \"app/assets/stylesheets/base\"\n\n #Copy variable file\n copy_file \"../../vendor/assets/stylesheets/fenrir/base/_default_config.scss\", \"app/assets/stylesheets/base/config.scss\"\n end",
"def sg_usemin_css(path, options={})\n usemin = SlimGruntHelpers::Models::UseminCss.new\n options = { alt: nil, absolute: false }.merge!(options)\n\n alt = ''\n alt = \"(#{ options[:alt] })\" unless options[:alt].nil?\n\n text = \"\\n<!-- build:css#{ alt } #{ path } -->\\n\"\n yield(usemin)\n usemin.each(options) do |link|\n text << \"#{ link }\\n\"\n end\n text << \"<!-- endbuild -->\\n\"\n end",
"def sass_file?\n Jekyll::Document::SASS_FILE_EXTS.include?(ext)\n end",
"def compile(css, include_paths, settings)\n\tcss\nend",
"def run(options = {})\n paths.each do |path|\n Dir.chdir(path) do\n Dir[\"**/*.less\"].each do |less_sheet|\n directory = File.dirname(less_sheet)\n target_filename = File.basename(less_sheet, File.extname(less_sheet)) + \".css\"\n destination = \"#{directory}/#{target_filename}\"\n \n if !File.exists?(destination) || File.stat(less_sheet).mtime > File.stat(destination).mtime\n engine = File.open(less_sheet) {|f| Less::Engine.new(f) }\n css = engine.to_css\n css.delete(\"\\n\") if options[:compress]\n \n FileUtils.mkdir_p(directory)\n File.open(destination, \"w\") {|file|\n file.write HEADER % [path + \"/\" + less_sheet] if Rails.env == \"development\"\n file.write css\n }\n end\n end\n end # chdir\n end # each\n end",
"def run(options = {})\n paths.map {|path| Dir[\"#{path}/*.less\"]}.flatten.each {|less_source|\n destination_filename = \"#{File.basename(less_source, File.extname(less_source))}.css\"\n destination = \"#{STYLESHEETS_PATH}/#{destination_filename}\"\n \n if !File.exists?(destination) || File.stat(less_source).mtime > File.stat(destination).mtime\n engine = Less::Engine.new(File.read(less_source))\n css = Less.version > \"1.0\" ? engine.to_css : engine.to_css(:desc)\n css.delete!(\"\\n\") if options[:compress]\n \n File.open(destination, \"w\") {|file|\n file.write HEADER % [destination_filename] if Rails.env == \"development\"\n file.write css\n }\n end\n }\n end",
"def get_default_global_watcher\n super\n end",
"def get_default_global_watcher\n super\n end",
"def watch_src\n Dispatch::Queue.concurrent.async do\n raise \"$project_src_dir undefined.\" if ! $project_src_dirs\n\n dirs = $project_src_dirs.map { |dir| dir.stringByExpandingTildeInPath }\n options = FSEvent::CLI.parse(dirs.dup << '--file-events')\n format = options[:format]\n\n notifier = FSEvent::Notifier.new\n options[:urls].each do |url|\n puts \"watching #{url.path} with options #{options}\"\n notifier.watch(url.path, *options[:create_flags], options) do |event_list|\n event_list.events.each do |event|\n puts \"reload #{event.path}\"\n self.load_src File.basename(event.path.to_s)\n\n if block_given?\n puts \"yield to block\"\n yield\n end\n end\n end\n end\n notifier.run\n end\n end",
"def css_includes *ss\n\t\t\tss.each { |s|\n\t\t\t\tlink :rel => 'stylesheet', :media => 'all', :href => s\n\t\t\t}\n\t\tend",
"def default_sass_options\n\t\t\t\t# Just use sassc defaults.\n\t\t\t\tSprockets::Sassc.options.dup\n\t\t\tend",
"def include_stylesheets\n Pathname.new(StylesheetDir).find do |path|\n next unless path.file?\n if @one_file\n @outfile.puts \" <style>\"\n @outfile.puts path.read\n @outfile.puts \" </style>\"\n else\n @outfile.puts \"<link href=\\\"lib/stylesheets/#{path.basename}\\\" media=\\\"screen\\\" rel=\\\"stylesheet\\\" type=\\\"text/css\\\" />\"\n end\n end\n end",
"def compress_min_css\n File.open(base_css_file, 'w') do |file|\n file.write(\n SassC::Engine.new(\n File.read(base_scss_file), style: :compressed\n ).render\n )\n end\n FileUtils.remove_file(base_scss_file, true)\n end",
"def watch(file)\n return true if watching?(file) # if already watching\n if stat = safe_stat(file)\n @files[file] = stat\n end\n end",
"def process_flat_ui_stylesheet_assets!\n log_status 'Processing stylesheets...'\n files = read_files('less', flat_ui_less_files)\n\n log_status ' Converting LESS files to Scss:'\n files.each do |name, file|\n log_processing name\n\n # apply common conversions\n # icon-font bombs on this so skip it\n file = convert_less(file) unless name =~ /flat-ui|glyphicons/\n file = replace_file_imports(file)\n file = cleanup_whitespace(file)\n case name\n when 'flat-ui.less'\n lines = file.split \"\\n\"\n lines.reject! {|line|\n #kill the fonts lines, those are up to the user\n #kill variables since those need to be manually imported before bootstrap\n line =~ /fonts|url|variables/\n }\n\n # Add a comment for the icon font\n icon_font_import = lines.index {|line| line =~ /glyphicons/}\n lines.insert(icon_font_import, '// Flat-UI-Icons')\n lines.delete_at(icon_font_import+2)\n\n file = lines.join \"\\n\"\n when 'mixins.less'\n NESTED_MIXINS.each do |selector, prefix|\n file = flatten_mixins(file, selector, prefix)\n end\n file = varargify_mixin_definitions(file, *VARARG_MIXINS)\n file = deinterpolate_vararg_mixins(file)\n %w(responsive-(in)?visibility input-size text-emphasis-variant bg-variant).each do |mixin|\n file = parameterize_mixin_parent_selector file, mixin\n end\n file = replace_ms_filters(file)\n if pro?\n file = replace_all file, /(?<=[.-])\\$state/, '#{$state}'\n else\n # calc-color mixin only exists in Flat-UI free\n file = replace_all file, /-(\\$.+-color)/, '-#{\\1}'\n file = replace_all file, /#\\{\\$\\$\\{(.+)\\}\\}/, 'interpolate_variable($\\1)'\n end\n file = replace_rules(file, ' .list-group-item-') { |rule| extract_nested_rule rule, 'a&' }\n file = replace_all file, /,\\s*\\.open \\.dropdown-toggle& \\{(.*?)\\}/m,\n \" {\\\\1}\\n .open & { &.dropdown-toggle {\\\\1} }\"\n file = replace_all file, '$ratio, $ratio-y', '$scale-args'\n file = convert_grid_mixins file\n when 'variables.less'\n file = insert_default_vars(file)\n if ::Sass::VERSION >= '3.3.0'\n file = unindent <<-SCSS + file, 14\n // a flag to toggle asset pipeline / compass integration\n $flat-ui-sass-asset-helper: function-exists(flat-ui-font-path) !default;\n\n SCSS\n else\n file = unindent <<-SCSS + file, 14\n // a flag to toggle asset pipeline / compass integration\n // defaults to true if flat-ui-font-path function is present (no function => twbs-font-path('') parsed as string == right side)\n $flat-ui-sass-asset-helper: (flat-ui-font-path(\"\") != unquote('flat-ui-font-path(\"\")')) !default;\n\n SCSS\n end\n file = fix_variable_declaration_order file\n file = replace_all file, /(\\$icon-font-path:\\s+).*(!default)/, '\\1\"'+@output_dir+'/\" \\2'\n when 'modules/buttons.less'\n file = extract_nested_rule file, '.btn-xs&'\n file = extract_nested_rule file, '.btn-hg&'\n when 'modules/forms.less'\n # Fix mixin regex not supporting non-variable arguments\n file.gsub! /@include input-size\\((?:\\$.+)\\);/ do |match|\n match.gsub /; /, ', '\n end\n file = apply_mixin_parent_selector(file, '\\.input-(?:sm|lg|hg)')\n when 'modules/input-groups.less'\n file = replace_rules(file, '.input-group-rounded') do |rule|\n extract_and_combine_nested_rules rule\n end\n when 'modules/glyphicons.less'\n file = replace_vars(file)\n file = replace_escaping(file)\n file = replace_all file, /\\#\\{(url\\(.*?\\))}/, '\\1'\n file = replace_rules(file, '@font-face') { |rule|\n rule = replace_all rule, /(\\$icon-font(?:-\\w+)+)/, '#{\\1}'\n replace_asset_url rule, :font\n }\n when 'modules/login.less'\n file = fix_flat_ui_image_assets file\n when 'modules/navbar.less'\n # Fix mixin regex not supporting non-variable arguments\n file.gsub! /@include input-size\\((?:\\$.+)\\);/ do |match|\n match.gsub /; /, ', '\n end\n file = apply_mixin_parent_selector(file, '\\.navbar-input')\n when 'modules/palette.less'\n file.gsub! /@include calc-color\\((.+)\\);/ do |match|\n match.gsub /#\\{([\\w\\-]+)\\}/, '\"\\1\"'\n end\n when 'modules/select.less'\n # Fix the include that the converter makes an extend\n file = replace_all file, /@extend \\.caret/, '@include caret'\n when 'modules/spinner.less'\n # Fix mixin regex not supporting non-variable arguments\n file.gsub! /@include spinner-variant\\((?:\\$?.+)\\);/ do |match|\n match.gsub /; /, ', '\n end\n when 'modules/switch.less'\n file = fix_flat_ui_image_assets file\n when 'modules/tile.less'\n file = fix_flat_ui_image_assets file\n when 'modules/todo.less'\n file = fix_flat_ui_image_assets file\n when 'modules/thumbnails.less'\n file = extract_nested_rule file, 'a&'\n when 'modules/type.less'\n # Since .bg-primary has a color associated with it we need to divide it into\n # two selectors\n file = replace_rules(file, '.bg-primary') do |rule|\n parts = rule.split \"\\n\"\n selector = parts.index {|line| line =~ /\\.bg-primary/}\n mixin = parts.index {|line| line =~ /@include/}\n parts.insert(mixin, \"}\\n#{parts[selector]}\")\n rule = parts.join \"\\n\"\n end\n file = apply_mixin_parent_selector(file, '\\.(text|bg)-(success|primary|info|warning|danger)')\n when 'modules/video.less'\n file = replace_rules(file, /\\s*\\.vjs(?:-(?:control|time))?(?!-\\w+)/) do |rule|\n selector = get_selector(rule).scan(/\\.vjs(?:-(?:control|time))?(?!-\\w+)/).first\n convert_arbitrary_less_ampersand(rule, selector)\n end\n file = fix_flat_ui_image_assets file\n end\n\n name = name.sub(/\\.less$/, '.scss')\n base = File.basename(name)\n name.gsub!(base, \"_#{base}\") unless base == 'flat-ui.scss'\n path = File.join(@dest_path[:scss], name)\n save_file(path, file)\n log_processed File.basename(path)\n end\n\n manifest = File.join(@dest_path[:scss], '..', \"#{@output_dir}.scss\")\n save_file(manifest, \"@import \\\"#{@output_dir}/flat-ui\\\";\")\n end",
"def sass_cache_bust(file_name)\n require 'digest/md5'\n file_contents = Dir.glob(\"_sass/*\").map{|f| File.read(f) }.join\n file_name + '?' + Digest::MD5.hexdigest(file_contents)\n\n end",
"def watch_sketch\n ensure_exists(filename)\n spin_up('watch.rb', filename, argc)\n end",
"def watch_sketch\n ensure_exists(filename)\n spin_up('watch.rb', filename, argc)\n end",
"def update\n css = _combine\n\n begin\n # SCSS code executing needs to know what the current instance of Chance is,\n # so that lookups for slices, etc. work.\n Chance._current_instance = self\n\n # Step 1: parse CSS\n parser = Chance::Parser.new(css, @options)\n parser.parse\n\n # Step 2: get parsed slices, slice images as needed, generate CSS for the slices,\n # and add the CSS it generates to parsed output CSS.\n \n # note that it is saved to @slices so that the slices may be found by the SCSS\n # extensions that help find offset, etc.\n @slices = parser.slices\n slice_images\n \n imager = Chance::DataURLImager.new(parser.slices, self) # for now, only DataURLs\n \n css = parser.css + \"\\n\" + imager.css\n\n # Step 3: Create output\n engine = Sass::Engine.new(css, Compass.sass_engine_options.merge({ :syntax => :scss })) \n css = engine.render\n ensure\n Chance._current_instance = nil\n end\n\n @css = css\n end",
"def styles(options = {})\n imported = if options[:import]\n [*options[:import]].map { |name| File.read(\"#{self.options.views}/#{name}.sass\") }.join(\"\\n\")\n end\n\n rendered_styles = fancyviews.included_styles.map do |name, sass| \n # would be nice if construction took an :offest to go along with the :filename\n eng = Sass::Engine.new((imported || '') + \"\\n\" + sass,\n :attribute_syntax => :normal,\n :load_paths => [self.options.views])\n \"\\n/* -- #{name} -- */\\n\" + eng.render\n end.join\n\n style_tag(rendered_styles, options[:media])\n end",
"def assets\n unless IO.read(\"app/assets/stylesheets/application.css\").include?(\"Required by SULChrome\")\n insert_into_file \"app/assets/stylesheets/application.css\", :after => \"/*\" do\n %q{\n * Required by SULChrome:\n *= require sul_chrome/sul_chrome_base\n *}\n end\n end\n unless IO.read(\"app/assets/javascripts/application.js\").include?(\"Required by SULChrome\")\n insert_into_file \"app/assets/javascripts/application.js\", :before => \"//= require_tree .\" do\n%q{// Required by SULChrome:\n//= require sul_chrome/sul_chrome_base\n}\n end\n end\n end",
"def add_css(files)\n return add_data(files, :stylesheets, '.css')\n end"
] | [
"0.64912426",
"0.6056147",
"0.60549134",
"0.5970292",
"0.5957853",
"0.5919863",
"0.5919863",
"0.5875404",
"0.58700407",
"0.58250546",
"0.5756323",
"0.57425994",
"0.57360333",
"0.5714035",
"0.56939477",
"0.5683122",
"0.56240606",
"0.56196827",
"0.55729693",
"0.5562775",
"0.5538467",
"0.5538348",
"0.5526117",
"0.55118746",
"0.54778904",
"0.54673946",
"0.5457397",
"0.5452242",
"0.54443496",
"0.541411",
"0.541411",
"0.5413339",
"0.5390567",
"0.5370316",
"0.53540176",
"0.5330155",
"0.53111726",
"0.5292557",
"0.5292529",
"0.528467",
"0.5277531",
"0.52474415",
"0.524727",
"0.5242533",
"0.52191126",
"0.5216984",
"0.5213657",
"0.5189847",
"0.51876324",
"0.516701",
"0.5124943",
"0.5124943",
"0.51194876",
"0.51169556",
"0.5113171",
"0.51103854",
"0.5102902",
"0.50922894",
"0.5066036",
"0.5049874",
"0.5039876",
"0.5038665",
"0.50368655",
"0.50316596",
"0.5029301",
"0.50101477",
"0.5008243",
"0.49927884",
"0.49715638",
"0.49547848",
"0.49391592",
"0.49184582",
"0.49145856",
"0.4912474",
"0.49110287",
"0.49109864",
"0.49025494",
"0.48965916",
"0.4892083",
"0.48795974",
"0.48723468",
"0.48620743",
"0.4854109",
"0.4837123",
"0.48367742",
"0.48310176",
"0.48310176",
"0.483095",
"0.48292345",
"0.48272738",
"0.48265085",
"0.48246455",
"0.48210582",
"0.48204502",
"0.4811799",
"0.48068514",
"0.48068514",
"0.48067304",
"0.48057267",
"0.48024058",
"0.47992572"
] | 0.0 | -1 |
Enable watching of css files in Sass 3.3+ | def watched_file?(file)
archive_file == file
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_sass\n Dir[\"#{RAILS_ROOT}/public/stylesheets/sass/**/*.sass\"]\n end",
"def sass_files\n [\n styles_scss, components_scss, pages_scss\n ].flatten!\n end",
"def css_to_scss\n Proc.new {|task| task.sub(/^#{CSS_DIR}/, SASS_DIR).\n sub(/\\.css$/, '.scss')}\nend",
"def sass_options\n { \n :load_paths => [ theme_stylesheets_path, Sass::Plugin.options[:load_paths] ].flatten \n }\n end",
"def start_watch_files\n coffee_files.each do |file|\n @notifier.watch(file, :modify) do\n CoffeeCompiler.compile_file(file, true, true)\n end\n end\n end",
"def sass_file?; end",
"def sass_file?; end",
"def sass *sass_names\n install_deps 'haml', :type => Gem\n\n sass_names.flatten.each do |name|\n sass_file = \"public/stylesheets/sass/#{name}.sass\"\n css_file = \"public/stylesheets/#{name}.css\"\n sass_cmd = \"cd #{self.checkout_path} && sass #{sass_file} #{css_file}\"\n\n @shell.call sass_cmd\n end\n end",
"def update_stylesheets\n return if options[:never_update]\n\n @@checked_for_updates = true\n Dir.glob(File.join(options[:template_location], \"**\", \"*.sass\")).entries.each do |file|\n\n # Get the relative path to the file with no extension\n name = file.sub(options[:template_location] + \"/\", \"\")[0...-5]\n\n if !forbid_update?(name) && (options[:always_update] || stylesheet_needs_update?(name))\n css = css_filename(name)\n File.delete(css) if File.exists?(css)\n\n filename = template_filename(name)\n engine = Engine.new(File.read(filename), engine_options(:filename => filename))\n result = begin\n engine.render\n rescue Exception => e\n exception_string(e)\n end\n\n # Create any directories that might be necessary\n dirs = [options[:css_location]]\n name.split(\"/\")[0...-1].each { |dir| dirs << \"#{dirs[-1]}/#{dir}\" }\n dirs.each { |dir| Dir.mkdir(dir) unless File.exist?(dir) }\n\n # Finally, write the file\n File.open(css, 'w') do |file|\n file.print(result)\n end\n end\n end\n end",
"def sass_example(file)\n file = File.new(Dir.glob(File.join(Sinatra::Application.root , '../sass', \"#{file}.{sass,scss}\").to_s).first)\n\n code_toggle file.read(), Pathname.new(file.path).relative_path_from(Pathname.new(Sinatra::Application.root)), file.mtime\n end",
"def watch!\n start_watch true\n end",
"def build_css\n Dir[\"#{@src_dir}/stylesheets/**/*.{sass,scss}\"].each do |path|\n file_dir, template = source_template_from_path(path.sub(/^#{@src_dir}\\/stylesheets/, ''))\n\n if !template.match(/(^|\\/)\\_/)\n save_stylesheet(File.join(file_dir, template), generate_css(template, file_dir))\n end\n end\n end",
"def setup\n @config_manager = Sassconf::ConfigManager.new\n @sass_executor = Sassconf::SassExecutor.new(SCSS_PATH, CSS_PATH)\n end",
"def also_reload(*glob)\n Dir[*glob].each { |path| Watcher::List.for(self).watch_file(path) }\n end",
"def watch!(*globs)\n @watchlist.accept!(globs)\n end",
"def all_scss_into_one_file\n File.open(base_scss_file, 'w') do |file|\n sass_files.each do |sass_file|\n file.write(\"/* file: #{sass_file} */\\n\") if development?\n file.write(File.read(sass_file))\n end\n end\n end",
"def sass_options\n @sass_options ||= {\n line_comments: false,\n syntax: :sass,\n style: :compressed\n }\n end",
"def refresh_watchers()\r\n paths = []\r\n\r\n # A list of all file paths the user passed in.\r\n unresolved_paths = @path.split(',')\r\n unresolved_paths = unresolved_paths.size == 0 ? @path : unresolved_paths\r\n\r\n # Glob all file paths and keep all readable files.\r\n for unresolved_path in unresolved_paths\r\n paths += Dir.glob(unresolved_path.strip).select do |resource|\r\n File.file?(resource) && File.readable?(resource)\r\n end\r\n end\r\n\r\n watched = @watched_files.keys\r\n\r\n # Files we are not yet watching.\r\n new_files = paths - watched\r\n\r\n # Files we are watching that no longer exist.\r\n dead_files = watched - paths\r\n\r\n start_watches(new_files)\r\n stop_watches(dead_files, true)\r\n end",
"def watch\n paths = [ Rails.root.join('app'), Rails.root.join('lib') ]\n @worker.log \"Watching files in #{paths}\"\n\n reloader = ActiveSupport::FileUpdateChecker.new(paths) { rework }\n Rails.application.reloaders << reloader\n\n ActionDispatch::Reloader.to_prepare do\n reloader.execute_if_updated\n end\n\n true\n end",
"def sass_options(uri, importer, options)\n options.merge!(:filename => uri.gsub(%r{\\*/},\"*\\\\/\"), :syntax => :scss, :importer => importer)\n end",
"def css\n css_files = []\n @assets.each do |type, path|\n case type\n when :folder\n # Don't import any css/scss files that start with an underscore, so scss partials\n # aren't imported by default:\n # http://sass-lang.com/guide\n css_files += Dir[\"#{path}/**/[^_]*.{css,scss}\"].sort.map do |folder|\n '/assets' + folder[path.size..-1].gsub(/[.]scss$/, '')\n end\n when :css_file\n css_files << path\n end\n end\n\n css_files.uniq\n end",
"def compile_css(debug: false)\n require 'compass'\n require 'compass/sass_compiler'\n require 'sass-css-importer'\n\n Compass.configuration.add_import_path \"#{$css_source}/imports\"\n configs = {}\n configs[:project_path] = \".\"\n configs[:http_path] = \"/\"\n configs[:sass_path] = $css_source\n configs[:css_path] = $css_dest\n configs[:cache_path] = $cache_dir\n configs[:images_path] = \"static/images/\"\n configs[:output_style] = debug ? :nested : :compressed\n configs[:line_comments] = debug ? true : false\n Compass.add_configuration(configs, \"basho_docs_configs\")\n\n # This will grab every .scss file in the $css_source directory, and run them\n # through Compass, generating equivalently-named .css files in the static/css\n # directory. We should try to keep the number of compiled sources to a minimum\n # though, and simply add new/parsed scss/css files to `all.scss`.\n compiler = Compass.sass_compiler({\n :only_sass_files => Dir.glob(\"#{$css_source}/*.scss\")\n })\n compiler.compile!\nend",
"def watch\n @listener ||= Listen.to(\n File.dirname(PATH),\n only: /\\A#{File.basename(PATH)}\\z/\n ) do |modified, added, removed|\n next if modified.empty? && added.empty? && removed.empty?\n\n reload\n end\n\n @listener.start\n end",
"def run_all\n run_on_change(\n Watcher.match_files(\n self, \n Dir.glob(File.join(::Guard.listener.directory, '**', '*.s[ac]ss')).\n map {|f| f[::Guard.listener.directory.size+1..-1] }.\n reject {|f| partial?(f) }\n )\n )\n end",
"def start_watching\n start_runner\n loop do\n if @files.detect { |file| File.exists?(file) && File.stat(file).mtime > @time }\n puts \"reloading sketch...\"\n $app && $app.close\n @time = Time.now\n GC.start\n start_runner\n reload_files_to_watch\n end\n sleep 0.33\n end\n end",
"def check_for_sass_files!(compiler)\n if compiler.sass_files.empty?\n message = \"Nothing to compile. If you're trying to start a new project, you have left off the directory argument.\\n\"\n message << \"Run \\\"compass -h\\\" to get help.\"\n raise Compass::Error, message\n end\n end",
"def sass_file_url; end",
"def render\n Dir.glob(File.join(@working_dir, STYLES_DIR, '**/*')) do |filename|\n @filename = filename\n if @filename.end_with?(\".sass\")\n render_sass :sass\n elsif @filename.end_with?(\".scss\")\n render_sass :scss\n end\n end\n end",
"def sass_options\n\t\t\t\t# NOTE: For Sassc importer is now a **class** and not an instance.\n\n\t\t\t\t# Allow the use of custom SASS importers, making sure the\n\t\t\t\t# custom importer is a `Sprockets::Sass::Importer`\n\t\t\t\tif default_sass_options.has_key?(:importer) &&\n\t\t\t\t\t (default_sass_options[:importer] <= Importer)\t# Check if the :importer class is Importer or inherits from Importer\n\t\t\t\t\timporter = default_sass_options[:importer]\n\t\t\t\telse\n\t\t\t\t\t# Pass the Importer class\n\t\t\t\t\timporter = Importer\n\t\t\t\tend\n\n\t\t\t\topts = merge_sass_options(default_sass_options, options).merge(\n\t\t\t\t\tfilename: eval_file,\n\t\t\t\t\tsyntax: syntax,\n\t\t\t\t\timporter: importer,\n\t\t\t\t\t\n\t\t\t\t\t# 2016-01-28\n\t\t\t\t\t# cache_store: cache_store,\n\t\t\t\t\t\n\t\t\t\t\t# Based on sassc-rails implementation.\n\t\t\t\t\tsprockets: { context: context },\n\t\t\t\t\t\n\t\t\t\t\t# `custom.sprockets_context` is kept to be backward-compatible\n\t\t\t\t\t# with sprockets-sass setup.\n\t\t\t\t\tcustom: { :sprockets_context => context }\n\t\t\t\t)\n\t\t\t\t\n\t\t\t\tif opts[:inline_source_maps]\n\t\t\t\t\t# inline_source_maps: true,\t# sassc-rails property\n\t\t\t\t\topts.merge!({\n\t\t\t\t\t\tsource_map_file: \".\",\n\t\t\t\t\t\tsource_map_embed: true,\n\t\t\t\t\t\tsource_map_contents: true\t\t\t\t\t\t\n\t\t\t\t\t})\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\topts\n\t\t\tend",
"def watch()\n merge(watch: 'true')\n end",
"def watch()\n merge(watch: 'true')\n end",
"def watch(&block)\n\n # Startup File Watcher\n script_changed = lambda { |modified, added, removed|\n\n @log.debug \"File(s) changed! - #{modified.join(\", \")}\" unless (modified.nil? || modified.empty?)\n @log.debug \"File(s) added! - #{added.join(\", \")}\" unless (added.nil? || added.empty?)\n @log.debug \"File(s) removed! - #{removed.join(\", \")}\" unless (removed.nil? || removed.empty?)\n\n block.call(modified, added, removed)\n }\n\n pig_listener = Listen.to(@project_root_path,\n :ignore => /(^\\..*$|logs.*)/)\n\n pig_listener.change(&script_changed)\n pig_listener.start\n\n\tend",
"def refresh_css(interval=5)\n return if @next_reload && @next_reload > Time.new\n mode = File::RDWR|File::CREAT\n File.open(File.join(@context.public_root, 'bundle.css'), mode) do |f|\n f.flock(File::LOCK_EX) # Avoid race condition\n now = Time.new\n if !@next_reload || @next_reload < now\n @next_reload = now + interval\n @ctx_app_root ||= @context.app_root\n f.rewind\n compile_css(f, true)\n f.flush.truncate(f.pos)\n end # if\n end # open\n end",
"def watchable_files; end",
"def css\n project_file_read(\"all.css\")\nend",
"def when_sprockets_available\n if !SKIP_SPROCKETS\n yield\n end\nend",
"def start\n options[:api_version] ||= '1.4'\n options[:host] ||= '0.0.0.0'\n options[:port] ||= '35729'\n options[:apply_js_live] ||= true\n options[:apply_css_live] ||= true\n \n @reactor = Reactor.new(options)\n \n create_updater\n UI.info \"Guard::Compass is watching at your stylesheets.\"\n true\n end",
"def reload!\n suppress_warnings do \n Dir['./**/*.rb'].each do |f| \n load f\n end\n end\n nil\nend",
"def watcher_css(object)\n \"#{object.class.to_s.underscore}-#{object.id}-watcher\"\n end",
"def watching?; @@watching == $$; end",
"def setup\n @config_manager = Sassconf::ConfigManager.new\n end",
"def components_scss\n Dir[src_path.join('components', '**', '*.scss').to_s]\n end",
"def stylesheet\n @stylesheet ||= Dir.glob(root+'/**/parts.*css').first\n end",
"def css_files\n files = [\"#{url_location}/codemirror.css\", \"#{url_location}/application.css\"]\n\n if Raddocs.configuration.include_bootstrap\n files << \"#{url_location}/bootstrap.min.css\"\n end\n\n Dir.glob(File.join(docs_dir, \"styles\", \"*.css\")).each do |css_file|\n basename = Pathname.new(css_file).basename\n files << \"#{url_location}/custom-css/#{basename}\"\n end\n\n files.concat Array(Raddocs.configuration.external_css)\n\n files\n end",
"def watch\n start_watch\n end",
"def watch(opts)\n @watcher.set_files(opts[:files]) if opts[:files]\n @watcher.watch(method(:files_changed))\n end",
"def watch(*globs)\n @watchlist.accept(globs) unless globs.empty?\n @watchlist\n end",
"def run_all\n run_on_changes(Watcher.match_files(self, Dir.glob('**{,/*/**}/*.coffee')))\n end",
"def css_path_for(sass_path)\n sass_path \\\n .gsub(\"#{RAILS_ROOT}/public/stylesheets/sass/\",\"#{RAILS_ROOT}/public/stylesheets/\") \\\n .gsub(\".sass\",\".css\")\n end",
"def start\n create_updater\n if options[:compile_on_start]\n reporter.announce \"Guard::Compass is going to compile your stylesheets.\"\n perform\n else\n reporter.announce \"Guard::Compass is waiting to compile your stylesheets.\"\n end\n true\n end",
"def stylesheets\n Dir[Dir.pwd + '/*.css'].map { |path| File.read(path) }\n end",
"def stylesheets\n Dir[Dir.pwd + '/*.css'].map { |path| File.read(path) }\n end",
"def configure_compass\n ::Compass.configuration do |config|\n config.project_path = root_path\n config.images_dir = build_path.relative_path_from(root_path).to_s\n config.images_path = root_path.join('app').to_s\n config.http_images_dir = '/'\n config.sass_options = {:cache_location => tmp_path.join('sass-cache')}\n\n config.on_sprite_generated do |sprite_data|\n FileUtils.rm(Dir[build_path.join('images-*.png')])\n end\n end\n end",
"def add_sass_load_path!(*paths)\n Sass.load_paths << File.join(*paths)\n end",
"def monitored_paths\n paths = Dir['**/*'].select do |path|\n watch = false\n @script.rules.reverse.each do |r|\n rule_watches = r.watch(path)\n if false\n $stderr.print \"watch \", path, \" \", rule_watches, \"\\n\"\n end\n next if rule_watches.nil?\n watch = rule_watches\n break\n end\n watch\n end\n paths.each do |path|\n # $stderr.print \"lookup #{path}\\n\"\n @script.depends_on(path).each do |dependence|\n # $stderr.print \"add #{dependence} for #{path}\\n\"\n paths << dependence\n end\n end\n paths.push(@script.path).compact!\n paths.uniq!\n # $stderr.print \"watch #{paths.map {|path| Pathname(path).expand_path }.join(' ')}\\n\"\n paths.map {|path| Pathname(path).expand_path }\n end",
"def add_sass_functions!(asset_roots)\n Sass::Script::Functions.send(:include, asset_roots)\n end",
"def compile(opts={})\n app = Rails.application\n env = app.assets || Sprockets::Railtie.build_environment(app)\n\n pathname = Pathname.new(\"app/assets/stylesheets/#{@target}.scss\")\n\n context = env.context_class.new(\n environment: env,\n filename: \"#{@target}.scss\",\n pathname: pathname,\n metadata: {}\n )\n\n debug_opts = Rails.env.production? ? {} : {\n line_numbers: true,\n # debug_info: true, # great with Firebug + FireSass, but not helpful elsewhere\n style: :expanded\n }\n\n importer_class = opts[:safe] ? NilavuSafeSassImporter : NilavuSassImporter\n\n css = ::Sass::Engine.new(@scss, {\n syntax: :scss,\n cache: false,\n read_cache: false,\n style: :compressed,\n filesystem_importer: importer_class,\n load_paths: context.environment.paths.map { |path| importer_class.new(path.to_s) },\n sprockets: {\n context: context,\n environment: context.environment\n }\n }.merge(debug_opts)).render\n\n css_output = css\n if opts[:rtl]\n begin\n require 'r2'\n css_output = R2.r2(css) if defined?(R2)\n rescue; end\n end\n css_output\n end",
"def include_css(path)\n if !AppConfig.force_all_css and (use_cache? or browser_is? :ie)\n \"min/#{path}.css\"\n else\n result = []\n Dir[\"#{RAILS_ROOT}/public/stylesheets/#{path}/**/*.css\"].each do |css|\n result << css.gsub(\"#{RAILS_ROOT}/public/stylesheets/\", \"\")\n end\n return result\n end\n end",
"def boilerplate(page)\n if page.path =~ /^\\w+\\.sass$/\n name = File.join(Config.root, 'views', 'style', $&)\n page.content = File.read(name) if File.file?(name)\n end\n end",
"def start\n puts \"Watching these files for changes #{glob}...\"\n configure_directory_watcher\n setup_graceful_exit\n \n directory_watcher.start.join\n end",
"def css_to_sass(css_data)\n sass = nil\n Tempfile.open(\"css_to_sass\") do |file|\n # Write the css\n file.write css_data\n\n # Rewind back to the start\n file.rewind\n\n # Use the std sass command line to convert a CSS file to SASS\n command = \"sass-convert #{file.path}\"\n sass = `#{command}`\n end\n sass\n end",
"def add_css_override\n file = \"app/assets/stylesheets/admin/admin.scss\"\n template(file, file)\n end",
"def cycle\n before_cycle\n\n rotation{|file| @watcher.watch(file) }\n @watcher.changed_files{|f| safe_load(f) }\n\n after_cycle\n end",
"def sass_file?\n SASS_FILE_EXTS.include?(extname)\n end",
"def on_stylesheet_saved(filename)\r\n source = @site.config['destination']\r\n @site.static_files <<\r\n CompassFile.new(\r\n @site,\r\n source,\r\n File.dirname(filename)[source.length..-1],\r\n File.basename(filename)\r\n )\r\n nil\r\n end",
"def syntax\n :sass\n end",
"def watch_file\n if sync_up? && (@watcher.nil? || [email protected]?)\n BBLib.logger.debug(\"Spinning up a configuration watcher for #{path}\")\n @watcher = Thread.new do\n loop do\n break unless sync_up?\n if path && File.exist?(path) && File.mtime(path) > last_refresh\n reload\n end\n sleep(interval)\n end\n end\n end\n end",
"def convert_css(stylesheets)\n FileUtils.mkdir_p(File.join(stylesheets))\n Dir.foreach @base_theme_directory do |file|\n next unless /^#{@prefix}\\..*\\.css$/ =~ file\n next if [\"{#{@prefix}.all.css\", \"#{@prefix}.base.css\"].include? file\n css = File.read(File.join(@base_theme_directory, file))\n\n if \"{#{@prefix}.autocomplete.css\".include? file\n # Removing autocomplete image to add it later by script\n if css[112..135] == \".ui-autocomplete-loading\"\n css[220, 0] = \"*/\"\n css[112, 0] = \"/*\"\n end\n end\n\n open File.join(stylesheets, '_' + file.gsub(/\\.css$/, '.scss').gsub(/^#{@prefix}\\./, '')), 'w' do |f|\n if file == @theme_filename\n f.print(self.class.theme_css2sass(@base_theme))\n else\n f.print(self.class.css2sass(css))\n end\n f.close\n end\n end\n end",
"def namespace_by_filename\n rename_body\n indent_sass\n namespace_sass\n\n # remove the @char style css directives (can't be indented)\n move_css_directives\n puts sass\n end",
"def reload\n Dir.glob('**/*').each { |file| reload_file(file) }\n end",
"def syntax\n :scss\n end",
"def configure_compass(config)\r\n ::Compass.add_configuration(config, 'Jekyll::Compass')\r\n\r\n ::Compass.configuration.on_stylesheet_saved(\r\n &method(:on_stylesheet_saved)\r\n )\r\n ::Compass.configuration.on_sprite_saved(\r\n &method(:on_sprite_saved)\r\n )\r\n ::Compass.configuration.on_sprite_removed(\r\n &method(:on_sprite_removed)\r\n )\r\n nil\r\n end",
"def syntax(path)\n path.to_s.include?('.sass') ? :sass : :scss\n end",
"def compile_for_project(contents, options = {})\n Compass.add_project_configuration\n options[:syntax] ||= :scss\n Sass::Engine.new(contents, Compass.configuration.to_sass_engine_options.merge(options)).render\n end",
"def sass_code\n @sass_code ||= File.read(sass_file)\n end",
"def sass_options\n ctx = @context\n\n preexisting_load_paths = begin\n ::Sass.load_paths\n rescue\n []\n end\n\n more_opts = {\n load_paths: preexisting_load_paths + ctx.app.config[:sass_assets_paths],\n filename: eval_file,\n line: line,\n syntax: syntax,\n custom: {}.merge!(options[:custom] || {}).merge!(\n middleman_context: ctx.app,\n current_resource: ctx.current_resource\n )\n }\n\n if ctx.app.config[:sass_source_maps] || (ctx.app.config[:sass_source_maps].nil? && ctx.app.development?)\n more_opts[:source_map_file] = '.'\n more_opts[:source_map_embed] = true\n more_opts[:source_map_contents] = true\n end\n\n if ctx.is_a?(::Middleman::TemplateContext) && file\n more_opts[:css_filename] = file.sub(/\\.s[ac]ss$/, '')\n end\n\n {}.merge!(options).merge!(more_opts)\n end",
"def pages_scss\n Dir[src_path.join('pages', '**', '*.scss').to_s]\n end",
"def stylesheets\n sort(css.clone.concat(sass_without_partials), config['order_css'] || [])\n end",
"def render_sass type\n template = File.open(@filename).read\n begin\n css = Sass::Engine.new(template, syntax: type).render\n rescue Exception => ex\n error \"In #{@filename}\\n #{ex}\"\n end\n @filename.gsub!(/(sass|scss)$/, 'css')\n File.open(@filename, \"w\") {|out| out.puts css }\n end",
"def copy_stylesheets\n FileUtils.mkdir_p \"app/assets/stylesheets/base\"\n\n #Copy variable file\n copy_file \"../../vendor/assets/stylesheets/fenrir/base/_default_config.scss\", \"app/assets/stylesheets/base/config.scss\"\n end",
"def sg_usemin_css(path, options={})\n usemin = SlimGruntHelpers::Models::UseminCss.new\n options = { alt: nil, absolute: false }.merge!(options)\n\n alt = ''\n alt = \"(#{ options[:alt] })\" unless options[:alt].nil?\n\n text = \"\\n<!-- build:css#{ alt } #{ path } -->\\n\"\n yield(usemin)\n usemin.each(options) do |link|\n text << \"#{ link }\\n\"\n end\n text << \"<!-- endbuild -->\\n\"\n end",
"def sass_file?\n Jekyll::Document::SASS_FILE_EXTS.include?(ext)\n end",
"def compile(css, include_paths, settings)\n\tcss\nend",
"def run(options = {})\n paths.each do |path|\n Dir.chdir(path) do\n Dir[\"**/*.less\"].each do |less_sheet|\n directory = File.dirname(less_sheet)\n target_filename = File.basename(less_sheet, File.extname(less_sheet)) + \".css\"\n destination = \"#{directory}/#{target_filename}\"\n \n if !File.exists?(destination) || File.stat(less_sheet).mtime > File.stat(destination).mtime\n engine = File.open(less_sheet) {|f| Less::Engine.new(f) }\n css = engine.to_css\n css.delete(\"\\n\") if options[:compress]\n \n FileUtils.mkdir_p(directory)\n File.open(destination, \"w\") {|file|\n file.write HEADER % [path + \"/\" + less_sheet] if Rails.env == \"development\"\n file.write css\n }\n end\n end\n end # chdir\n end # each\n end",
"def run(options = {})\n paths.map {|path| Dir[\"#{path}/*.less\"]}.flatten.each {|less_source|\n destination_filename = \"#{File.basename(less_source, File.extname(less_source))}.css\"\n destination = \"#{STYLESHEETS_PATH}/#{destination_filename}\"\n \n if !File.exists?(destination) || File.stat(less_source).mtime > File.stat(destination).mtime\n engine = Less::Engine.new(File.read(less_source))\n css = Less.version > \"1.0\" ? engine.to_css : engine.to_css(:desc)\n css.delete!(\"\\n\") if options[:compress]\n \n File.open(destination, \"w\") {|file|\n file.write HEADER % [destination_filename] if Rails.env == \"development\"\n file.write css\n }\n end\n }\n end",
"def get_default_global_watcher\n super\n end",
"def get_default_global_watcher\n super\n end",
"def watch_src\n Dispatch::Queue.concurrent.async do\n raise \"$project_src_dir undefined.\" if ! $project_src_dirs\n\n dirs = $project_src_dirs.map { |dir| dir.stringByExpandingTildeInPath }\n options = FSEvent::CLI.parse(dirs.dup << '--file-events')\n format = options[:format]\n\n notifier = FSEvent::Notifier.new\n options[:urls].each do |url|\n puts \"watching #{url.path} with options #{options}\"\n notifier.watch(url.path, *options[:create_flags], options) do |event_list|\n event_list.events.each do |event|\n puts \"reload #{event.path}\"\n self.load_src File.basename(event.path.to_s)\n\n if block_given?\n puts \"yield to block\"\n yield\n end\n end\n end\n end\n notifier.run\n end\n end",
"def css_includes *ss\n\t\t\tss.each { |s|\n\t\t\t\tlink :rel => 'stylesheet', :media => 'all', :href => s\n\t\t\t}\n\t\tend",
"def default_sass_options\n\t\t\t\t# Just use sassc defaults.\n\t\t\t\tSprockets::Sassc.options.dup\n\t\t\tend",
"def include_stylesheets\n Pathname.new(StylesheetDir).find do |path|\n next unless path.file?\n if @one_file\n @outfile.puts \" <style>\"\n @outfile.puts path.read\n @outfile.puts \" </style>\"\n else\n @outfile.puts \"<link href=\\\"lib/stylesheets/#{path.basename}\\\" media=\\\"screen\\\" rel=\\\"stylesheet\\\" type=\\\"text/css\\\" />\"\n end\n end\n end",
"def compress_min_css\n File.open(base_css_file, 'w') do |file|\n file.write(\n SassC::Engine.new(\n File.read(base_scss_file), style: :compressed\n ).render\n )\n end\n FileUtils.remove_file(base_scss_file, true)\n end",
"def watch(file)\n return true if watching?(file) # if already watching\n if stat = safe_stat(file)\n @files[file] = stat\n end\n end",
"def process_flat_ui_stylesheet_assets!\n log_status 'Processing stylesheets...'\n files = read_files('less', flat_ui_less_files)\n\n log_status ' Converting LESS files to Scss:'\n files.each do |name, file|\n log_processing name\n\n # apply common conversions\n # icon-font bombs on this so skip it\n file = convert_less(file) unless name =~ /flat-ui|glyphicons/\n file = replace_file_imports(file)\n file = cleanup_whitespace(file)\n case name\n when 'flat-ui.less'\n lines = file.split \"\\n\"\n lines.reject! {|line|\n #kill the fonts lines, those are up to the user\n #kill variables since those need to be manually imported before bootstrap\n line =~ /fonts|url|variables/\n }\n\n # Add a comment for the icon font\n icon_font_import = lines.index {|line| line =~ /glyphicons/}\n lines.insert(icon_font_import, '// Flat-UI-Icons')\n lines.delete_at(icon_font_import+2)\n\n file = lines.join \"\\n\"\n when 'mixins.less'\n NESTED_MIXINS.each do |selector, prefix|\n file = flatten_mixins(file, selector, prefix)\n end\n file = varargify_mixin_definitions(file, *VARARG_MIXINS)\n file = deinterpolate_vararg_mixins(file)\n %w(responsive-(in)?visibility input-size text-emphasis-variant bg-variant).each do |mixin|\n file = parameterize_mixin_parent_selector file, mixin\n end\n file = replace_ms_filters(file)\n if pro?\n file = replace_all file, /(?<=[.-])\\$state/, '#{$state}'\n else\n # calc-color mixin only exists in Flat-UI free\n file = replace_all file, /-(\\$.+-color)/, '-#{\\1}'\n file = replace_all file, /#\\{\\$\\$\\{(.+)\\}\\}/, 'interpolate_variable($\\1)'\n end\n file = replace_rules(file, ' .list-group-item-') { |rule| extract_nested_rule rule, 'a&' }\n file = replace_all file, /,\\s*\\.open \\.dropdown-toggle& \\{(.*?)\\}/m,\n \" {\\\\1}\\n .open & { &.dropdown-toggle {\\\\1} }\"\n file = replace_all file, '$ratio, $ratio-y', '$scale-args'\n file = convert_grid_mixins file\n when 'variables.less'\n file = insert_default_vars(file)\n if ::Sass::VERSION >= '3.3.0'\n file = unindent <<-SCSS + file, 14\n // a flag to toggle asset pipeline / compass integration\n $flat-ui-sass-asset-helper: function-exists(flat-ui-font-path) !default;\n\n SCSS\n else\n file = unindent <<-SCSS + file, 14\n // a flag to toggle asset pipeline / compass integration\n // defaults to true if flat-ui-font-path function is present (no function => twbs-font-path('') parsed as string == right side)\n $flat-ui-sass-asset-helper: (flat-ui-font-path(\"\") != unquote('flat-ui-font-path(\"\")')) !default;\n\n SCSS\n end\n file = fix_variable_declaration_order file\n file = replace_all file, /(\\$icon-font-path:\\s+).*(!default)/, '\\1\"'+@output_dir+'/\" \\2'\n when 'modules/buttons.less'\n file = extract_nested_rule file, '.btn-xs&'\n file = extract_nested_rule file, '.btn-hg&'\n when 'modules/forms.less'\n # Fix mixin regex not supporting non-variable arguments\n file.gsub! /@include input-size\\((?:\\$.+)\\);/ do |match|\n match.gsub /; /, ', '\n end\n file = apply_mixin_parent_selector(file, '\\.input-(?:sm|lg|hg)')\n when 'modules/input-groups.less'\n file = replace_rules(file, '.input-group-rounded') do |rule|\n extract_and_combine_nested_rules rule\n end\n when 'modules/glyphicons.less'\n file = replace_vars(file)\n file = replace_escaping(file)\n file = replace_all file, /\\#\\{(url\\(.*?\\))}/, '\\1'\n file = replace_rules(file, '@font-face') { |rule|\n rule = replace_all rule, /(\\$icon-font(?:-\\w+)+)/, '#{\\1}'\n replace_asset_url rule, :font\n }\n when 'modules/login.less'\n file = fix_flat_ui_image_assets file\n when 'modules/navbar.less'\n # Fix mixin regex not supporting non-variable arguments\n file.gsub! /@include input-size\\((?:\\$.+)\\);/ do |match|\n match.gsub /; /, ', '\n end\n file = apply_mixin_parent_selector(file, '\\.navbar-input')\n when 'modules/palette.less'\n file.gsub! /@include calc-color\\((.+)\\);/ do |match|\n match.gsub /#\\{([\\w\\-]+)\\}/, '\"\\1\"'\n end\n when 'modules/select.less'\n # Fix the include that the converter makes an extend\n file = replace_all file, /@extend \\.caret/, '@include caret'\n when 'modules/spinner.less'\n # Fix mixin regex not supporting non-variable arguments\n file.gsub! /@include spinner-variant\\((?:\\$?.+)\\);/ do |match|\n match.gsub /; /, ', '\n end\n when 'modules/switch.less'\n file = fix_flat_ui_image_assets file\n when 'modules/tile.less'\n file = fix_flat_ui_image_assets file\n when 'modules/todo.less'\n file = fix_flat_ui_image_assets file\n when 'modules/thumbnails.less'\n file = extract_nested_rule file, 'a&'\n when 'modules/type.less'\n # Since .bg-primary has a color associated with it we need to divide it into\n # two selectors\n file = replace_rules(file, '.bg-primary') do |rule|\n parts = rule.split \"\\n\"\n selector = parts.index {|line| line =~ /\\.bg-primary/}\n mixin = parts.index {|line| line =~ /@include/}\n parts.insert(mixin, \"}\\n#{parts[selector]}\")\n rule = parts.join \"\\n\"\n end\n file = apply_mixin_parent_selector(file, '\\.(text|bg)-(success|primary|info|warning|danger)')\n when 'modules/video.less'\n file = replace_rules(file, /\\s*\\.vjs(?:-(?:control|time))?(?!-\\w+)/) do |rule|\n selector = get_selector(rule).scan(/\\.vjs(?:-(?:control|time))?(?!-\\w+)/).first\n convert_arbitrary_less_ampersand(rule, selector)\n end\n file = fix_flat_ui_image_assets file\n end\n\n name = name.sub(/\\.less$/, '.scss')\n base = File.basename(name)\n name.gsub!(base, \"_#{base}\") unless base == 'flat-ui.scss'\n path = File.join(@dest_path[:scss], name)\n save_file(path, file)\n log_processed File.basename(path)\n end\n\n manifest = File.join(@dest_path[:scss], '..', \"#{@output_dir}.scss\")\n save_file(manifest, \"@import \\\"#{@output_dir}/flat-ui\\\";\")\n end",
"def sass_cache_bust(file_name)\n require 'digest/md5'\n file_contents = Dir.glob(\"_sass/*\").map{|f| File.read(f) }.join\n file_name + '?' + Digest::MD5.hexdigest(file_contents)\n\n end",
"def watch_sketch\n ensure_exists(filename)\n spin_up('watch.rb', filename, argc)\n end",
"def watch_sketch\n ensure_exists(filename)\n spin_up('watch.rb', filename, argc)\n end",
"def update\n css = _combine\n\n begin\n # SCSS code executing needs to know what the current instance of Chance is,\n # so that lookups for slices, etc. work.\n Chance._current_instance = self\n\n # Step 1: parse CSS\n parser = Chance::Parser.new(css, @options)\n parser.parse\n\n # Step 2: get parsed slices, slice images as needed, generate CSS for the slices,\n # and add the CSS it generates to parsed output CSS.\n \n # note that it is saved to @slices so that the slices may be found by the SCSS\n # extensions that help find offset, etc.\n @slices = parser.slices\n slice_images\n \n imager = Chance::DataURLImager.new(parser.slices, self) # for now, only DataURLs\n \n css = parser.css + \"\\n\" + imager.css\n\n # Step 3: Create output\n engine = Sass::Engine.new(css, Compass.sass_engine_options.merge({ :syntax => :scss })) \n css = engine.render\n ensure\n Chance._current_instance = nil\n end\n\n @css = css\n end",
"def styles(options = {})\n imported = if options[:import]\n [*options[:import]].map { |name| File.read(\"#{self.options.views}/#{name}.sass\") }.join(\"\\n\")\n end\n\n rendered_styles = fancyviews.included_styles.map do |name, sass| \n # would be nice if construction took an :offest to go along with the :filename\n eng = Sass::Engine.new((imported || '') + \"\\n\" + sass,\n :attribute_syntax => :normal,\n :load_paths => [self.options.views])\n \"\\n/* -- #{name} -- */\\n\" + eng.render\n end.join\n\n style_tag(rendered_styles, options[:media])\n end",
"def assets\n unless IO.read(\"app/assets/stylesheets/application.css\").include?(\"Required by SULChrome\")\n insert_into_file \"app/assets/stylesheets/application.css\", :after => \"/*\" do\n %q{\n * Required by SULChrome:\n *= require sul_chrome/sul_chrome_base\n *}\n end\n end\n unless IO.read(\"app/assets/javascripts/application.js\").include?(\"Required by SULChrome\")\n insert_into_file \"app/assets/javascripts/application.js\", :before => \"//= require_tree .\" do\n%q{// Required by SULChrome:\n//= require sul_chrome/sul_chrome_base\n}\n end\n end\n end",
"def add_css(files)\n return add_data(files, :stylesheets, '.css')\n end"
] | [
"0.64912426",
"0.6056147",
"0.60549134",
"0.5970292",
"0.5957853",
"0.5919863",
"0.5919863",
"0.5875404",
"0.58700407",
"0.58250546",
"0.5756323",
"0.57425994",
"0.57360333",
"0.5714035",
"0.56939477",
"0.5683122",
"0.56240606",
"0.56196827",
"0.55729693",
"0.5562775",
"0.5538467",
"0.5538348",
"0.5526117",
"0.55118746",
"0.54778904",
"0.54673946",
"0.5457397",
"0.5452242",
"0.54443496",
"0.541411",
"0.541411",
"0.5413339",
"0.5390567",
"0.5370316",
"0.53540176",
"0.5330155",
"0.53111726",
"0.5292557",
"0.5292529",
"0.528467",
"0.5277531",
"0.52474415",
"0.524727",
"0.5242533",
"0.52191126",
"0.5216984",
"0.5213657",
"0.5189847",
"0.51876324",
"0.516701",
"0.5124943",
"0.5124943",
"0.51194876",
"0.51169556",
"0.5113171",
"0.51103854",
"0.5102902",
"0.50922894",
"0.5066036",
"0.5049874",
"0.5039876",
"0.5038665",
"0.50368655",
"0.50316596",
"0.5029301",
"0.50101477",
"0.5008243",
"0.49927884",
"0.49715638",
"0.49547848",
"0.49391592",
"0.49184582",
"0.49145856",
"0.4912474",
"0.49110287",
"0.49109864",
"0.49025494",
"0.48965916",
"0.4892083",
"0.48795974",
"0.48723468",
"0.48620743",
"0.4854109",
"0.4837123",
"0.48367742",
"0.48310176",
"0.48310176",
"0.483095",
"0.48292345",
"0.48272738",
"0.48265085",
"0.48246455",
"0.48210582",
"0.48204502",
"0.4811799",
"0.48068514",
"0.48068514",
"0.48067304",
"0.48057267",
"0.48024058",
"0.47992572"
] | 0.0 | -1 |
== gmt_time_from_svn_time == convert svn format times like this: "20080702 10:40:26 0400 (Wed, 02 Jul 2008)" to a GMT format like this: "Wed, 02 Jul 2008 14:40:26 GMT" | def gmt_time_from_svn_time(svn_time)
iso8601_time = "#{svn_time[/(.*) -/, 1].gsub(/ /, 'T')}"
Time.xmlschema(iso8601_time).gmtime.strftime("%a, %d %b %Y %H:%M:%S GMT")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def svn_date(a_time)\n a_time.strftime(\"%Y-%m-%d\")\nend",
"def inspect\n if @_st_is_gmt\n strftime(\"%a %b %d %H:%M:%S UTC %Y\")\n else\n strftime(\"%a %b %d %H:%M:%S %z %Y\")\n end\n end",
"def google_to_time(dt)\n d = elems[0].content.split('.')\n t = elems[2].content.split(':')\n Time.new('20' + d[2], d[1], d[0], t[0], t[1])\n end",
"def convert_ntp_line(line)\n line_array = line.split(' ')\n days = line_array[0]\n secs = line_array[1]\n human_timestamp = ntp_epoch_start.add_days(days).add_secs(secs)\n format(human_timestamp, line_array, 2)\nend",
"def to_modified_date_time(dt, wt)\n DateTime.new(dt.year, dt.month, dt.day, wt.hh, wt.mm, 0)\n end",
"def rfc2822\n strftime('%a, %d %b %Y %T ') << (utc? ? '-0000' : strftime('%z'))\n end",
"def dostime2unixtime dostime\n sec = (dostime << 1) & 0x3e\n min = (dostime & 0x000007e0 ) >> 5\n hour = (dostime & 0x0000f800) >> 11\n day = (dostime & 0x001f0000) >> 16\n mon = (((dostime & 0x01e00000) >> 21))\n year = ((dostime & 0xfe000000) >> 25) + 1980\n return Time.gm(year, mon, day, hour, min, sec)\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 time_to_google(time)\n s = time.strftime(\"%Y-%m-%dT%H:%M:%S.000%z\")\n s[0..25] + ':' + s[26..27]\n end",
"def rfc2822(time)\n time.strftime('%a, %d %b %Y %T GMT')\n end",
"def gmtdate\n Time.now.gmtime.strftime('%a, %d %b %Y %H:%M:%S GMT')\n end",
"def google_datetime(time)\n time.to_datetime.rfc3339\n end",
"def local_to_gm(time)\n TimeZone.new(session[:time_zone]).local_to_utc(time)\n end",
"def get_yyyymmdd_hhnnss(s)\n return s.gsub('T', ' ').gsub('Z', '')\n end",
"def gmtime() end",
"def ship_timestamp\n Time.new.strftime('%Y-%m-%dT%H:%M:%S%z').tap{|str| str[-2,0] = ':' }\n end",
"def to_time\n if latest?\n Time.new(10_000, 1, 1)\n elsif timestamp?\n if development?\n self =~ /\\w+_(\\d\\d\\d\\d)_(\\d\\d)_(\\d\\d)_(\\d\\d)_(\\d\\d)$/\n Time.new(Regexp.last_match[1], Regexp.last_match[2], Regexp.last_match[3], Regexp.last_match[4], Regexp.last_match[5])\n else\n self =~ /Rel(\\d\\d\\d\\d)(\\d\\d)(\\d\\d)/\n Time.new(Regexp.last_match[1], Regexp.last_match[2], Regexp.last_match[3])\n end\n else\n fail \"Version tag #{self} cannot be converted to a time!\"\n end\n end",
"def httpdate\n getutc.strftime('%a, %d %b %Y %T GMT')\n end",
"def formattimeanddate(unformattedtime)\n unformattedtime.strftime('%I:%M:%S %p - %d %m %Y')\n end",
"def format_proper_date(key, value)\n return unless key == 'layer_modified_dt'\n\n metadata[key] = Time.parse(value).utc.iso8601\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 ts_to_time_str(ts)\n return '' if ts == nil\n gm_to_local(ts).strftime('%I:%M:%S%p').downcase\n end",
"def format_time(time)\n time = Time.at(time / 1e6, time % 1e6)\n return time.strftime(\"%FT%TZ\")\n end",
"def datetime_to_iso8601_date(gm_time = nil)\n gm_time ||= Time.now.gmtime\n\n gm_time.strftime('%Y-%m-%dT%H:%M:%SZ')\n end",
"def at_gmt(sec, usec, want_gmt) # GEMSTONE\n if sec._isInteger \n usec = usec ? usec.to_i : 0\n elsif usec\n sec = Maglev::Type.coerce_to(sec, Integer, :to_i)\n usec = usec.to_i \n else\n sec = Maglev::Type.coerce_to(sec, Float, :to_f)\n usec = ((sec % 1) * 1_000_000).to_i\n sec = sec.to_i\n end\n\n usec = usec + (sec * 1000000)\n\n @_st_microseconds = usec\n\n if want_gmt\n force_gmtime\n else\n force_localtime\n end\n end",
"def ts_to_str(ts)\n return '' if ts == nil\n gm_to_local(ts).strftime('%a %b %d, %Y') + ' at ' +\n gm_to_local(ts).strftime('%I:%M%p').downcase + ' ' + (session[:time_zone_abbr] || '')\n end",
"def pretty_mtime\n from_index[:modified].sub(/(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})/,'\\1-\\2-\\3 \\4:\\5:\\6')\n end",
"def http_date\n tp = Time.now.gmtime.to_s.split\n \"#{tp[0]}, #{tp[2]} #{tp[1]} #{tp[5]} #{tp[3]} GMT\"\n end",
"def common_timestring\n \"%I:%M%p %Z %a %d %B %Y\"\n end",
"def formattime2(unformattedtime)\n unformattedtime.strftime('%H:%M:%S')\n end",
"def to_s\n \"(GMT#{formatted_offset}) #{name}\"\n end",
"def date\n tt = Time.gm(*filename_base.scan(/\\d+/))\n\n def tt.to_s\n to_formatted_s(:short_date_with_year) + \" \" + to_formatted_s(:short_time)\n end\n\n tt\n\tend",
"def git_date2txt( datestring)\n # Date: Mon Aug 2 14:39:56 2021 +0100\n # assume we dont care about seconds, tz or year most of time.\n wd,month,day,time,year = datestring.split\n return sprintf \"%02d-%3s %s\", day, month, time[0,5]\nend",
"def to_local(date)\n date.to_time.getgm\n end",
"def sbv_time(t)\r\n i = t.to_i\r\n \"%d:%02d:%02d.%03d\" % [i/3600, i/60%60, i%60, (t*1000).to_i%1000]\r\nend",
"def parse_modified_since(since)\n if since.is_a? ::Fixnum\n if ::Time.at(since).year < 2050\n # Got passed in as seconds.\n since = since * 1000\n end\n elsif since.is_a? ::String\n since = utc_parse(since)\n elsif since.is_a? ::Time\n since = since.to_i * 1000\n end\n return since\n end",
"def get_datetime_string(t)\n return t.strftime('%b %d, %Y %I:%M %p')\n end",
"def timestamp2date(t)\n Time.at(t.to_i).utc\nend",
"def convertStringToTime(s)\r\n\t$logger.debug { \"convertStringToTime: converting '\" + s + \"'...\" }\r\n\tt = Chronic.parse(s)\r\n\t$logger.debug { \" ... to \" + t.to_s }\r\n\treturn t\r\nend",
"def format_timestamp(timestamp)\n Time.parse(timestamp).strftime(\"%T (%z)\")\n end",
"def rfc_date(datetime)\n datetime.strftime(\"%Y-%m-%dT%H:%M:%SZ\") # 2003-12-13T18:30:02Z\n end",
"def convert_time(stime)\n begin\n if stime\n stime =~ /^(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})/;\n return Time.gm($1,$2,$3,$4,$5,$6)\n else\n return Time.now\n end\n rescue\n return Time.now\n end\nend",
"def typecast_time(datetime) #:nodoc:\n datetime.sub!(%r|^(\\w{2})/(\\w{3})/(\\w{4})|, '\\2 \\1 \\3')\n datetime.sub!(':', ' ')\n Time.parse(datetime)\n end",
"def time_modified(t=nil)\n if t.nil?\n t = DateTime.now.new_offset(0)\n elsif t.is_a? String\n t = DateTime.parse(t).new_offset(0)\n elsif t.is_a? Time\n t = t.utc\n elsif t.is_a? Date\n t = t.to_datetime.new_offset(0)\n elsif t.is_a? DateTime\n t = t.new_offset(0)\n end\n RDF::Literal.new(t, :datatype => RDF::XSD.dateTime)\n end",
"def system_modified_dtsi\n Time.parse get('system_modified_dtsi')\n end",
"def to_JSTime(os_time)\r\n js_time = os_time.to_s\r\n # Replace the '-' with '/'\r\n js_time = js_time.gsub('-','/')\r\n # Replace month abbreviations with numbers\r\n js_time = js_time.gsub('Jan','01')\r\n js_time = js_time.gsub('Feb','02')\r\n js_time = js_time.gsub('Mar','03')\r\n js_time = js_time.gsub('Apr','04')\r\n js_time = js_time.gsub('May','05')\r\n js_time = js_time.gsub('Jun','06')\r\n js_time = js_time.gsub('Jul','07')\r\n js_time = js_time.gsub('Aug','08')\r\n js_time = js_time.gsub('Sep','09')\r\n js_time = js_time.gsub('Oct','10')\r\n js_time = js_time.gsub('Nov','11')\r\n js_time = js_time.gsub('Dec','12')\r\n \r\n return js_time\r\n\r\n end",
"def to_JSTime(os_time)\r\n js_time = os_time.to_s\r\n # Replace the '-' with '/'\r\n js_time = js_time.gsub('-','/')\r\n # Replace month abbreviations with numbers\r\n js_time = js_time.gsub('Jan','01')\r\n js_time = js_time.gsub('Feb','02')\r\n js_time = js_time.gsub('Mar','03')\r\n js_time = js_time.gsub('Apr','04')\r\n js_time = js_time.gsub('May','05')\r\n js_time = js_time.gsub('Jun','06')\r\n js_time = js_time.gsub('Jul','07')\r\n js_time = js_time.gsub('Aug','08')\r\n js_time = js_time.gsub('Sep','09')\r\n js_time = js_time.gsub('Oct','10')\r\n js_time = js_time.gsub('Nov','11')\r\n js_time = js_time.gsub('Dec','12')\r\n \r\n return js_time\r\n\r\n end",
"def convert_time(stime)\n begin\n if stime\n stime =~ /^(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})/;\n return Time.gm($1,$2,$3,$4,$5,$6)\n else\n return 0\n end\n rescue\n return 0\n end\nend",
"def nyc_time(time)\n TZInfo::Timezone.get('America/New_York').local_to_utc(Time.parse(time))\nend",
"def extract_ts(chunks)\n ts = chunks[fmt.index('t')]\n return parse_time(ts) if valid_timestamp?(ts)\n rescue TypeError\n Time.now.utc.to_i\n end",
"def gmt_offset() end",
"def convert_time(string)\n time = Time.parse(string).send(@operation, @time)\n time.strftime('%T,%L') # Formating on 'hh:mm:ss,mls'\n end",
"def last_modified\n last_mod = headers[Merb::Const::LAST_MODIFIED]\n Time.rfc2822(last_mod) if last_mod\n end",
"def process_stamp(stamp_string)\n # Server gives us miliseconds, which we drop before converting.\n stamp_val = stamp_string.to_i() / 1000\n utc_time = Time.at(stamp_val).utc().to_datetime()\n return utc_time\n end",
"def iso_format_time(time)\n return time unless time.is_a? Time or time.is_a? Date\n time = time.getutc if time.is_a? Time\n time = time.new_offset(0) if time.is_a? DateTime\n time.strftime('%Y-%m-%dT%H:%M:%SZ')\n end",
"def get_local_time(tm)\n tm.strftime('%m/%d/%Y %I:%M%p')\n end",
"def p4_server_to_local_time(str_p4_server_time)\n\t# Expect the P4 server output time is 2015/08/05 13:15:25\n\tregexp_p4_server_time = /\\d+\\/\\d+\\/\\d+\\s\\d+\\:\\d+\\:\\d+$/\n\tif (regexp_p4_server_time =~ str_p4_server_time) then\n\t\tservertime = DateTime.strptime(\"#{str_p4_server_time} #{@p4_server_timezone}\", \"%Y/%m/%d %H:%M:%S %z\")\n\t\tlocaltime = servertime.new_offset(@local_zone)\n\t\treturn localtime.strftime(\"%Y/%m/%d %H:%M:%S\")\n\tend\n\tputs \"Invalid P4 Server Date/Time String: #{str_p4_server_time}\"\n\treturn str_p4_server_time \nend",
"def localtime_str\n return \"#{\"%04d\" % @t_year}-#{\"%02d\" % @t_month}-#{\"%02d\" % @t_day} #{\"%02d\" % @t_hour}:#{\"%02d\" % @t_min}:#{\"%02d\" % @t_sec} #{self.offset_str}\"\n end",
"def httpdate\n return \"#{self.day_name[0, 3]}, #{@t_day} #{self.month_name[0, 3]} #{@t_year} #{\"%02d\" % @t_hour}:#{\"%02d\" % @t_min}:#{\"%02d\" % @t_sec} GMT\"\n end",
"def local_to_p4_server_time(str_local_time)\n\tif (@regexp_date =~ str_local_time) then\n\t\tlocaltime = DateTime.strptime(\"#{str_local_time} #{@local_zone}\", \"@%Y/%m/%d %z\")\n\t\tservertime = localtime.new_offset(@p4_server_timezone)\n\t\treturn servertime.strftime(\"@%Y/%m/%d:%H:%M:%S\")\n\telsif (@regexp_date_time =~ str_local_time) then\n\t\tlocaltime = DateTime.strptime(\"#{str_local_time} #{@local_zone}\", \"@%Y/%m/%d:%H:%M:%S %z\")\n\t\tservertime = localtime.new_offset(@p4_server_timezone)\n\t\treturn servertime.strftime(\"@%Y/%m/%d:%H:%M:%S\")\t\t\t\n\tend\n\tputs \"Invalid P4 Date/Time String: #{str_local_time}\"\n\treturn str_local_time\nend",
"def gnupg_date_format(maybe_datetime)\n datetime = case maybe_datetime\n when DateTime then maybe_datetime\n when Time, Date then maybe_datetime.to_datetime\n else raise ArgumentError,\n \"datetime: has to be a DateTime/Time/Date\"\n end\n\n # datetime.utc.iso8601.gsub(/-|:/, '')[0..-6]\n datetime.utc.iso8601.gsub(/-|:/, \"\")[0..-6]\n end",
"def convert_time(timevalue)\n if (is_numeric?(timevalue))\n Time.at(timevalue.to_i).utc.strftime('%Y-%m-%dT%H:%M:%SZ')\n else\n begin\n Time.parse(timevalue).utc.strftime('%Y-%m-%dT%H:%M:%SZ')\n rescue\n raise \"Invalid time value: '#{timevalue}'. Must be a timestamp (seconds since epoch) or a valid time string (e.g. YYYY-MM-DDTHH:MM:SSZ)\"\n end\n end\n end",
"def relative_date_and_time_format_for(datetime)\n result = ''\n result << datetime.strftime('%m/%e/%Y at %l:%M %p') # 1/16/2012 at 1:35 PM\n result << \" (#{time_ago_in_words(datetime)})\"\n end",
"def timify\n # no client sends 'published' but we'll prepare for it\n if @properties.key?('published')\n utc_time = Time.iso8601(@properties['published'].first)\n else\n utc_time = Time.now.utc\n end\n if @timezone\n # local_time = @timezone.utc_to_local(utc_time)\n utc_total_offset = @timezone.period_for_utc(utc_time).utc_total_offset\n local_time = utc_time.getlocal(utc_total_offset)\n else\n local_time = utc_time\n end\n\n return {local: local_time, utc: utc_time}\n end",
"def time_convertion(time, time_zone)\n time.getutc.getlocal(time_zone)\n end",
"def updated_at\n csv_time = google_key.nil? ? modification_time(uri) : google_modification_time\n (csv_time > yaml_time ? csv_time : yaml_time).to_s\n end",
"def fmt_time(dt) _format_dt dt, H12_M_PM end",
"def to_JSTime(os_time)\n js_time = os_time.to_s\n # Replace the '-' with '/'\n js_time = js_time.gsub('-','/')\n # Replace month abbreviations with numbers\n js_time = js_time.gsub('Jan','01')\n js_time = js_time.gsub('Feb','02')\n js_time = js_time.gsub('Mar','03')\n js_time = js_time.gsub('Apr','04')\n js_time = js_time.gsub('May','05')\n js_time = js_time.gsub('Jun','06')\n js_time = js_time.gsub('Jul','07')\n js_time = js_time.gsub('Aug','08')\n js_time = js_time.gsub('Sep','09')\n js_time = js_time.gsub('Oct','10')\n js_time = js_time.gsub('Nov','11')\n js_time = js_time.gsub('Dec','12')\n \n return js_time\n\n end",
"def modified_date\n Time.parse(self['system_modified_dtsi']).in_time_zone.to_date\n end",
"def pretty_date\n from_index[:modified].sub(/(\\d{4})(\\d{2})(\\d{2})\\d{6}/,'\\1-\\2-\\3')\n end",
"def format_timestamp(raw_timestamp)\n Time.at(raw_timestamp).getutc.strftime(\"%Y%m%d%H%M%S\")\n end",
"def web_time; strftime(WEB_TIME_FORMAT); end",
"def convert_date(date)\r\n if ( date == nil )\r\n return nil\r\n end\r\n string_date = date.to_s\r\n t = string_date.rindex('T')\r\n string_date = string_date.slice(0,t)\r\n string_date \r\nend",
"def ocitimestamp_to_time(ary)\n year, month, day, hour, minute, sec, fsec, tz_hour, tz_min = ary\n\n if year >= 139\n timezone = tz_hour == 0 && tz_min == 0 ? :utc : :local\n begin\n # Ruby 1.9 Time class's resolution is nanosecond.\n # But the last argument type is millisecond.\n # 'fsec' is converted to a Float to pass sub-millisecond part.\n return ::Time.send(timezone, year, month, day, hour, minute, sec, fsec / 1000.0)\n rescue StandardError\n end\n end\n ocitimestamp_to_datetime(ary)\n end",
"def format_datetime datetime, fmt=\"%F %H:%M %Z\"\n return unless datetime.present?\n datetime.strftime fmt if datetime\n end",
"def windows_time_string(time)\n time.utc.iso8601.gsub(/[-|:|T]/, '').gsub(/Z$/, '.0Z') if time\n end",
"def getutc() end",
"def from_mjd_stamp( mjd_stamp )\n mjd, fraction = mjd_stamp.split(\".\")\n d = ::Date.new( *::Date.mjd_to_civil( mjd.to_i ) )\n\n fraction = Float( \"0.#{fraction}\")\n amt = (SECONDS_PER_DAY * fraction).round\n\n ss = amt % 60\n amt = (amt - ss) / 60\n mm = amt % 60\n hh = (amt - mm) / 60\n\n ::Time.gm( d.year, d.month, d.day, hh, mm, ss )\n end",
"def iso_format(time)\n time.getutc.strftime('%Y-%m-%dT%H:%M:%SZ')\n end",
"def to_time\n begin\n Vpim.decode_date_time_list(value).collect do |d|\n # We get [ year, month, day, hour, min, sec, usec, tz ]\n begin\n if(d.pop == \"Z\")\n Time.gm(*d)\n else\n Time.local(*d)\n end\n rescue ArgumentError => e\n raise Vpim::InvalidEncodingError, \"Time.gm(#{d.join(', ')}) failed with #{e.message}\"\n end\n end\n rescue Vpim::InvalidEncodingError\n Vpim.decode_date_list(value).collect do |d|\n # We get [ year, month, day ]\n begin\n Time.gm(*d)\n rescue ArgumentError => e\n raise Vpim::InvalidEncodingError, \"Time.gm(#{d.join(', ')}) failed with #{e.message}\"\n end\n end\n end\n end",
"def fmt_time(t)\n if t.present?\n ApplicationHelper.localtime(t).strftime(ApplicationHelper.gen_time_fmt)\n end\n end",
"def s_time\n to_form_time(start_time.getlocal)\n end",
"def timeConversion(s)\n am_pm = s[(s.length - 2)..(s.length - 1)]\n s.gsub!(am_pm, '')\n hour = s[0..1]\n if hour == '12'\n if am_pm == 'AM'\n s[0..1] = '00'\n end\n elsif am_pm == 'PM'\n new_hour = (hour.to_i + 12).to_s\n s[0..1] = new_hour\n end\n result = s\nend",
"def timeConversion(s)\n meridiem = s.scan(/[A-Z]+/).first\n s.gsub!(/[A-Z]+/, '')\n hour_str = s.scan(/\\d\\d/).first\n return s if hour_str == '12' && meridiem == 'PM'\n hour_int = hour_str.to_i\n new_hour =\n if meridiem == 'PM'\n (hour_int + 12) % 24\n else\n (hour_int - 12) % 12\n end\n s.gsub(/^\\d\\d/, new_hour.to_s.rjust(2, '0'))\nend",
"def parse_time(file_time_struct)\n wtime_to_time(make_uint64(file_time_struct[:dw_low_date_time],\n file_time_struct[:dw_high_date_time]))\n end",
"def updated_at\n @udpated_at ||=\n Utilities.utc_to_localtime(@ldap_entry[:whenchanged].first)\n end",
"def format_date_time( dt )\n dt.strftime( \"%B %e, %Y %I:%M%p\" )\nend",
"def update_time_formats!\n Time::DATE_FORMATS.update(\n :db => '%Y-%m-%d %H:%M:%S',\n :ui => '%d.%m.%Y %H:%M',\n :yaml => '%Y-%m-%d %H:%M:%S %:z', # For DateTimes\n :default => lambda do |time|\n non_zero_time = time.hour != 0 || time.min != 0 || time.sec != 0\n time.strftime(non_zero_time ? '%d.%m.%Y %H:%M' : '%d.%m.%Y')\n end\n )\n end",
"def format_datetime(date_time)\n unless !logged_in? || current_user.timezone.nil?\n date_time = date_time.in_time_zone(current_user.timezone)\n end\n #SEE Ruby-doc for options\n date_time.strftime(\"%h %d, 20%y at %l:%m%p (%Z)\") #Format: 02/28/14 11:00pm (PST)\n end",
"def format_time(time)\n strftime_preset = '%Y-%m-%dT%l:%M:%S%z'\n time.strftime(strftime_preset)\n end",
"def timeConversion(s)\n #\n # Write your code here.\n #\n split = s.split(\":\")\n pm = split[2][-2,2]\n split[2] = split[2][0,2]\n if pm == \"AM\" && split[0] == \"12\"\n split[0] = 00\n end\n if pm == \"PM\"\n split[0] = split[0].to_i + 12\n if split[0] == 24\n split[0] = 12\n end\n end\n\n split[0] = split[0].to_s.rjust(2,\"0\")\n split[1] = split[1].to_s.rjust(2,\"0\")\n split[2] = split[2].to_s.rjust(2,\"0\")\n\n p split.join(\":\")\nend",
"def formatwrittendate(unformattedtime)\n unformattedtime.strftime('%A, %d %B, %Y')\n end",
"def gm_to_local(time)\n TimeZone.new(session[:time_zone]).utc_to_local(time)\n end",
"def proper_time(time)\n\tTime.at(time).gmtime.strftime('%R:%S')\nend",
"def formatConvertor(inputFormat)\n\n inputFormat.sub! 'DD', '%d'\n inputFormat.sub! 'YYYY', '%Y'\n inputFormat.sub! 'YY', '%Y'\n inputFormat.sub! 'MM', '%m'\n inputFormat.sub! 'hh', '%H'\n inputFormat.sub! 'mm', '%M'\n inputFormat.sub! 'ss', '%S'\n inputFormat.sub! 'HH', '%I' # HH - for hour of the clock (12 hour)\n inputFormat.sub! 'A/P', '%p'\n inputFormat.sub! 'MON', '%b' # Jan/Feb etc\n #inputFormat.sub! 'TZ', '%z' # TimeZone\n\n\nend",
"def format_timestamp(datetime)\n datetime.getlocal.to_formatted_s(:long_ordinal)\n end",
"def decimal_to_strf(time_in)\r\n t = Time.now\r\n year = t.year\r\n month = t.month\r\n day = t.day\r\n hours = Integer(time_in)\r\n decimal_minutes = (time_in - hours) * 60.0\r\n minutes = Integer(decimal_minutes)\r\n decimal_seconds = (decimal_minutes - minutes) * 60.0\r\n seconds = Integer(decimal_seconds)\r\n my_time = Time.gm(year, month, day, hours, minutes, seconds) \r\n# my_time.strftime(\"%H:%M:%S\")\r\nend",
"def parse_srt_time(time)\n time =~ /^(\\d+):(\\d+):(\\d+),(\\d{3})$/\n hh, mm, ss, ms = [$1, $2, $3, $4].map(&:to_i)\n hh*3600 + mm*60 + ss + ms/1000.0\n end",
"def date_time_str(time)\n \"#{time.utc.strftime('%Y-%m-%d')}T#{time.utc.strftime('%H:%M:%S.%L')}Z\"\n end"
] | [
"0.61431205",
"0.603435",
"0.5878294",
"0.580913",
"0.5724064",
"0.5708641",
"0.56496286",
"0.5649507",
"0.56436497",
"0.56110203",
"0.559933",
"0.5540888",
"0.5503406",
"0.5480621",
"0.5463068",
"0.54244",
"0.5401585",
"0.53903794",
"0.5376057",
"0.53631073",
"0.5341571",
"0.5327879",
"0.53102255",
"0.5309945",
"0.53031504",
"0.5302012",
"0.5280894",
"0.5258406",
"0.5250746",
"0.5231422",
"0.5230629",
"0.5219418",
"0.5197094",
"0.51951766",
"0.5179346",
"0.5158721",
"0.5157904",
"0.5146227",
"0.51461864",
"0.5145065",
"0.51414174",
"0.5139151",
"0.51275015",
"0.5125798",
"0.51237315",
"0.51179975",
"0.51179975",
"0.5117236",
"0.5111911",
"0.51112366",
"0.51058334",
"0.5097501",
"0.50933564",
"0.5085654",
"0.5056258",
"0.5049008",
"0.5043414",
"0.5031784",
"0.5028541",
"0.50166494",
"0.501266",
"0.50125355",
"0.50046957",
"0.5001404",
"0.49922687",
"0.49909478",
"0.4989735",
"0.4982423",
"0.49818662",
"0.49745944",
"0.4964097",
"0.4963868",
"0.49607044",
"0.49560302",
"0.49462464",
"0.49456498",
"0.4937221",
"0.493108",
"0.49305183",
"0.49274337",
"0.49228552",
"0.49172226",
"0.49008682",
"0.48938835",
"0.48937842",
"0.48933867",
"0.4887809",
"0.48874205",
"0.48819476",
"0.48806015",
"0.48793995",
"0.4874633",
"0.4872766",
"0.48716986",
"0.48707378",
"0.48681405",
"0.48661298",
"0.48597798",
"0.48562333"
] | 0.8890314 | 0 |
GET /transactions or /transactions.json | def index
@transactions = Transaction.all
@owntransactions = Transaction.where(user: current_user).order(date: :desc)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transactionById\n results = HTTParty.get(\"http://192.168.99.101:4050/transactions/\" + (params[:id]).to_s)\n render json: results.parsed_response, status: results.code\n end",
"def fetch_wallets_transactions(filters = {})\n MangoPay.request(:get, url() + \"/transactions\", {}, filters)\n end",
"def index\n user_coin_transactions = get_user_coin_transactions\n if user_coin_transactions\n json_response(user_coin_transactions)\n else \n json_response({:status => false, :message => 'no transaction'})\n end\n end",
"def my_transactions\n @transactions = Transaction.find_all_by_user_id(current_user.id)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions }\n end\n end",
"def transactions\n JSON.parse(response.body).fetch('transactions')\n end",
"def get_transactions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PaymentsTransactionsApi.get_transactions ...\"\n end\n # resource path\n local_var_path = \"/transactions\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_invoice'] = opts[:'filter_invoice'] if !opts[:'filter_invoice'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceTransactionResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PaymentsTransactionsApi#get_transactions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_transactions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransactionsApi.get_transactions ...'\n end\n if @api_client.config.client_side_validation && opts[:'transactions_type'] && !['automated', 'manual'].include?(opts[:'transactions_type'])\n fail ArgumentError, 'invalid value for \"transactions_type\", must be one of automated, manual'\n end\n # resource path\n local_var_path = '/transactions'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per'] = opts[:'per'] if !opts[:'per'].nil?\n query_params[:'external_id'] = opts[:'external_id'] if !opts[:'external_id'].nil?\n query_params[:'sender_id'] = opts[:'sender_id'] if !opts[:'sender_id'].nil?\n query_params[:'transactions_type'] = opts[:'transactions_type'] if !opts[:'transactions_type'].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 = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']\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 => 'TransactionListResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#get_transactions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n if @account\n @transactions = @account.transactions\n else\n @transactions = Transaction.all\n end\n render json: @transactions\n end",
"def get_transactions(service)\n\t\treturn @transport.get_path(\"transactions\",service)\n\tend",
"def index\n @transactions = Transaction.all\n render json: @transactions\n end",
"def index\n @transactions = Transaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions }\n end\n end",
"def index\n @transactions = Transaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions }\n end\n end",
"def index\n @transactions = Transaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions }\n end\n end",
"def index\n @transactions = @account.transactions\n paginate @transactions.count, 20 do |limit, offset|\n render json: @transactions.limit(limit).offset(offset)\n end\n\n # render json: @transactions\n end",
"def index\n account = Account.find(params[:account_id].to_i)\n @transactions = account.transactions\n\n transactions_json = TransactionSerializer.new(@transactions).serialized_json\n render json: transactions_json\n end",
"def transactions_get(opts = {})\n data, _status_code, _headers = transactions_get_with_http_info(opts)\n data\n end",
"def show\n @transactions = Transaction.where(user_id: params[:id])\n render json: @transactions\n end",
"def all_transactions\n json_response(Transaction.all)\n end",
"def transactions\n JSON.parse(call_blockchain_api(\"transactions\"))\n end",
"def index\n\t@transactions = current_user.transactions.all.order(created_at: :desc)\n\trender json: { transactions: @transactions }\nend",
"def index\n\t\ttransaction = Transaction.where(user_id: params[:user_id])\n\n\t\tif transaction\n\t\t\trender json: transaction,status: 200\n\t\telse\n\t\t\trender json: transaction.errors.messages,status: 422\n\t\tend\t\n\tend",
"def get_transaction(account_id, transaction_id)\n query_api_object Transaction, \"/rest/accounts/#{account_id}/transactions/#{transaction_id}\"\n end",
"def transactions_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.transactions_get ...'\n end\n # resource path\n local_var_path = '/api/v1/transactions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'addrs'] = opts[:'addrs'] if !opts[:'addrs'].nil?\n query_params[:'confirmed'] = opts[:'confirmed'] if !opts[:'confirmed'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', ])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Object' \n\n # auth_names\n auth_names = opts[:auth_names] || []\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#transactions_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n if admin_signed_in?\n @transactions = Transaction.all\n else\n @transactions = Transaction.tri(@current_user.id).all\n end\n respond_to do |format|\n format.html\n format.json { render json: @transactions}\n end\n end",
"def user_transactions\n user_deposits = get_user_deposits\n user_withdrawals = get_user_withdrawals\n json_response({:user_transactions => @user_transactions, :user_deposits => user_deposits, :user_withdrawals => user_withdrawals})\n end",
"def gettransaction(txid)\n request :gettransaction, txid\n end",
"def getTransaction( transaction_id)\n params = Hash.new\n params['transaction_id'] = transaction_id\n return doCurl(\"get\",\"/transaction\",params)\n end",
"def index\n @transactions = current_user.wallet.transactions\n\n end",
"def transactionGet(options={})\n assert_valid_keys(options, :transactionId)\n assert_keys_exists(options, :transactionId)\n execute(:transactionGet, options)\n end",
"def transactionGet(options={})\n assert_valid_keys(options, :transactionId)\n assert_keys_exists(options, :transactionId)\n execute(:transactionGet, options)\n end",
"def transactionByUser\n results = HTTParty.get(\"http://192.168.99.101:4050/by_user_id?userid=\" + (@current_user[\"id\"]).to_s)\n render json: results.parsed_response, status: results.code\n end",
"def get_transactions(type = 'all', limit = 10)\n post_data = initial_post_data\n post_data['method'] = 'getTransactions'\n post_data['params'] = [type, limit]\n post_request(post_data)\n end",
"def transactions\n @transactions ||= ArkEcosystem::Client::API::Transactions.new(@client) # rubocop:disable Metrics/LineLength\n end",
"def get(transaction_id:)\n client.get(path: \"#{sub_path}/#{transaction_id}\", api_key: api_key)\n end",
"def index\n @transactions = current_user.transactions\n end",
"def index\n @transactions = Transaction.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transactions }\n end\n end",
"def getTransactions\n\t\t\n\tend",
"def get_transactions(opts = {})\n data, _status_code, _headers = get_transactions_with_http_info(opts)\n data\n end",
"def index\n @journal = Journal.find(params[:journal]) if params[:journal]\n @transactions = Transaction.rev_chrono\n @transactions = @transactions.for_journal(params[:journal]) if params[:journal]\n \n if params[:filter] == 'tagged' && params[:tags]\n @transactions = @transactions.with_tag(params[:tags])\n end\n \n @transactions = @transactions.page params[:page]\n respond_with(@transactions)\n end",
"def get_transaction(tx_id:)\n client.make_request('/get-transaction', 'post', params: {tx_id: tx_id})\n end",
"def transactions_by_ref(merchant_ref)\n client.get \"transactions/#{inst_id}/byRef?merchantRef=#{merchant_ref}\"\n end",
"def index\n @transactions = Transaction.all\n end",
"def index\n @transactions = Transaction.all\n end",
"def index\n @transactions = Transaction.all\n end",
"def index\n @transactions = Transaction.all\n end",
"def index\n @transactions = Transaction.all\n end",
"def index\n @transactions = Transaction.all\n end",
"def index\n @transactions = Transaction.all\n end",
"def index\n @transactions = Transaction.all\n end",
"def index\n @transactions = Transaction.all\n end",
"def index\n @transactions = Transaction.all\n end",
"def index\n @transactions = Transaction.all\n end",
"def index\n @transactions = Transaction.all\n end",
"def index\n @transactions = Transaction.all\n end",
"def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transaction }\n end\n end",
"def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transaction }\n end\n end",
"def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transaction }\n end\n end",
"def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transaction }\n end\n end",
"def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transaction }\n end\n end",
"def get_transactions(*params); raise('Stub or mock required.') end",
"def gettransaction(txid)\n @api.request 'gettransaction', txid\n end",
"def gettransaction(txid)\n @api.request 'gettransaction', txid\n end",
"def transactions(account_id, opts = {})\n query = {}\n query['cursor'] = opts[:cursor] if opts[:cursor]\n query['start'] = opts[:start] if opts[:start]\n query['end'] = opts[:end] if opts[:end]\n query['time_field'] = opts[:time_field] if opts[:time_field]\n\n api_get(path(account_id), query)\n end",
"def transactionGet(options = {})\n assert_valid_keys(options, :accessKey, :testMode, :transactionId)\n assert_keys_exists(options, :transactionId)\n execute(:transactionGet, options)\n end",
"def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @transaction }\n end\n end",
"def transactions(options = {})\n response = JSON.parse(@client.get(\"items/#{send(:id)}/transactions\", options).body)\n transactions = response.key?('transactions') ? response['transactions'] : []\n transactions.map { |attributes| Promisepay::Transaction.new(@client, attributes) }\n end",
"def transactions(options = {})\n response = JSON.parse(@client.get(\"items/#{send(:id)}/transactions\", options).body)\n transactions = response.key?('transactions') ? response['transactions'] : []\n transactions.map { |attributes| Promisepay::Transaction.new(@client, attributes) }\n end",
"def transactions(options = {})\n response = JSON.parse(@client.get(\"items/#{send(:id)}/transactions\", options).body)\n transactions = response.key?('transactions') ? response['transactions'] : []\n transactions.map { |attributes| Promisepay::Transaction.new(@client, attributes) }\n end",
"def index\n @transactions = Transaction.all \n end",
"def get_bank_transactions(options = {})\n request_params = {}\n request_params[:BankTransactionID] = options[:bank_transaction_id] if options[:bank_transaction_id]\n request_params[:ModifiedAfter] = options[:modified_since] if options[:modified_since]\n request_params[:order] = options[:order] if options[:order]\n request_params[:where] = options[:where] if options[:where]\n request_params[:page] = options[:page] if options[:page]\n\n response_xml = http_get(@client, \"#{@xero_url}/BankTransactions\", request_params)\n\n parse_response(response_xml, {:request_params => request_params}, {:request_signature => 'GET/BankTransactions'})\n end",
"def transaction\n add_breadcrumb \"Merchants\", epsadmin_merchants_path\n add_breadcrumb \"#{@transc_merchant.first_name}\", epsadmin_merchant_path(@transc_merchant.merchant_uniq_id)\n @epsadmin_transaction_list = @transc_merchant.transactions.order(\"created_at DESC\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @epsadmin_transaction_list }\n end\n end",
"def index\n limit = params[:limit] || MonzoTransaction.count\n @page = { page: params[:page], per_page: limit.to_i }\n @order = params[:order] || \"created_at\"\n\n @transactions = MonzoTransaction.order(@order).paginate(@page)\n @balance = MonzoTransaction.balance\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions, callback: params[:callback] }\n format.xml { render xml: @transactions }\n format.rss { render 'feed' }\n end\n end",
"def wallet_transactions_listing(wallet_id, type)\n add_timestamp\n add_salt\n headers = { 'content-type' => 'application/json',\n 'signature' => signature('', 'get', \"/v1/user/#{wallet_id}/transactions?type=#{type}\"), 'salt' => salt, 'timestamp' => timestamp, 'access_key' => access_key }\n response, msg = rest_client.getCall(\"/v1/user/#{wallet_id}/transactions?type=#{type}\", headers)\n JSON.parse(response)['data'] if response.present?\n rescue StandardError => e\n Rails.logger.error e\n nil\n end",
"def index\n @transactions = User.find(params[:id])\n end",
"def index\n @transactions = Transaction.all\n render_success_response({\n transaction: array_serializer.new(@transactions, serializer: TransactionSerializer)\n })\n end",
"def transaction(tx_hash)\n call :get, \"/tx/#{tx_hash}\"\n end",
"def get_transactions(opts = {})\n data, _status_code, _headers = get_transactions_with_http_info(opts)\n return data\n end",
"def index\n @admin_transactions = AdminTransaction.page(params[:page]).per(params[:per])\n render json: @admin_transactions\n end",
"def fetch_wallet_transactions(funds_type, currency_iso_code, filters = {})\n MangoPay.request(:get, url() + \"/wallets/#{funds_type}/#{currency_iso_code}/transactions\", {}, filters)\n end",
"def index\n @transactions = @transactions.paginate(:page => params[:page], :per_page => 10)\n end",
"def index\n @transactions = Transaction.all \n end",
"def index\n @transactions = Transaction.filter(params.slice(:contact, :transaction_type)).ordered_created_at\n _, transaction_list = pagy(@transactions)\n json_response({\n data: {\n transactions: transaction_list,\n count: @transactions.count\n }\n })\n end",
"def transactions\n res = filter\n .apply( account.all_transactions.reverse_order(:created_at) )\n\n res\n .paginate(page, per_page)\n end",
"def index\n @help = \"Transaction List\"\n @transactions = @account.transactions.find(:all, :order => \"tran_date desc, created_at desc\")\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transactions }\n end\n end",
"def transactions(options)\n options[:type] ||= :all\n\n unless %i[all all_deal deposit withdrawal].include? options[:type]\n raise ArgumentError, \"invalid transaction type: #{options[:type]}\"\n end\n\n tranaactions_request build_url_parameters(options)\n end",
"def transactions account_id\n data = perform_get(\"#{ACCOUNTS_PATH}/#{account_id}/transactions\")\n data[:accountTransactions] || []\n end",
"def show\n @vendor = Vendor.find(params[:id])\n @transactions = @vendor.transactions\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vendor }\n end\n end",
"def index\n @transaction = find_parent.transactions.includes(:user, :deal)\n respond_with(paginate(@transactions), :include => [:user])\n end",
"def index\n #valid_account_ids = current_user.accounts.map{|a|a.id}\n if params[:account_id]\n @account = current_user.accounts.find(params[:account_id])\n elsif params[:category_id]\n @category = Category.find(params[:category_id])\n else\n @account = current_user.accounts.current_accounts.first\n end\n\n if @account\n @transactions = Transaction.where(:account_id => @account.id).order(\"date desc, created_at desc\").limit(100)\n @transaction = Transaction.new(:date => Date.today, :account_id => @account.id)\n else\n @transactions = Transaction.where(:category_id => @category.id).order(\"date desc, created_at desc\").limit(100)\n end\n\n @current_date = Date.today\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions }\n end\n end",
"def transactions\n case params[:name]\n when 'missing'\n @transactions = @set.missing_transactions\n when 'overlapping'\n @transactions = @set.overlapping_transactions\n else\n @transactions = []\n end\n\n respond_to do |format|\n format.js\n format.html\n end\n end",
"def all\n @page[:per_page] = MonzoTransaction.count\n @transactions = MonzoTransaction.order(@order).paginate(@page)\n\n respond_to do |format|\n format.html { render 'index' }\n format.json { render json: @transactions, callback: params[:callback] }\n format.xml { render xml: @transactions }\n format.rss { render 'feed' }\n end\n end",
"def get_transaction(id)\n submit GetTransaction.new(:transaction_id => id)\n end",
"def get(access_token,\n start_date,\n end_date,\n account_ids: nil,\n count: nil,\n offset: nil,\n options: nil)\n options_payload = {}\n options_payload[:account_ids] = account_ids unless account_ids.nil?\n options_payload[:count] = count unless count.nil?\n options_payload[:offset] = offset unless offset.nil?\n options_payload = options_payload.merge(options) unless options.nil?\n\n payload = { access_token: access_token,\n start_date: Plaid.convert_to_date_string(start_date),\n end_date: Plaid.convert_to_date_string(end_date),\n options: options_payload }\n @client.post_with_auth('transactions/get', payload)\n end",
"def index\n @transactions =\n Transaction.where(user: current_user).or(Transaction.where(transaction_with: current_user))\n end",
"def get_transactions\n @transactions\n end",
"def index\n @transactions = Transaction.find_all_by_user_id(current_user.id)\n if not @transactions\n flash.now[:error] = \"No transactions found for this user!\"\n end\n end",
"def transaction_search(transaction_type, location)\n result = transaction_request(transaction_type, location)\n Responses::Transaction.new(JSON.parse(result.body))\n end",
"def index\n if current_user.admin?\n\t\t\t@transactions = Transaction.all.order(created_at: :desc)\n\t\t\t.paginate(page: params[:page], per_page: 15)\n\t\t elsif current_user\n\t\t\t@transactions = current_user.transactions.all.order(created_at: :desc)\n\t\t\t.paginate(page: params[:page], per_page: 10)\n\t\tend\n end",
"def transactions(options = {})\n @gateway.customer.transactions(id, options)\n end",
"def index\n if params[:status]\n status = params[:status]\n else\n status = 0\n end\n @transactions = current_user.transactions.where(:status => status).paginate(page: params[:page], per_page: 5)\n @transactions_by_date = @transactions.group_by(&:deadline)\n @date = params[:date] ? Date.parse(params[:date]) : Date.today\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions }\n end\n end",
"def index\n @page = params.fetch(:page, 0).to_i # Current page in the table pagination\n\n if(params.has_key?(:account_id))\n # Get transactions for a specific account\n @transactions = get_transactions_from_account\n elsif(params.has_key?(:user_id))\n # Get transactions for all accounts for a specific user\n @transactions = get_transactions_from_user\n else\n # Get all transactions for all users\n @transactions = Transaction.all\n end\n \n # Search and filter through transactions if requested by user\n if(params.has_key?(:search_transaction)) \n @transactions = search()\n end\n\n @transactions = filter(@transactions)\n\n # Route for CSV file\n respond_to do |format|\n format.html\n format.csv { send_data Transaction.export_csv(@transactions) } # Send the data to the Transaction model along with the current_user\n end\n\n paginate # Paginate the page\n @transactions = @transactions[@page * TRANSACTIONS_PER_PAGE, TRANSACTIONS_PER_PAGE] # Set the variable to contain all transactions in the current page\n end"
] | [
"0.7443072",
"0.7412816",
"0.73257065",
"0.7260952",
"0.72357196",
"0.72271377",
"0.7176918",
"0.7161287",
"0.7145566",
"0.7099763",
"0.7083526",
"0.7083526",
"0.7083526",
"0.7077574",
"0.7057022",
"0.7012143",
"0.6979211",
"0.6975017",
"0.69650924",
"0.6944728",
"0.69018155",
"0.68955666",
"0.68728024",
"0.6864015",
"0.6823505",
"0.68173397",
"0.67834187",
"0.67746806",
"0.67685044",
"0.67685044",
"0.675641",
"0.67414314",
"0.67202586",
"0.67122716",
"0.6708025",
"0.66961193",
"0.66898584",
"0.6664775",
"0.6633888",
"0.66163856",
"0.6606477",
"0.65977293",
"0.65977293",
"0.65977293",
"0.65977293",
"0.65977293",
"0.65977293",
"0.65977293",
"0.65977293",
"0.65977293",
"0.65977293",
"0.65977293",
"0.65977293",
"0.65977293",
"0.6591325",
"0.6591325",
"0.6591325",
"0.6591325",
"0.6591325",
"0.6575005",
"0.6568821",
"0.6568821",
"0.6558764",
"0.65491277",
"0.65407425",
"0.6529423",
"0.6529423",
"0.6529423",
"0.6529327",
"0.6528292",
"0.6521596",
"0.65119237",
"0.65109354",
"0.64909244",
"0.64830095",
"0.64771295",
"0.6470749",
"0.6461822",
"0.64516467",
"0.6449221",
"0.6449062",
"0.64452976",
"0.64401895",
"0.64241916",
"0.64103013",
"0.64015955",
"0.6392471",
"0.63643235",
"0.63564247",
"0.63398427",
"0.6338539",
"0.63312614",
"0.6329286",
"0.63246906",
"0.6315907",
"0.6295374",
"0.62946147",
"0.6284496",
"0.6250628",
"0.62414885",
"0.6237878"
] | 0.0 | -1 |
POST /transactions or /transactions.json | def create
@transaction = Transaction.new(transaction_params.merge(user_id: current_user.id))
@transaction.groups << Group.where(id: params[:transaction][:group_ids])
respond_to do |format|
if @transaction.save
format.html { redirect_to transactions_path, notice: 'Transaction was successfully created.' }
format.json { render :show, status: :created, location: @transaction }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @transaction.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_transaction\n params = {\n bank_transaction: {\n bank_account_id: 1,\n date: Time.local(2012, 4, 16),\n amount: 55\n }\n }\n\n post '/api/banks/1/transactions', params\n data = ActiveSupport::JSON.decode last_response.body\n\n assert last_response.successful?\n assert_match('application/json', last_response.content_type)\n assert BankTransaction.find(data['id'])\n end",
"def postTransaction(useridgiving, useridreceiving, amount)\n parameters={useridgiving: useridgiving.to_i, useridreceiving: useridreceiving.to_i, amount: amount.to_f, state: \"initial\"}\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n results = HTTParty.post(\"http://192.168.99.101:4050/transactions\", options) # create initial state\n return results\n end",
"def transactions_post(opts = {})\n data, _status_code, _headers = transactions_post_with_http_info(opts)\n data\n end",
"def createTransaction(toAcc, json)\n\t\turl = \"#{self.urlWithEntity}/#{toAcc}/transactions?key=#{self.apiKey}\"\n\t\turi = URI.parse(url)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\trequest = Net::HTTP::Post.new(uri.request_uri, initheader = {'Content-Type' => 'application/json'})\n\t\trequest.body = json\n\t\tresp = http.request(request)\n\tend",
"def create\n result = CreateTransaction.new(transaction_params, @merchant).call\n\n if result.errors?\n render json: { errors: result.errors }, status: :unprocessable_entity\n else\n render json: result.transaction.to_json, status: :created\n end\n end",
"def create\n @transaction = current_user.transactions.build(transaction_params)\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to transactions_url, notice: 'Transaction was successfully created.' }\n format.json { redirect_to transactions_url, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n account = Account.find(params[:account_id].to_i)\n @transaction = account.transactions.build(transaction_params)\n if @transaction.save\n account.update(balance: account.get_balance)\n transaction_json = TransactionSerializer.new(@transaction).serialized_json\n render json: transaction_json\n else\n render json: {\n errors: @transaction.errors.full_messages\n }\n end\n end",
"def create\n @transaction = Transaction.new(params[:transaction])\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to account_transactions_path(@transaction.account), notice: 'Transaction was successfully created.' }\n format.json { render json: @transaction, status: :created, location: @transaction }\n else\n format.html { redirect_to account_transactions_path(current_user.accounts.expense_accounts.first), alert: 'Transaction could not be added.' }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def transactions_post(method, opts = {})\n data, _status_code, _headers = transactions_post_with_http_info(method, opts)\n data\n end",
"def create\n @transaction = Transaction.new(params[:transaction])\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to home_url, notice: 'Transaction was posted to the journal.' }\n format.json { render json: @transaction, status: :created, location: @transaction }\n else\n format.html { redirect_to session[:return_to], :flash => {errors: 'Error parsing transaction!'} }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @transaction = Transaction.new(params[:transaction])\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render json: @transaction, status: :created, location: @transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def transactions_post_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.transactions_post ...'\n end\n # resource path\n local_var_path = '/api/v1/transactions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'addrs'] = opts[:'addrs'] if !opts[:'addrs'].nil?\n query_params[:'confirmed'] = opts[:'confirmed'] if !opts[:'confirmed'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', ])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Object' \n\n # auth_names\n auth_names = opts[:auth_names] || ['csrfAuth']\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: DefaultApi#transactions_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def transaction_params\n params.require(:transaction).permit(:get, :post)\n end",
"def create\n @transaction = Transaction.new(params[:transaction])\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render json: @transaction, status: :created, location: @transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @transaction = Transaction.new(transaction_params)\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction }\n format.json { render action: 'show', status: :created, location: @transaction }\n else\n format.html { render action: 'new' }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @transaction = Txn.new(transaction_params)\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Txn was successfully created.' }\n format.json { render action: 'show', status: :created, location: @transaction }\n else\n format.html { render action: 'new' }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def putTransaction( entity_id, user_id, basket_total, basket, currency, notes)\n params = Hash.new\n params['entity_id'] = entity_id\n params['user_id'] = user_id\n params['basket_total'] = basket_total\n params['basket'] = basket\n params['currency'] = currency\n params['notes'] = notes\n return doCurl(\"put\",\"/transaction\",params)\n end",
"def create\n @transaction = Transaction.new(transaction_params)\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to transactions_url, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n cb = Coin.retrieve_from_api(transaction_params[\"CB_apikey\"])\n cs = Coin.retrieve_from_api(transaction_params[\"CS_apikey\"])\n\n @transaction = Transaction.new(transaction_params.merge(wallet_id: current_user.wallet.id, CBought_id: cb, CSold_id: cs))\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: \"Transaction was successfully created.\" }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @transaction = Transaction.new(transaction_params)\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to transactions_path,\n notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n @users = User.order(:name)\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @transaction = Transaction.new(transaction_params)\n\n # rollback all db records once one fail\n transaction = @transaction.transaction do\n amount = transaction_params.dig(:amount).to_d\n @transaction.user.apply_withdrawal(amount)\n @transaction.transaction_with.apply_deposite(amount)\n # create a second transaction record for depoiste, this record useful for\n # history\n Transaction.create(\n amount: @transaction.amount, user: @transaction.transaction_with,\n transaction_state: 'deposite', transaction_with: @transaction.user\n )\n @transaction.save\n end\n\n respond_to do |format|\n if transaction\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @transaction = Transaction.new(transaction_params)\n\n # Assigns the correct user_id in case the user puts another user's ID\n\n @transaction.user_id = User.find_by(api_key: params[:api_key]).id\n\n if @transaction.save\n\n @coin = Coin.find(@transaction.coin_id)\n\n # If deposit, increment @coin's value, else decrement \n # Also, send email if value is less than 4\n\n if @transaction.transaction_type == 1\n @coin.update_attributes(value: @coin.value+1)\n if @coin.value < 4\n LowFundsMailer.low_funds(@coin).deliver\n end\n\n else\n\n # If withdraw, must ensure the value is > 0\n\n if (@coin.value > 0)\n @coin.update_attributes(value: @coin.value-1)\n if @coin.value < 4\n LowFundsMailer.low_funds(@coin).deliver\n end\n else\n render json: [\"Sorry! There are no more of those coins.\"], status: 422\n end\n end\n @coin.save\n\n # Return the transaction \n \n render json: @transaction\n else\n render json: @transaction.errors.full_messages, status: 422\n end\n end",
"def create\n @transaction = Transaction.new(transaction_params)\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @transaction = Transaction.new(transaction_params)\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @transaction = Transaction.new(transaction_params)\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @transaction = Transaction.new(transaction_params)\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @transaction = Transaction.new(transaction_params)\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def transactions_post_with_http_info(method, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.transactions_post ...'\n end\n # verify the required parameter 'method' is set\n if @api_client.config.client_side_validation && method.nil?\n fail ArgumentError, \"Missing the required parameter 'method' when calling DefaultApi.transactions_post\"\n end\n # resource path\n local_var_path = '/transactions'\n\n # query parameters\n query_params = {}\n query_params[:'method'] = method\n query_params[:'amount'] = opts[:'amount'] if !opts[:'amount'].nil?\n query_params[:'mobile'] = opts[:'mobile'] if !opts[:'mobile'].nil?\n query_params[:'holdername'] = opts[:'holdername'] if !opts[:'holdername'].nil?\n query_params[:'cardnumber'] = opts[:'cardnumber'] if !opts[:'cardnumber'].nil?\n query_params[:'cvv'] = opts[:'cvv'] if !opts[:'cvv'].nil?\n query_params[:'exp'] = opts[:'exp'] if !opts[:'exp'].nil?\n query_params[:'currency'] = opts[:'currency'] if !opts[:'currency'].nil?\n query_params[:'account'] = opts[:'account'] if !opts[:'account'].nil?\n query_params[:'reference'] = opts[:'reference'] if !opts[:'reference'].nil?\n query_params[:'genericmsg'] = opts[:'genericmsg'] if !opts[:'genericmsg'].nil?\n query_params[:'token'] = opts[:'token'] if !opts[:'token'].nil?\n query_params[:'bouquet'] = opts[:'bouquet'] if !opts[:'bouquet'].nil?\n query_params[:'payoption'] = opts[:'payoption'] if !opts[:'payoption'].nil?\n query_params[:'meternumber'] = opts[:'meternumber'] if !opts[:'meternumber'].nil?\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apipassword', 'apiusername']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse200')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#transactions_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @transaction = Transaction.new(transaction_params.merge(user: current_user))\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render action: 'show', status: :created, location: @transaction }\n else\n format.html { render action: 'new' }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @transaction = Transaction.new(transaction_params)\n\n respond_to do |format|\n if @transaction.save\n # format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n # format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @transaction = current_user.transactions.new(params[:transaction])\n \n respond_to do |format|\n if @transaction.save\n format.html { redirect_to transactions_path, notice: 'Transaction was successfully created.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"def transaction_request(transaction,total=nil)\n transaction_request = Cielo::TransactionRequest.new\n resul = send_request(transaction_request.serialize(transaction))\n end",
"def create\n transaction = current_user.transactions.new(transaction_params)\n if transaction.save\n new_transaction = current_user.transactions.new\n new_transaction.payments.build\n flash[:success] = 'Transaction created successfully.'\n render :success, locals: { transaction: transaction, new_transaction: new_transaction, transacted_at: params[:transaction][:transacted_at] }\n else\n flash[:failure] = transaction.errors.full_messages.to_sentence\n render :failure, locals: { transaction: transaction } # TODO: Check n Remove locals\n end\n end",
"def create\n respond_to do |format|\n @transaction = Transaction.new(transaction_params)\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n \n end\n end",
"def create\n @transaction = Transaction.new(params[:transaction])\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to(@transaction, :notice => 'Transaction was successfully created.') }\n format.xml { render :xml => @transaction, :status => :created, :location => @transaction }\n format.json { render :json => @transaction, :status => :created, :location => @transaction }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @transaction.errors, :status => :unprocessable_entity }\n format.json { render :json => @transaction.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def submit_transactions(raw_transactions: [])\n params = {\n raw_transactions: raw_transactions,\n }\n client.make_request('/submit-transactions', 'post', params: params)\n end",
"def create\n @wallet_transaction = TransactionCreate.perform(transaction_params: wallet_transaction_params,\n user: current_user)\n respond_to do |format|\n if @wallet_transaction.save\n format.html { redirect_to @wallet_transaction, notice: 'Wallet transaction was successfully created.' }\n format.json { render :show, status: :created, location: @wallet_transaction }\n else\n format.html { render :new }\n format.json { render json: @wallet_transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def transactionById\n results = HTTParty.get(\"http://192.168.99.101:4050/transactions/\" + (params[:id]).to_s)\n render json: results.parsed_response, status: results.code\n end",
"def postTransactionInprogress( transaction_id, paypal_setexpresscheckout)\n params = Hash.new\n params['transaction_id'] = transaction_id\n params['paypal_setexpresscheckout'] = paypal_setexpresscheckout\n return doCurl(\"post\",\"/transaction/inprogress\",params)\n end",
"def create\n @transaction = Transaction.new(transaction_params)\n respond_to do |format|\n @transaction.user = current_user\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @transaction = Transaction.new(params[:transaction])\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to admin_transaction_path(@transaction), notice: 'Transaction was successfully created.' }\n format.json { render json: @transaction, status: :created, location: @transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @transaction = Transaction.new(transaction_params)\n\n if !passed_correct_accounts?\n return render :nothing => true, :status => 400 #todo: should return something readable\n end\n\n if @transaction.save\n render json: @transaction, status: :created\n else\n render json: @transaction.errors, status: :unprocessable_entity\n end\n end",
"def create\n @transaction = Transaction.new(transaction_params)\n account = Account.find(@transaction.accounts_id)\n if account.limite < @transaction.valor\n flash[:error] = \"Valor da Transação excede ao limite da conta\"\n return redirect_to transactions_path\n end\n \n doneTransaction = account.beginTransaction(@transaction.tipo,@transaction.valor,@transaction.recipient)\n unless doneTransaction\n flash[:error] = account.errors.first\n return redirect_to transactions_path\n end\n\n\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @transaction = Transaction.new(transaction_params)\n @transaction.stamp = Time.now\n\n respond_to do |format|\n if @transaction.save\n @transaction.customer.lastmodified = @transaction.stamp\n @transaction.customer.balance = @transaction.customer.balance + @transaction.amount\n @transaction.customer.save\n\n format.html { redirect_to @transaction.customer }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_transaction = AdminTransaction.new(admin_transaction_params)\n if @admin_transaction.save\n render json: @admin_transaction, status: :created, location: @admin_transaction\n else\n render json: @admin_transaction.errors, status: :unprocessable_entity\n end\n end",
"def create\n @transaction = Transaction.new(transaction_params)\n @num = 1\n while Transaction.where([\"transaction_id = ?\", @num]).size > 0\n @num = @num + 1\n end\n @transaction.transaction_id = @num\n @transaction.user_email = current_user.email\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_transaction(transaction)\n if transaction.kind_of?(Hash)\n transaction = ArrowPayments::Transaction.new(transaction)\n end\n\n # Set default transaction attributes\n transaction.transaction_source = \"API\"\n\n params = transaction.to_source_hash\n params[\"Amount\"] = params[\"TotalAmount\"]\n\n resp = post(\"/transaction/add\", params)\n\n if resp[\"Success\"] == true\n ArrowPayments::Transaction.new(resp)\n else\n raise ArrowPayments::Error, resp[\"Message\"]\n end\n end",
"def create\n @transaction_request = TransactionRequest.new(transaction_request_params)\n\n if @transaction_request.save\n render :show, status: :created, location: @transaction_request\n else\n render json: @transaction_request.errors, status: :unprocessable_entity\n end\n end",
"def post_transactions_with_http_info(transaction_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransactionsApi.post_transactions ...'\n end\n # verify the required parameter 'transaction_request' is set\n if @api_client.config.client_side_validation && transaction_request.nil?\n fail ArgumentError, \"Missing the required parameter 'transaction_request' when calling TransactionsApi.post_transactions\"\n end\n # resource path\n local_var_path = '/transactions'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(transaction_request)\n auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TransactionResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#post_transactions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def api_transactions_command(transfer_json_data, customer_id = ENV['CIRCLE_CUSTOMER_ID'], customer_session_token = ENV['CIRCLE_CUSTOMER_SESSION_TOKEN'], circle_bank_account_id = ENV['CIRCLE_BANK_ACCOUNT_ID'])\n btc_transfer_json_data = transfer_json_data.to_json\n content_length = btc_transfer_json_data.length\n\n api_url = \"https://www.circle.com/api/v2/customers/#{customer_id}/accounts/#{circle_bank_account_id}/transactions\"\n\n path_header = \"/api/v2/customers/#{customer_id}/accounts/#{circle_bank_account_id}/transactions\"\n\n curl = Curl::Easy.http_post(api_url, btc_transfer_json_data) do |http|\n http.headers['host'] = 'www.circle.com'\n http.headers['method'] = 'POST'\n http.headers['path'] = path_header\n http.headers['scheme'] = 'https'\n http.headers['version'] = 'HTTP/1.1'\n http.headers['accept'] = 'application/json, text/plain, */*'\n http.headers['accept-encoding'] = 'gzip,deflate'\n http.headers['accept-language'] = 'en-US,en;q=0.8'\n http.headers['content-length'] = content_length\n http.headers['content-type'] = 'application/json;charset=UTF-8'\n http.headers['cookie'] = circle_cookie\n http.headers['origin'] = 'https://www.circle.com'\n http.headers['referer'] = \"https://www.circle.com/send/confirm\"\n http.headers['user-agent'] = \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36\"\n http.headers['x-app-id'] = 'angularjs'\n http.headers['x-app-version'] = \"0.0.1\"\n http.headers['x-customer-id'] = customer_id\n http.headers['x-customer-session-token'] = customer_session_token\n end\n\n json_data = ActiveSupport::Gzip.decompress(curl.body_str)\n parsed_json = JSON.parse(json_data)\n\n btc_transfer_response_status = parsed_json\n response_code = btc_transfer_response_status['response']['status']['code']\n if response_code == 0\n # puts 'Successful BTC tansfer!'\n # puts 'Transfer Details:'\n # puts btc_transfer_response_status\n else\n puts '** ERROR ** BTC Transfer Unsuccessful'\n puts 'Transfer Details:'\n puts btc_transfer_response_status\n end\n response_code\n end",
"def create\n @transaction = Transaction.new#Transaction.new(transaction_params)\n prepare_record_for_save(@transaction)\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render action: 'show', status: :created, location: @transaction }\n else\n format.html { render action: 'new' }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def transactions\n JSON.parse(call_blockchain_api(\"transactions\"))\n end",
"def create\n @transaction = Transaction.new(params[:transaction])\n\t\t@account = Account.find(params[:account][:id]) rescue nil\n\n respond_to do |format|\n if @transaction.save\n flash[:notice] = 'Transaction was successfully created.'\n format.html { @account ? redirect_to(@account) : redirect_to(transactions_path) }\n format.xml { render :xml => @transaction, :status => :created, :location => @transaction }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @transaction.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n outcome = Transactions::Create.run({ merchant_id: params[:merchant_id] }, transaction_params)\n\n # Then check to see if it worked:\n if outcome.success?\n render_success_response({ transaction: outcome.result })\n else\n render_unprocessable_entity(outcome.errors.symbolic)\n end\n end",
"def create\n @transaction = Transaction.new(transaction_params)\n @transaction.sender = current_user\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @transaction = Transaction.new(params[:transaction])\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to(@transaction, :notice => 'Transaction was successfully created.') }\n format.xml { render :xml => @transaction, :status => :created, :location => @transaction }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @transaction.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @transaction = Transaction.new(transaction_params)\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to '/check-out', notice: 'Transaction was successfully created.' }\n format.json { render action: 'show', status: :created, location: @transaction }\n check_out()\n UserHistoriesController.new.add_record(@transaction)\n LaptopHistoriesController.new.add_record(@transaction)\n else\n format.html { render action: 'new' }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tx = Tx.new(tx_params)\n\n respond_to do |format|\n if @tx.save\n format.html { redirect_to @tx, notice: 'Tx was successfully created.' }\n format.json { render :show, status: :created, location: @tx }\n else\n format.html { render :new }\n format.json { render json: @tx.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @transaction = Transaction.new(transaction_params)\n @flat_details = Flat.find_by_id(transaction_params[:flat_id])\n @flat_details.balance_amount = @flat_details.balance_amount.to_i - transaction_params[:debit].to_i\n @transaction.balance = @flat_details.balance_amount\n @flat_details.save\n respond_to do |format|\n if @transaction.save\n\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render action: 'show', status: :created, location: @transaction }\n else\n format.html { render action: 'new' }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.find(session[:user_id])\n @transaction = Transaction.new(params[:transaction].merge({:payer_id => session[:user_id]}))\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to(@transaction, :notice => 'Transaction was successfully created.') }\n format.xml { render :xml => @transaction, :status => :created, :location => @transaction }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @transaction.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @client_transaction = ClientTransaction.new(params[:client_transaction])\n\n respond_to do |format|\n if @client_transaction.save\n format.html { redirect_to @client_transaction, notice: 'Client transaction was successfully created.' }\n format.json { render json: @client_transaction, status: :created, location: @client_transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @client_transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def transactions(options)\n options[:type] ||= :all\n\n unless %i[all all_deal deposit withdrawal].include? options[:type]\n raise ArgumentError, \"invalid transaction type: #{options[:type]}\"\n end\n\n tranaactions_request build_url_parameters(options)\n end",
"def create\n @transaction = Transaction.new\n @transaction.amount = params[:amount]\n @transaction.from_account = Account.find_by(account_num: params[:account_num])\n @transaction.status = 'pending'\n @transaction.trans_type = 'deposit'\n @transaction.trans_from = User.find(session[:user_id])\n @transaction.save\n redirect_to accounts_path\n end",
"def user_transactions\n user_deposits = get_user_deposits\n user_withdrawals = get_user_withdrawals\n json_response({:user_transactions => @user_transactions, :user_deposits => user_deposits, :user_withdrawals => user_withdrawals})\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 @item_transaction = ItemTransaction.new(params[:item_transaction])\n\n respond_to do |format|\n if @item_transaction.save\n format.html { redirect_to @item_transaction, notice: 'Item transaction was successfully created.' }\n format.json { render json: @item_transaction, status: :created, location: @item_transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item_transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def transaction_params\n params.require(:transaction).permit(:user_id, :account_id, :transaction_endpoint_id, :transfer_to, :category_id, :type, :amount, :transaction_at, :status)\n end",
"def create\n \n if params[:type] == 'deposit'\n transaction = Transaction.create(user: @user, coin: @user_coin, transaction_type: params[:transaction_type], value: params[:value])\n \n transaction.update(:transaction_type => 'deposit')\n increment_coin(params[:value])\n deposited_coin = get_deposited_coin(transaction)\n json_response({:transaction => transaction, :deposited_coin => deposited_coin, :user => @user}, :created)\n \n elsif params[:type] == 'withdraw'\n \n withdraw_status = decrement_coin(params[:value])\n if withdraw_status == true\n transaction = Transaction.create(user: @user, coin: @user_coin, transaction_type: params[:transaction_type], value: params[:value])\n transaction.update(:transaction_type => 'withdrawal')\n deposited_coin = get_deposited_coin(transaction)\n json_response({:transaction => transaction, :deposited_coin => deposited_coin, :user => @user}, :created)\n else\n json_response({:message => 'coin value too low'}, :created)\n end\n end\n end",
"def create\n @transaction = Transaction.new(transaction_params_without_amount)\n @transaction.amount = currency_string_to_number(transaction_params_amount)\n @transaction.user = current_user\n set_year_month_day(@transaction)\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to transactions_path, notice: 'Transaction was successfully created.' }\n format.json { render action: 'show', status: :created, location: @transaction }\n else\n set_select_options\n format.html { render action: 'new' }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_transfer\n @transaction = Transaction.new(transaction_params)\n @transaction.amount = @transaction.amount * -1\n @transaction.sign = -1\n\n @transaction_to = Transaction.new(transaction_params)\n @transaction_to.account = Account.find params[:transaction][:account_to_id].to_i\n @transaction_to.sign = 1\n\n respond_to do |format|\n success = @transaction.valid? && @transaction_to.valid?\n\n if success\n Transaction.transaction do\n begin\n @transaction.save\n @transaction_to.save\n rescue ActiveRecord::StatementInvalid\n @transaction.errors.add(:base,'Invalid transfer')\n success = false\n end\n end\n end\n\n if success\n format.html { redirect_to @transaction.account, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction.account }\n else\n format.html { render :deposit }\n format.json { render json: @transaction.account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def transaction(tx_hash)\n call :get, \"/tx/#{tx_hash}\"\n end",
"def submit(opts = {})\n params = {\n secret: client_secret,\n }\n if opts.key?(:tx_blob)\n params.merge!(opts)\n else\n params.merge!({tx_json: {\n 'TransactionType' => opts[:transaction_type] || 'Payment',\n 'Account' => client_account,\n 'Destination' => opts[:destination],\n 'Amount' => opts[:amount]\n }})\n\n if opts.key?(:SendMax) and opts.key?(:Paths)\n # Complex IOU send\n params[:tx_json]['SendMax'] = opts[:SendMax]\n params[:tx_json]['Paths'] = opts[:Paths]\n end\n if opts.key?(:DestinationTag)\n params[:tx_json]['DestinationTag'] = opts[:DestinationTag]\n end\n if opts.key?(:InvoiceID)\n params[:tx_json]['InvoiceID'] = opts[:InvoiceID]\n end\n end\n # puts \"Submit: \" + params.inspect\n post(:submit, params)\n end",
"def transactions(options = {})\n @gateway.customer.transactions(id, options)\n end",
"def post_transactions(transaction_request, opts = {})\n data, _status_code, _headers = post_transactions_with_http_info(transaction_request, opts)\n data\n end",
"def transaction_params\n params.require(:transaction).permit(:user_id, :transaction_with_id, :transaction_state, :amount)\n end",
"def create\n @wallet_transaction = WalletTransaction.new(wallet_transaction_params)\n\n respond_to do |format|\n if @wallet_transaction.save\n format.html { redirect_to @wallet_transaction, notice: 'Wallet transaction was successfully created.' }\n format.json { render :show, status: :created, location: @wallet_transaction }\n else\n format.html { render :new }\n format.json { render json: @wallet_transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @transaction = Transaction.new(account_params)\n #@account.user_id = current_user.id\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def transactions\n JSON.parse(response.body).fetch('transactions')\n end",
"def submit(opts = {})\n params = {\n secret: client_secret,\n }\n if opts.key?(:tx_blob)\n params.merge!(opts)\n else\n params.merge!({tx_json: {\n 'TransactionType' => opts[:transaction_type] || 'Payment',\n 'Account' => client_account,\n 'Destination' => opts[:destination],\n 'Amount' => opts[:amount]\n }})\n\n if opts.key?(:SendMax) and opts.key?(:Paths)\n # Complex IOU send\n params[:tx_json]['SendMax'] = opts[:SendMax]\n params[:tx_json]['Paths'] = opts[:Paths]\n end\n if opts.key?(:DestinationTag)\n params[:tx_json]['DestinationTag'] = opts[:DestinationTag]\n end\n if opts.key?(:InvoiceID)\n params[:tx_json]['InvoiceID'] = opts[:InvoiceID]\n end\n end\n # puts \"Submit: \" + params.inspect\n post(:submit, params)\n end",
"def create\n @transaction = current_user.transactions.build(params[:transaction])\n\n respond_to do |format|\n if @transaction.save\n #TransactionMailer.transaction_created(Friend.find(@transaction.friend_id)).deliver\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render json: @transaction, status: :created, location: @transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @money_transaction = MoneyTransaction.new(params[:money_transaction])\n\n respond_to do |format|\n if @money_transaction.save\n format.html { redirect_to root_url, flash: { success: \"Founds were successfully transfered to #{@money_transaction.to.formatted_uid}\" } }\n format.json { render json: @money_transaction, status: :created, location: @money_transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @money_transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recurrent_transaction = RecurrentTransaction.new(recurrent_transaction_params)\n\n respond_to do |format|\n if @recurrent_transaction.save\n format.html { redirect_to @recurrent_transaction, notice: 'Recurrent transaction was successfully created.' }\n format.json { render :show, status: :created, location: @recurrent_transaction }\n else\n format.html { render :new }\n format.json { render json: @recurrent_transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bitcoin_transaction = BitcoinTransaction.new(bitcoin_transaction_params)\n\n respond_to do |format|\n if @bitcoin_transaction.save\n format.html { redirect_to @bitcoin_transaction, notice: 'Bitcoin transaction was successfully created.' }\n format.json { render :show, status: :created, location: @bitcoin_transaction }\n else\n format.html { render :new }\n format.json { render json: @bitcoin_transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def transactions(count = 10)\n @client.transactions(name, count)\n end",
"def transaction_params\n params.require(:transaction).permit(:name, :date, :amount, :action)\n end",
"def transactions(acct)\n unless Object.const_defined? \"Johnson\"\n raise \"Johnson not found. Install the johnson gem, or use simple_transactions instead.\"\n end\n\n sc = @agent.cookies.detect{|c| c.name == \"JSESSIONID\"}\n\n post_headers = {\n \"callCount\" => \"1\",\n \"httpSessionId\" => sc.value,\n \"scriptSessionId\" => @script_sess,\n \"c0-scriptName\" => \"TxnService\",\n \"c0-methodName\" => \"searchTransactions\",\n \"c0-id\" => \"0\",\n \"c0-e1\" => \"number:10000004\",\n \"c0-e2\" => \"string:17CBE222A42161A3FF450E47CF4C1A00\",\n \"c0-e3\" => \"null:null\",\n \"c0-e5\" => \"string:MM%2Fdd%2Fyyyy\",\n \"c0-e6\" => \"string:USD\",\n \"c0-e7\" => \"string:PST\",\n \"c0-e8\" => \"string:.\",\n \"c0-e9\" => \"string:%2C\",\n \"c0-e10\" => \"string:%23%23%23%2C%23%230.%23%23\",\n \"c0-e4\" => \"Object_Object:{dateFormat:reference:c0-e5, currencyCode:reference:c0-e6, timeZone:reference:c0-e7, decimalSeparator:reference:c0-e8, groupingSeparator:reference:c0-e9, groupPattern:reference:c0-e10}\",\n \"c0-e11\" => \"number:1\",\n \"c0-e12\" => \"boolean:false\",\n \"c0-param0\" => \"Object_Object:{cobrandId:reference:c0-e1, applicationId:reference:c0-e2, csit:reference:c0-e3, iBean:reference:c0-e4, loggingLevel:reference:c0-e11, loggingEnabled:reference:c0-e12}\",\n \"c0-e13\" => \"string:#{acct.id}\",\n \"c0-e14\" => \"string:-1\",\n \"c0-e15\" => \"null:null\",\n \"c0-e16\" => \"string:-1\",\n \"c0-e17\" => \"null:null\",\n \"c0-e18\" => \"null:null\",\n \"c0-e19\" => \"null:null\",\n \"c0-e20\" => \"string:-1\",\n \"c0-e21\" => \"null:null\",\n \"c0-e22\" => \"number:-1\",\n \"c0-e23\" => \"number:-1\",\n \"c0-e24\" => \"boolean:false\",\n \"c0-e25\" => \"string:\",\n \"c0-e26\" => \"boolean:false\",\n \"c0-e27\" => \"string:\",\n \"c0-e28\" => \"string:\",\n \"c0-e29\" => \"string:\",\n \"c0-e30\" => \"string:\",\n \"c0-e31\" => \"string:\",\n \"c0-e32\" => \"boolean:false\",\n \"c0-e33\" => \"string:0.0\",\n \"c0-e34\" => \"string:0\",\n \"c0-e35\" => \"null:null\",\n \"c0-e36\" => \"null:null\",\n \"c0-e37\" => \"string:allTransactions\",\n \"c0-e38\" => \"string:InProgressAndCleared\",\n \"c0-e39\" => \"number:999\",\n \"c0-e40\" => \"string:\",\n \"c0-e41\" => \"null:null\",\n \"c0-e42\" => \"null:null\",\n \"c0-e43\" => \"string:\",\n \"c0-e44\" => \"null:null\",\n \"c0-e45\" => \"string:ALL\",\n \"c0-e46\" => \"string:false\",\n \"c0-e47\" => \"null:null\",\n \"c0-e48\" => \"string:0.0\",\n \"c0-e49\" => \"string:0.0\",\n \"c0-e50\" => \"string:ALL\",\n \"c0-param1\" => \"Object_Object:{itemAccountId:reference:c0-e13, categoryId:reference:c0-e14, categoryLevelId:reference:c0-e15, dateRangeId:reference:c0-e16, fromDate:reference:c0-e17, toDate:reference:c0-e18, groupBy:reference:c0-e19, groupAccountId:reference:c0-e20, filterTranasctions:reference:c0-e21, transactionTypeId:reference:c0-e22, transactionStatusId:reference:c0-e23, ignorePendingTransactions:reference:c0-e24, includeBusinessExpense:reference:c0-e25, includeTransfer:reference:c0-e26, includeReimbursableExpense:reference:c0-e27, fromDate1:reference:c0-e28, toDate1:reference:c0-e29, includeMedicalExpense:reference:c0-e30, includeTaxDeductible:reference:c0-e31, includePersonalExpense:reference:c0-e32, transactionAmount:reference:c0-e33, transactionAmountRange:reference:c0-e34, billStatementRange:reference:c0-e35, criteria:reference:c0-e36, module:reference:c0-e37, transactionType:reference:c0-e38, pageSize:reference:c0-e39, sharedMemId:reference:c0-e40, overRideDateRangeId:reference:c0-e41, overRideContainer:reference:c0-e42, searchString:reference:c0-e43, pageId:reference:c0-e44, splitTypeTransaction:reference:c0-e45, isAvailableBalance:reference:c0-e46, categoryIds:reference:c0-e47, currentBalance:reference:c0-e48, availableBalance:reference:c0-e49, container:reference:c0-e50}\",\n \"c0-param2\" => \"boolean:true\",\n \"batchId\" => \"3\"\n }\n\n page = @agent.post(\n 'https://moneycenter.yodlee.com/moneycenter/dwr/call/plaincall/TxnService.searchTransactions.dwr',\n post_headers\n )\n\n j = Johnson::Runtime.new\n\n script = page.body\n\n # Remove the last line (a call to DWREngine), and execute\n script = script.strip.sub(/\\n[^\\n]+\\Z/m, '')\n\n # Remove a leading throw statement.\n script = script.sub(/\\A.*?\\n+/, '')\n\n j.evaluate script\n\n if x = j['s5']\n transactions = x.map do |e|\n transaction = Yodlee::Transaction.new\n transaction.account_name = e.accountName\n transaction.currency = e.amount.cobCurrencyCode\n transaction.amount = e.amount.cobPreciseAmount\n transaction.description = e.description\n transaction.account_id = e.itemAccountId\n transaction.fit_id = e.transactionId\n transaction.status = e['type']['type']\n\n # Re-parse in order to get a real Time, not a Johnson::SpiderMonkey::RubyLandProxy.\n transaction.date = Time.parse(e.date.to_s)\n transaction\n end\n\n return transactions\n end\n\n return []\n end",
"def create\n @transaction = @source.source_transactions.new(transaction_params)\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to polymorphic_path([@source, :transactions]), notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def createrawtransaction(transactionid = nil, address_amount)\n @api.request 'createrawtransaction', transactionid, address_amount\n end",
"def transaction_with_http_info(txid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.transaction ...'\n end\n # verify the required parameter 'txid' is set\n if @api_client.config.client_side_validation && txid.nil?\n fail ArgumentError, \"Missing the required parameter 'txid' when calling DefaultApi.transaction\"\n end\n # resource path\n local_var_path = '/api/v1/transaction'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'txid'] = txid\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', 'application/xml', ])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Transaction' \n\n # auth_names\n auth_names = opts[:auth_names] || []\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#transaction\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n add_breadcrumb 'New Transaction'\n\n @transaction = Transaction.new(transaction_params)\n\n respond_to do |format|\n if @transaction.save\n format.html do\n redirect_to @transaction,\n notice: 'Transaction was successfully created.'\n end\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new , status: :unprocessable_entity }\n format.json do\n render json: @transaction.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def create\n # Method to add Producer to hash to create transaction\n user = User.find_by_id(params[:transaction][:producer])\n hash = Hash.new\n hash = params[:transaction]\n @transaction = Transaction.new\n if user.nil?\n respond_to do |format|\n format.html { render action: \"new\" }\n format.json { head :no_content, status: :unprocessable_entity }\n end\n else\n hash[:producer] = user.name\n @transaction = user.transactions.build(hash)\n @transaction.save!\n user.save!\n \n \n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: t(:transaction_created) }\n format.json { render json: @transaction, status: :created, location: @transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def transactions(options = {})\n response = JSON.parse(@client.get(\"items/#{send(:id)}/transactions\", options).body)\n transactions = response.key?('transactions') ? response['transactions'] : []\n transactions.map { |attributes| Promisepay::Transaction.new(@client, attributes) }\n end",
"def transactions(options = {})\n response = JSON.parse(@client.get(\"items/#{send(:id)}/transactions\", options).body)\n transactions = response.key?('transactions') ? response['transactions'] : []\n transactions.map { |attributes| Promisepay::Transaction.new(@client, attributes) }\n end",
"def transactions(options = {})\n response = JSON.parse(@client.get(\"items/#{send(:id)}/transactions\", options).body)\n transactions = response.key?('transactions') ? response['transactions'] : []\n transactions.map { |attributes| Promisepay::Transaction.new(@client, attributes) }\n end",
"def create\n @tx = Tx.new(params[:tx])\n\n respond_to do |format|\n if @tx.save\n format.html { redirect_to(@tx, :notice => 'Tx was successfully created.') }\n format.xml { render :xml => @tx, :status => :created, :location => @tx }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tx.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @transaction = @transactions.build(transaction_params)\n @transaction.account = current_user.account\n if @transaction.save\n redirect_to @transaction, notice: \"#{@transaction.transaction_type_name} was successfully placed.\"\n else\n render :new \n end\n end",
"def transaction_params\n params.require(:transaction).permit(:t_user1_id, :t_user2_id, :amount)\n end",
"def create\n @stats_money_transaction = Stats::MoneyTransaction.new(params[:stats_money_transaction])\n\n respond_to do |format|\n if @stats_money_transaction.save\n format.html { redirect_to @stats_money_transaction, notice: 'Money transaction was successfully created.' }\n format.json { render json: @stats_money_transaction, status: :created, location: @stats_money_transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stats_money_transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n\t\ttransaction = Transaction.where(user_id: params[:user_id])\n\n\t\tif transaction\n\t\t\trender json: transaction,status: 200\n\t\telse\n\t\t\trender json: transaction.errors.messages,status: 422\n\t\tend\t\n\tend",
"def createTransaction\n results1 = checkUser(params[:userid]) #userid user to give the money\n money1 = checkMoneyUser(@current_user[\"id\"]) # check if the user id that sends the money have the amount\n moneyusergiving = money1.parsed_response\n if (moneyusergiving[\"money\"]).to_f > 0 && (moneyusergiving[\"money\"]).to_f >= (params[:amount]).to_f\n if results1.code == 200\n results2 = postTransaction(@current_user[\"id\"], params[:userid], params[:amount]) # create initial state\n transact = results2.parsed_response # transact object to get the id in the rest of the process\n if results2.code == 201\n logTransaction(\"Transaction\", transact[\"id\"], @current_user[\"id\"], params[:userid], params[:amount], transact[\"state\"], 0)\n newMoneyGiving = (moneyusergiving[\"money\"]).to_f - (params[:amount]).to_f\n results3 = updateMoney(newMoneyGiving, @current_user[\"id\"]) #subtract money from useridgiving\n if results3.code == 204\n logUpdateMoney(@current_user[\"id\"], newMoneyGiving, 0)\n results4 = updateTransaction(\"pending\", transact[\"id\"])# put pending state\n if results4.code == 204\n logTransaction(\"Transaction\", transact[\"id\"], @current_user[\"id\"], params[:userid], params[:amount], \"pending\", 0)\n money2 = checkMoneyUser(params[:userid]) # check if the user id that sends the money have the amount\n moneyuserreceiving= money2.parsed_response\n newMoneyReceiving = (moneyuserreceiving[\"money\"]).to_f + (params[:amount]).to_f\n results5 = updateMoney(newMoneyReceiving, params[:userid])#add money from useridreceiving\n if results5.code == 204\n logUpdateMoney(params[:userid], (moneyuserreceiving[\"money\"]).to_f + (params[:amount]).to_f, 0)\n results6 = updateTransaction(\"complete\", transact[\"id\"])# put complete state\n if results6.code == 204\n logTransaction(\"Transaction\", transact[\"id\"], @current_user[\"id\"], params[:userid], params[:amount], \"complete\", 0)\n subject = \"Transacción\"\n content = \"Has recibido una transacción del usuario \" + formato(@current_user[\"id\"]) + \" por valor de $\" + (params[:amount]).to_s\n notification_key = get_group_key(params[:userid])\n createNotification(params[:userid],subject, content, notification_key)\n head 201 # transaction created and state #####COMPLETE#######\n else\n ##########ERROR EN UPDATE A TRANSACCION (complete)###### Si ya se le resto el dinero se le devuelve y al otro usuario si se le sumo se le resta.\n #devuelve el dinero al que envia\n undoUpdateMoney(@current_user[\"id\"], newMoneyGiving.to_f , newMoneyGiving.to_f + (params[:amount]).to_f)\n #le quita al que recibe\n undoUpdateMoney(params[:userid], newMoneyReceiving.to_f , newMoneyReceiving.to_f - (params[:amount]).to_f)\n resultsError = updateTransaction(\"incomplete\", transact[\"id\"])\n if resultsError.code == 204\n logTransaction(\"Transaction\", transact[\"id\"], @current_user[\"id\"], params[:userid], params[:amount], \"incomplete\", 1)\n end\n render json: results6.parsed_response, status: results6.code\n ##########ERROR EN UPDATE A TRANSACCION (complete)###### Si ya se le resto el dinero se le devuelve y al otro usuario si se le sumo se le resta.\n end\n else\n ##########ERROR EN SUMAR DINERO AL DESTINATARIO###### Si ya se le resto el dinero se le devuelve y al otro usuario si se le sumo se le resta.\n #devuelve el dinero al que envia\n undoUpdateMoney(@current_user[\"id\"], newMoneyGiving.to_f , newMoneyGiving.to_f + (params[:amount]).to_f)\n #le quita al que recibe\n undoUpdateMoney(params[:userid], newMoneyReceiving.to_f , newMoneyReceiving.to_f - (params[:amount]).to_f)\n resultsError = updateTransaction(\"incomplete\", transact[\"id\"])\n if resultsError.code == 204\n logTransaction(\"Transaction\", transact[\"id\"], @current_user[\"id\"], params[:userid], params[:amount], \"incomplete\", 1)\n end\n render json: results5.parsed_response, status: results5.code\n ##########ERROR EN SUMAR DINERO AL DESTINATARIO###### Si ya se le resto el dinero se le devuelve y si se le sumo se le resta.\n end\n else\n ##########ERROR EN UPDATE A TRANSACCION (pending)###### Si ya se le resto el dinero se le devuelve y si se le sumo se le resta.\n undoUpdateMoney(@current_user[\"id\"], newMoneyGiving.to_f , newMoneyGiving.to_f + (params[:amount]).to_f)\n resultsError = updateTransaction(\"incomplete\", transact[\"id\"])\n if resultsError.code == 204\n logTransaction(\"Transaction\", transact[\"id\"], @current_user[\"id\"], params[:userid], params[:amount], \"incomplete\", 1)\n end\n render json: results4.parsed_response, status: results4.code\n ##########ERROR EN UPDATE A TRANSACCION (pending)###### Si ya se le resto el dinero se le devuelve y si se le sumo se le resta.\n end\n else\n ##########ERROR EN RESTAR DINERO AL USUARIO QUE ENVIA###### Si ya se le resto el dinero se le devuelve y se deja la transaccion como incomplete\n undoUpdateMoney(@current_user[\"id\"], newMoneyGiving.to_f , newMoneyGiving.to_f + (params[:amount]).to_f)\n resultsError = updateTransaction(\"incomplete\", transact[\"id\"])\n if resultsError.code == 204\n logTransaction(\"Transaction\", transact[\"id\"], @current_user[\"id\"], params[:userid], params[:amount], \"incomplete\", 1)\n end\n render json: results3.parsed_response, status: results3.code\n ##########ERROR EN RESTAR DINERO AL USUARIO QUE ENVIA###### Si ya se le resto el dinero se le devuelve y se deja la transaccion como incomplete\n end\n else\n resultsError = updateTransaction(\"incomplete\", transact[\"id\"])\n if resultsError.code == 204\n logTransaction(\"Transaction\", transact[\"id\"], @current_user[\"id\"], params[:userid], params[:amount], \"incomplete\", 1)\n end\n render json: results2.parsed_response, status: results2.code\n end\n elsif results1.code == 404\n renderError(\"Not Found\", 404, \"The resource does not exist\")\n end\n else\n renderError(\"Bad Request\", 400, \"The user do not have enough money\")\n return -1\n end\n end",
"def transaction_params\n params.require(:transaction).permit(:transaction_type, :user_id, :coin_id)\n end"
] | [
"0.7087685",
"0.7076234",
"0.7045395",
"0.7007328",
"0.6948236",
"0.6933985",
"0.690057",
"0.68533885",
"0.6781453",
"0.67718816",
"0.67703694",
"0.6764475",
"0.67454666",
"0.6737669",
"0.6729105",
"0.67147774",
"0.6710319",
"0.6710273",
"0.6699146",
"0.6677388",
"0.66676146",
"0.66661185",
"0.6654618",
"0.6654618",
"0.6654618",
"0.6654618",
"0.6654618",
"0.66482013",
"0.66288716",
"0.6622602",
"0.66218925",
"0.66093975",
"0.6604903",
"0.6600187",
"0.6590222",
"0.6562066",
"0.65361965",
"0.6527704",
"0.65169877",
"0.6494031",
"0.64824086",
"0.648036",
"0.64711714",
"0.64468914",
"0.6439635",
"0.6414807",
"0.6398338",
"0.63631356",
"0.6362753",
"0.6361935",
"0.63596433",
"0.6356623",
"0.6354467",
"0.6352033",
"0.6347403",
"0.6346298",
"0.63306767",
"0.63278353",
"0.6315419",
"0.6298908",
"0.62809175",
"0.6276909",
"0.6276116",
"0.6276096",
"0.6272898",
"0.6271346",
"0.6265216",
"0.6248635",
"0.62472904",
"0.6246964",
"0.6238729",
"0.620449",
"0.620127",
"0.6201028",
"0.6195112",
"0.6191389",
"0.6191261",
"0.61763626",
"0.6172836",
"0.6172683",
"0.6169",
"0.6168564",
"0.6167747",
"0.61663216",
"0.6162854",
"0.6162839",
"0.61425453",
"0.61417234",
"0.61267483",
"0.6125534",
"0.6123609",
"0.61115766",
"0.61115766",
"0.61115766",
"0.611074",
"0.6105239",
"0.6100345",
"0.60991514",
"0.60978156",
"0.6092729",
"0.6088812"
] | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_transaction
@transaction = Transaction.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Only allow a list of trusted parameters through. | def transaction_params
params.require(:transaction).permit(:name, :amount, :date, :group_ids)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def allow_params_authentication!; end",
"def whitelisted_args\n args.select &:allowed\n end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def filtered_parameters; end",
"def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def expected_permitted_parameter_names; end",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def check_params; true; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def allowed?(*_)\n true\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end",
"def valid_params?; end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def url_allowlist=(_arg0); end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def list_params\n params.permit(:list_name)\n end",
"def valid_params_request?; end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end",
"def safelists; end",
"def authorize_own_lists\n authorize_lists current_user.lists\n end",
"def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end",
"def lists_params\n params.require(:list).permit(:name)\n\n end",
"def list_params\n params.require(:list).permit(:name, :user_id)\n end",
"def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end",
"def check_params\n true\n end",
"def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end",
"def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend",
"def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def whitelist; end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.permit(:name)\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end",
"def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end",
"def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def permitted_params\n []\n end",
"def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end",
"def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end",
"def params(list)\n @declared_params = list\n end",
"def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end",
"def allow(ids); end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end",
"def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def safelist; end",
"def valid_for_params_auth?; end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def shopping_list_params\n params.require(:shopping_list).permit!\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def permitters\n @_parametrizr_permitters || {}\n end",
"def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end",
"def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end",
"def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end",
"def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end",
"def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end",
"def url_allowlist; end",
"def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end",
"def quote_params\n params.permit!\n end"
] | [
"0.6950644",
"0.68134046",
"0.68034387",
"0.6796522",
"0.674668",
"0.6742105",
"0.6527854",
"0.65214247",
"0.6491907",
"0.64294493",
"0.64294493",
"0.64294493",
"0.64004904",
"0.6356768",
"0.63556653",
"0.6348119",
"0.6344521",
"0.63386923",
"0.632588",
"0.632588",
"0.632588",
"0.6315317",
"0.6300307",
"0.6266357",
"0.62616897",
"0.62586933",
"0.623662",
"0.6228699",
"0.6222646",
"0.6221808",
"0.62095183",
"0.6200624",
"0.6197454",
"0.61747247",
"0.6158626",
"0.61565846",
"0.6152596",
"0.6137625",
"0.6123762",
"0.61105245",
"0.6076312",
"0.6071771",
"0.60621834",
"0.60548234",
"0.6044156",
"0.603494",
"0.6019818",
"0.60173535",
"0.60154593",
"0.60121197",
"0.6008601",
"0.6008049",
"0.60078037",
"0.60059106",
"0.60059106",
"0.5997147",
"0.599462",
"0.59918606",
"0.5984179",
"0.59706646",
"0.59698576",
"0.5966363",
"0.5965114",
"0.59620297",
"0.5961917",
"0.59358233",
"0.5929989",
"0.59241587",
"0.59088653",
"0.59052056",
"0.59033877",
"0.58932143",
"0.58890563",
"0.5880874",
"0.5880874",
"0.5880874",
"0.58739555",
"0.5863163",
"0.585503",
"0.5845768",
"0.58438927",
"0.58353096",
"0.583153",
"0.58292353",
"0.58277905",
"0.58186984",
"0.58164775",
"0.581428",
"0.58108085",
"0.5805045",
"0.5805045",
"0.58009875",
"0.5796557",
"0.5785622",
"0.57814676",
"0.5777818",
"0.577579",
"0.57690275",
"0.5768062",
"0.57632935",
"0.57591033"
] | 0.0 | -1 |
Report progress on object | def progress(_object)
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def progress(object)\n reporter.progress(object)\n end",
"def progress; end",
"def progress; end",
"def progress; end",
"def progress; end",
"def progress; end",
"def indicate_progress\n end",
"def progressable; end",
"def progress_mark; end",
"def progress\n data.progress\n end",
"def progress=(_arg0); end",
"def progress=(_arg0); end",
"def progress=(_arg0); end",
"def progress=(_arg0); end",
"def progress()\n percent = (($ops / $total_ops) * 100).floor\n if (percent <= 99)\n $progress.progress = percent\n $ops += 1\n else\n $progress.finish\n end\nend",
"def report_progress(message)\n @progress_block.call(message) if @progress_block\n end",
"def progress=(value)\n @progress = value\n end",
"def check_progress\n self.increment_count\n begin\n self.send(\"check_progress_#{self.type}\")\n rescue\n self.update_attributes(:status =>'not yet available')\n end\n end",
"def report_progress(p_args)\n # To be overriden in subclass,\n # not implemented here.\n raise NotImplementedError\n end",
"def print_progress\n @data[\"print_progress\"]\n end",
"def resque_progress(object, worker)\r\n\t\tresult = []\r\n\t\tif object.has_attribute?('meta_id') and !(object.meta_id.nil?)\r\n\t\t\tmeta = worker.constantize.get_meta(\"#{object.meta_id}\")\r\n\t\t\tresult = meta.progress\r\n\t\tend\r\n\t\tresult\r\n\tend",
"def progress_mark=(_arg0); end",
"def progress_line; end",
"def progress\n l = length\n l.zero? ? 0 : 100 * time / l\n end",
"def progress\n l = length\n l.zero? ? 0 : 100 * time / l\n end",
"def progress\n l = length\n l.zero? ? 0 : 100 * time / l\n end",
"def check_progress\n succeed(self) if finished?\n end",
"def progress(progress)\n progress = [progress] unless progress.respond_to?(:[])\n publishProgress(progress)\n end",
"def progress(*args, &block)\n @@progress_block = block if block\n @@progress_block.call(*args) if defined?(@@progress_block) && args.length>0\n end",
"def progress; state == 'running' ? @doc['progress'] : nil; end",
"def progress\n return 100 unless @history.first\n completed_size = @history.first.jobs.select(&:completed?).size\n completed_size * 100 / @history.first.jobs.size\n end",
"def progress(percentage, description = nil)\n reply({:progress => percentage, :description => description}, {:message_type => 'progress'})\n end",
"def update_progress\n progress = 0\n self.weight_histories.each do |w|\n progress += w.weight_recording\n end\n self.update(progress: progress)\n end",
"def show_progress=(_arg0); end",
"def progress\n return @progress\n end",
"def progressable=(_arg0); end",
"def progress\n if processed\n return 100.0\n end\n\n response = Zencoder::Job.progress(zencoder_job_id)\n \n if response.body[\"state\"] == \"finished\"\n processed!\n return 100.0\n end\n\n return response.body[\"progress\"] if response.body[\"progress\"]\n\n return 0.0\n end",
"def progress(run_id)\r\n @result_count = self.get_results(run_id)[:result].length - 1\r\n run = Run.find(run_id)\r\n @result = ((@result_count.to_f / run.units.count.to_f) * 100).round(2)\r\n end",
"def show\n calculate_progress\n ##complete_goal\n end",
"def progress()\n return 1.0 * @done_time_units / @total_time_units\n end",
"def mark_complete\n if self.completed\n self.progress = \"COMP\"\n self.progress_percentage = \"100\"\n elsif self.progress and !self.progress.eql?('COMP') and self.progress_percentage\n self.progress = self.progress\n self.progress_percentage = self.progress_percentage\n else\n self.progress = \"INPR\"\n self.progress_percentage = \"0\"\n end\n end",
"def report_progress\n backup_size = (@backup.size + @backup.wal_file_size) / 1024 ** 2\n du = target_path_exists? ? target_path_disk_usage / 1024 ** 2 : 0\n percent = du.to_f / backup_size.to_f * 100\n percent = 100.0 if percent >= 100.0\n message = \"#{percent.to_i}% of Backup #{@backup.id} (#{@backup.server}) recovered\" \n at(percent.to_i, 100, message)\n @log.info(message)\n end",
"def progress(callback = nil, &blk)\n @progress = callback || blk\n end",
"def clear_progress; end",
"def set_status\n @completed = @progress == @number\n end",
"def sync_progress\n response = rpc(:block_count, _coerce: Hash)\n\n count = response[:count]\n unchecked = response[:unchecked]\n total = count + unchecked\n\n count.to_f * 100 / total.to_f\n end",
"def perform\n Game.update_all_progress_caches\n end",
"def indicate_progress\n @iteration_counter += 1\n @progress_rate ||= resolver_ui.progress_rate\n if iteration_rate.nil?\n if Time.now - started_at >= @progress_rate\n self.iteration_rate = @iteration_counter\n end\n end\n\n if iteration_rate && (@iteration_counter % iteration_rate) == 0\n resolver_ui.indicate_progress\n end\n end",
"def progress(msg, nontty_log = T.unsafe(nil)); end",
"def check_progress\n #if (Time.zone.now - analysis_job.overall_progress_modified_at) > OVERALL_PROGRESS_REFRESH_SECONDS\n\n # https://github.com/ActsAsParanoid/acts_as_paranoid/issues/45\n was_deleted = deleted?\n if was_deleted\n old_paranoid_value = paranoid_value\n self.paranoid_value = nil\n end\n\n # skip validations and callbacks, and do not set updated_at, save value to database\n update_columns(update_job_progress)\n\n # finally, after each update, check if we can finally finish the job!\n complete! if may_complete?\n\n self.paranoid_value = old_paranoid_value if was_deleted\n end",
"def report_progress(data = {})\n @progress_count ||= 0\n\n if (@progress_count += 1) > 4\n warn(\"do not call Slackathon::Command#report_progress more than 4 times\")\n return\n end\n\n say(\n response_type: :ephemeral,\n text: format(progress_message, data)\n )\n end",
"def run_with_progress(message, size, progr = nil, &block)\n if(progr_object = (progr || progressor))\n progr_object.run_with_progress(message, size, &block)\n else\n dummy_prog = Object.new\n class << dummy_prog\n def inc\n end\n end\n block.call(dummy_prog)\n end\n end",
"def perform\n return if cancelled?\n\n objects = [*1..200]\n batch = Sidekiq::Batch.new\n batch.on(:complete, 'BatchWorker')\n total objects.count\n batch.jobs do\n objects.each_with_index do |object, index|\n at(index + 1, \"Processing object #{object}\")\n PrintWorker.perform_async(object, index)\n end\n end\n end",
"def on_progress &b\n @on_progress_changed_cb = b\n end",
"def percent_progress\n data[:percent_progress]\n end",
"def percent_progress\n data[:percent_progress]\n end",
"def perform(progress_payload_object, channel)\n # parameters passed from send_progress_percentage\n\n # Calls action cable broadcast for user's channel.\n # KEY!! Sender has its own channel which is craeted when user uses refreshes to navigates to booking confirmation in the frontend\n # progress_payload_object is sent to the\n # recipient via actioncable websocket connnection addressed to the recipient's\n # own chat room. When message is received redux action updates state on the frontend.\n # p '****** in Job each channel, progress_payload_object: ' + channel.to_s + ' ' + progress_payload_object.to_s\n ActionCable.server.broadcast(channel, progress_payload_object)\n end",
"def update_progress(file, percent_done)\n file_info = filesizes[file]\n\n current_bytes = (percent_done * file_info[:size]) / 100\n since_last = current_bytes - file_info[:transferred]\n filesizes[file][:transferred] = current_bytes\n\n increment_transferred(since_last)\n update_percent(transferred)\n end",
"def update( obj )\n timer.measure { \n tweet = obj\n }\n log_stats\n end",
"def perform\n options.clean_options!\n at(0, 100, t('common.progress_initializing'))\n\n user = User.find(options[:user_id])\n dataset = user.datasets.active.find(options[:dataset_id])\n task = dataset.analysis_tasks.find(options[:task_id])\n\n task.name = t('.short_desc')\n task.save\n\n analyzer = RLetters::Analysis::NamedEntities.new(\n dataset,\n ->(p) { at(p, 100, t('.progress_finding')) })\n\n # Write it out\n at(100, 100, t('common.progress_finished'))\n ios = StringIO.new(analyzer.entity_references.to_json)\n file = Paperclip.io_adapters.for(ios)\n file.original_filename = 'named_entites.json'\n file.content_type = 'application/json'\n\n task.result = file\n\n # We're done here\n task.finish!\n\n completed\n end",
"def update_progress(total, done)\n percentage = total.zero? ? 100 : ((done.to_f / total) * 100).to_i\n progress(percentage)\n end",
"def set_progress\n @progress = Progress.find(params[:id])\n end",
"def set_progress\n @progress = Progress.find(params[:id])\n end",
"def show_progress(collection, say=\"Progress\", &block)\n progress_bar = ProgressBar.new say, collection.count\n\n collection.each do |thing|\n block.call thing\n progress_bar.increment\n end\n\n puts # distinguish progress_bar output from other output\nend",
"def log_progress_info(dobj, status)\n {\n status:,\n discovery_finished: true,\n pid: dobj.druid.id,\n timestamp: Time.now.utc.strftime('%Y-%m-%d %H:%M:%S')\n }\n end",
"def report_progress(progress, total, show_parts=true)\n if total && total > 0\n percent = (progress.to_f / total.to_f) * 100\n line = \"Progress: #{percent.to_i}%\"\n line << \" (#{progress} / #{total})\" if show_parts\n else\n line = \"Progress: #{progress}\"\n end\n\n info(line, :new_line => false)\n end",
"def progress(run)\n return unless run.started?\n\n progress = Progress.new(run)\n\n progress_bar = tag.progress(\n value: progress.value,\n max: progress.max,\n class: [\"progress\"] + STATUS_COLOURS.fetch(run.status)\n )\n progress_text = tag.p(tag.i(progress.text))\n tag.div(progress_bar + progress_text, class: \"block\")\n end",
"def set_progress(caption, percent)\n #puts self\n #puts \"env=#{self.environment}\"\n logger.debug(\"set_progress(#{caption}, #{percent})\")\n self.environment.send_data({:caption=>caption, :percent=>percent}.to_json)\n end",
"def progressSetPosition _obj, _args\n \"_obj progressSetPosition _args;\" \n end",
"def in_progress!(**options)\n update(status: 'in_progress', started_at: Time.now, **options)\n end",
"def progress_line=(_arg0); end",
"def progress(url)\n @progress_url = url\n end",
"def progress_rate\n 1\n end",
"def get_progress\n listing_params = ActiveListing.get_validation_params(self)\n\n ActiveListing.new(listing_params).progress\n end",
"def update_progress\n p = Progress.find_or_initialize_by(team_id:self.team_id,user_id:self.user_id,question_id:self.question_id)\n x = self.calc_progress\n if x > p.value\n p.value = x\n end\n p.save!\n end",
"def progress\n return @procs_queue.size / @initial_size.to_f\n end",
"def update_job_progress\n defaults = AnalysisJobsItem::AVAILABLE_ITEM_STATUS.product([0]).to_h\n statuses = AnalysisJobsItem.where(analysis_job_id: id).group(:status).count\n statuses[:total] = statuses.map(&:last).reduce(:+) || 0\n\n statuses = defaults.merge(statuses)\n\n self.overall_progress = statuses\n self.overall_progress_modified_at = Time.zone.now\n\n { overall_progress:, overall_progress_modified_at: }\n end",
"def update(percentage,text=nil)\n @progressBar.text = text.to_s if text\n @progressBar.fraction = percentage.to_f\n end",
"def object_updated(object)\n notify\n end",
"def update( obj )\n tweet = Marshal.restore( obj )\n timer.measure { \n catch(:skip_fetch) do\n tweet.text = fetcher.fetch_text( tweet )\n tweet.scrape_at = Time.now_as_mjd_stamp\n store_queue.put( Marshal.dump( tweet ) )\n end\n }\n log_stats\n end",
"def progress( opts = {}, &block )\n opts = opts.symbolize_keys\n\n include_stats = opts[:stats].nil? ? true : opts[:stats]\n include_messages = opts[:messages].nil? ? true : opts[:messages]\n include_slaves = opts[:slaves].nil? ? true : opts[:slaves]\n include_issues = opts[:issues].nil? ? true : opts[:issues]\n include_errors = opts.include?( :errors ) ? (opts[:errors] || 0) : false\n\n as_hash = opts[:as_hash] ? true : opts[:as_hash]\n\n data = {\n 'stats' => {},\n 'status' => status,\n 'busy' => running?\n }\n\n data['messages'] = flush_buffer if include_messages\n\n if include_errors\n data['errors'] = errors( include_errors.is_a?( Integer ) ? include_errors : 0 )\n end\n\n if include_issues\n data['issues'] = as_hash ? issues_as_hash : issues\n end\n\n data['instances'] = {} if include_slaves\n\n stats = []\n stat_hash = {}\n stats( true, true ).each { |k, v| stat_hash[k.to_s] = v } if include_stats\n\n if master? && include_slaves\n data['instances'][self_url] = stat_hash.dup\n data['instances'][self_url]['url'] = self_url\n data['instances'][self_url]['status'] = status\n end\n\n stats << stat_hash\n\n if !has_slaves? || !include_slaves\n if include_stats\n data['stats'] = merge_stats( stats )\n else\n data.delete( 'stats' )\n end\n data['instances'] = data['instances'].values if include_slaves\n block.call( data )\n return\n end\n\n foreach = proc do |instance, iter|\n instance.framework.progress_data( opts ) do |tmp|\n if !tmp.rpc_exception?\n tmp['url'] = instance.url\n iter.return( tmp )\n else\n iter.return( nil )\n end\n end\n end\n\n after = proc do |slave_data|\n slave_data.compact!\n slave_data.each do |slave|\n data['messages'] |= slave['messages'] if include_messages\n\n if include_errors && slave['errors']\n data['errors'] ||= []\n data['errors'] |= slave['errors']\n end\n\n if include_slaves\n url = slave['url']\n data['instances'][url] = slave['stats'] || {}\n data['instances'][url]['url'] = url\n data['instances'][url]['status'] = slave['status']\n end\n\n stats << slave['stats']\n end\n\n if include_slaves\n sorted_data_instances = {}\n data['instances'].keys.sort.each do |url|\n sorted_data_instances[url] = data['instances'][url]\n end\n data['instances'] = sorted_data_instances.values\n end\n\n if include_stats\n data['stats'] = merge_stats( stats )\n else\n data.delete( 'stats' )\n end\n\n data['busy'] = slave_data.map { |d| d['busy'] }.include?( true )\n\n block.call( data )\n end\n\n map_slaves( foreach, after )\n end",
"def update\n if( @@test.eql?(\"100.00\"))\n puts \"DOWNLOAD COMPLETE\"\n @@thread.exit\n render :partial => \"complete\", :locals => { :progress_int => @@test, :done_int =>@@done, :elapsed_int =>@@elapsed_int }\n return\n end\n\n @@test= \"%.2f\" % @@thread[:progress].to_f \n @@done= \"%d\" % @@thread[:done] \n now = Time.now\n elapsed =now - @@start\n @@elapsed_int=\"%d\" % elapsed\n render :partial => \"progress\", :locals => { :progress_int => @@test, :done_int =>@@done, :elapsed_int =>@@elapsed_int }\n end",
"def dump_progress(done, dumpfile)\n dump = Marshal.dump(done)\n open(dumpfile, 'wb') do |file|\n gzip = Zlib::GzipWriter.new(file)\n gzip.write(dump)\n gzip.close\n end\nend",
"def completed\n end",
"def update_progress\n if logged_in?\n find_record(params[:post_id])\n @read_progress.update(progress: param[:progress])\n end\n end",
"def overall_progress\n userId = params[:id]\n\n result = @progressService.overall_progress(userId)\n\n render status: result.status,\n json: {\n info: result.info,\n overall_progress: result.object\n }\n end",
"def perform_work\n object_client.notify_goobi\n end",
"def completed()\n end",
"def update_progress(page)\n unless page.nil?\n p = page.to_i\n if p > 0 && p <= self.page\n self.page = p\n self.save\n end\n end\n end",
"def update\n @progress = Progress.find(params[:id])\n\n respond_to do |format|\n if @progress.update_attributes(params[:progress])\n format.json { head :no_content }\n else\n format.json { render json: @progress.errors, status: :unprocessable_entity }\n end\n end\n end",
"def use_progress_bar?; true end",
"def progress\n total_steps_count = self.steps.count\n\n if total_steps_count.zero?\n 0.0\n else\n approved_steps_count = self.steps.where(state: 'approved').count\n (approved_steps_count * 100.0 / total_steps_count).round(2)\n end\n end",
"def completed_it\n self.complete = true\n end",
"def calculate_progress\n result = self.progress_status\n (100 * result.values.count(true) / result.values.compact.count).to_s\n end",
"def update_evaluation\n evaluation = Evaluation.find(self.evaluation_id)\n progress_h = ActiveSupport::JSON.decode evaluation.progress\n c_id = self.id.to_s\n progress_h[c_id] = self.progress\n \n evaluation.update(progress: ActiveSupport::JSON.encode(progress_h))\n end",
"def inc_progress(activity_rank)\n #diff = (@rank - activity_rank).abs\n ranks = [-8,-7,-6,-5,-4,-3,-2,-1,1,2,3,4,5,6,7,8]\n true_diff = ranks.index(activity_rank) - ranks.index(@rank)\n if true_diff < 0\n if true_diff <= -2\n nil\n else\n @progress += 1\n end\n elsif true_diff == 0\n @progress += 3\n else\n @progress += (10*true_diff*true_diff)\n end\n while @progress >= 100\n self.increase_rank\n @progress -= 100\n end\n end",
"def observe(bar)\n bar.on(:progress, &progress_handler)\n .on(:done) { emit(:done) if complete? }\n .on(:stopped) { emit(:stopped) if stopped? }\n .on(:paused) { emit(:paused) if paused? }\n end",
"def progressValue\n return @progressValue\n end",
"def blockchain_progress(opts = {})\n data, _status_code, _headers = blockchain_progress_with_http_info(opts)\n data\n end",
"def inc number=0.0\n\t\t@progress_bar.fraction = (@prog += number)\n\tend"
] | [
"0.8604498",
"0.75670207",
"0.75670207",
"0.75670207",
"0.75670207",
"0.75670207",
"0.7191726",
"0.711232",
"0.7026493",
"0.68502414",
"0.670864",
"0.670864",
"0.670864",
"0.670864",
"0.65755165",
"0.64679164",
"0.6450984",
"0.6400881",
"0.63445646",
"0.63321525",
"0.6274677",
"0.6268279",
"0.62679255",
"0.6236283",
"0.6236283",
"0.6236283",
"0.61986256",
"0.61778075",
"0.6158279",
"0.6150006",
"0.6135152",
"0.6129524",
"0.6128345",
"0.61174154",
"0.6104086",
"0.6086265",
"0.6037159",
"0.6020262",
"0.601725",
"0.5990588",
"0.5983944",
"0.5962623",
"0.5956264",
"0.59481436",
"0.5947692",
"0.5945298",
"0.5938428",
"0.5929541",
"0.5924693",
"0.5921104",
"0.589434",
"0.5861923",
"0.5855652",
"0.58531123",
"0.58153385",
"0.58153385",
"0.5777459",
"0.57758504",
"0.5768584",
"0.57657933",
"0.57415473",
"0.57412404",
"0.57412404",
"0.56906444",
"0.5690073",
"0.568621",
"0.5680116",
"0.5679131",
"0.56758696",
"0.56645113",
"0.56557155",
"0.564685",
"0.56069654",
"0.55981684",
"0.5594894",
"0.55883443",
"0.55879813",
"0.5578761",
"0.5557821",
"0.5540485",
"0.55327266",
"0.5522045",
"0.55054146",
"0.5491666",
"0.5478573",
"0.5471284",
"0.54695225",
"0.5455958",
"0.5420927",
"0.54136634",
"0.5408976",
"0.54086566",
"0.5405906",
"0.5399979",
"0.5394579",
"0.5392333",
"0.538589",
"0.5384238",
"0.5383842",
"0.53803927"
] | 0.7809453 | 1 |
This is tricky because we often don't have an :id | def show_city_cache
a = "cities/#{params[:id]}/buses/#{params[:buses]}/sell_locations/#{params[:sell_locations]}"
#a = {city_domain: (params[:id] || request.host), buses: params[:buses]}
#a = {id: (params[:id] || request.host), buses: params[:buses]}
L.l a
a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; 1; end",
"def id; 1; end",
"def id\n #NOOP\n end",
"def id\n key?(:id) ? method_missing(:id) : nil\n end",
"def id\n attribute('id', 'id')\n end",
"def real_id\n @id\n end",
"def real_id\n @id\n end",
"def urn_id; :id end",
"def urn_id; :id end",
"def id\n return self[:id]\n end",
"def id\n get_val(:id)\n end",
"def id?\n true\n end",
"def find(id); end",
"def find(id); end",
"def id_param_keys\n %i[selected id]\n end",
"def id\n __id\n end",
"def id() end",
"def id_number; end",
"def id\n read_attr :id\n end",
"def id=(_arg0); end",
"def id=(_arg0); end",
"def id=(_arg0); end",
"def id\n _id rescue nil\n end",
"def id\n @id\n end",
"def id\n @id\n end",
"def id\n nil\n end",
"def id\n nil\n end",
"def id\n nil\n end",
"def id\n nil\n end",
"def id\n nil\n end",
"def id\n nil\n end",
"def id\n nil\n end",
"def id\n nil\n end",
"def id\n nil\n end",
"def id\n self[:id]\n end",
"def id ; @record.id if @record ; end",
"def id?\n @kind == :id\n end",
"def id\n object[\"id\"]\n end",
"def id\n self[:id]\n end",
"def id\n key\n end",
"def id\n read_attr :id, :to_sym\n end",
"def id\n 1\n end",
"def id\n data[:id]\n end",
"def id\n object.id\n end",
"def id\n object.id\n end",
"def id\n attributes[:id] \n end",
"def id; self['_id']; end",
"def id\n raise NotImplementedError\n end",
"def id\n self['id']\n end",
"def id\n self['id']\n end",
"def id\n @obj['id']\n end",
"def id\n object.to_param\n end",
"def id\n object_id\n end",
"def id\n id = attr('id')\n return id unless id == \"\"\n \n @@element_id_count += 1\n id = \"red_query_elem_#{@@element_id_count}\"\n attr('id', id)\n return id\n end",
"def get_id\n @id\n end",
"def get_id\n @id\n end",
"def get_id\n @id\n end",
"def get_id\n @id\n end",
"def key\n id\n end",
"def id\n return @id\n end",
"def id\n nil\n end",
"def id\n nil\n end",
"def id_or_param(id)\n id = id.to_param if id.respond_to?(:to_param)\n id\nend",
"def by_id(id)\n raise NotImplementedError.new\n end",
"def fields\n [:id]\n end",
"def id_check(el, id, base)\n if NC_REGEXP.match(id)\n # ID may only be specified once for the same URI\n if base\n uri = URIRef.intern(\"##{id}\", base, :normalize => false)\n if @id_mapping[id] && @id_mapping[id] == uri\n warn = \"ID addtribute '#{id}' may only be defined once for the same URI\"\n add_debug(el, warn)\n raise RdfContext::ParserException.new(warn) if @strict\n end\n \n @id_mapping[id] = uri\n # Returns URI, in this case\n else\n id\n end\n else\n warn = \"ID addtribute '#{id}' must be a NCName\"\n add_debug(el, \"ID addtribute '#{id}' must be a NCName\")\n add_debug(el, warn)\n raise RdfContext::ParserException.new(warn) if @strict\n nil\n end\n end",
"def id\n nil\n end",
"def id_finder\n @id_finder ||= extract_id ? :all_of : :where\n end",
"def id()\n #This is a stub, used for indexing\n end",
"def extract_id\n selector[:_id]\n end",
"def id\n @id\n end",
"def id\n @id\n end",
"def id\n @id\n end",
"def id\n @id\n end",
"def id\n\t\t@id\n\tend",
"def id\r\n @id\r\n end",
"def __id; @id || @obj.id; end",
"def id\n @attributes[:id]\n end",
"def id\n @attributes[:id]\n end",
"def id\n @attributes[:id]\n end",
"def id\n @attributes[:id]\n end",
"def id\n @attributes[:id]\n end",
"def id\n @attributes[:id]\n end",
"def id\n @attributes[:id]\n end",
"def id\n @attributes[:id]\n end",
"def id\n @attributes[:id]\n end",
"def id\n @attributes[:id]\n end",
"def id\n @attributes[:_id]\n end",
"def id?\n @id\n end"
] | [
"0.67228305",
"0.67228305",
"0.67228305",
"0.67228305",
"0.67228305",
"0.67228305",
"0.67228305",
"0.67228305",
"0.67228305",
"0.67228305",
"0.67228305",
"0.67228305",
"0.66253126",
"0.6622684",
"0.656023",
"0.65573955",
"0.653105",
"0.650574",
"0.650574",
"0.6500587",
"0.6500587",
"0.6432739",
"0.6429267",
"0.63381386",
"0.6318866",
"0.6318866",
"0.6315637",
"0.6303328",
"0.62988186",
"0.62833655",
"0.62832546",
"0.62754744",
"0.62754744",
"0.62754744",
"0.6241325",
"0.6241281",
"0.6241281",
"0.6241203",
"0.6241203",
"0.6241203",
"0.6241203",
"0.6241203",
"0.6241203",
"0.6241203",
"0.6241203",
"0.6241203",
"0.6230624",
"0.6229327",
"0.62034863",
"0.61968267",
"0.61884886",
"0.6156968",
"0.6148658",
"0.614818",
"0.61452794",
"0.61325157",
"0.61325157",
"0.61323416",
"0.61321574",
"0.6125698",
"0.61200756",
"0.61200756",
"0.61184627",
"0.6114579",
"0.6110829",
"0.6107482",
"0.61072576",
"0.61072576",
"0.61072576",
"0.61072576",
"0.6095896",
"0.6093015",
"0.6084438",
"0.6084438",
"0.6077914",
"0.6077324",
"0.6071714",
"0.60609376",
"0.60456824",
"0.6037748",
"0.6022146",
"0.6019929",
"0.60163033",
"0.60163033",
"0.60163033",
"0.60163033",
"0.6014849",
"0.6011243",
"0.600634",
"0.5986571",
"0.5986571",
"0.5986571",
"0.5986571",
"0.5986571",
"0.5986571",
"0.5986571",
"0.5986571",
"0.5986571",
"0.5986571",
"0.5981689",
"0.5978329"
] | 0.0 | -1 |
def redirect_to_user_city if params[:redirect] and user_city return redirect_to city_url(user_city) end end | def collection
@city ||= end_of_association_chain.ordered.visible
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redirect_place #returns the place to redirect to based on origin\n if safe_params[:origin] == \"individual\"\n return (tournament_path(@tournament) + '/registration/individual');\n elsif safe_params[:origin] == \"teams\"\n return (tournament_path(@tournament) + '/control/teams');\n else\n puts(\"Hack ###\");\n redirect_to root_path;\n return;\n end\n end",
"def doctor_user\n redirect_to(doctor_page_url) if current_user.doctor?\n end",
"def redirect_place #returns the place to redirect to based on origin\n if safe_params[:origin] == \"individual\"\n return (tournament_path(@tournament) + '/registration/individual');\n elsif safe_params[:origin] == \"adjudicators\"\n return (tournament_path(params[:id]) + '/control/adjudicators');\n else\n puts(\"Hack ###\");\n redirect_to root_path;\n return;\n end\n end",
"def doctor_user\n redirect_to(doctor_page_url) if current_user.doctor?\n end",
"def redirect_to_station_path\n case current_user.station\nwhen \"milimani family\" then redirect_to 'http://10.66.110.15:81/courtstations/1/casefiles'\n\n\n\nend\nend",
"def redirect?; end",
"def create\n\n city = City.find(params[:user_city])\n respond_to do |format|\n if city\n session[:user_city] = params[:user_city]\n session[:user_location] = nil\n session[:user_dish] = nil\n format.html { redirect_to(locations_path(:city_id => city), :notice => 'Your current city was successfully set.') }\n format.xml { render :xml => @user_city, :status => :created, :city => @user_city }\n else\n logger.error \"Could not set :user_city from #{params[:user_city]}\"\n return\n end\n end\n end",
"def correct_user\n @location = current_user.locations.find_by(id: params[:id])\n redirect_to root_url if @location.nil?\n end",
"def custom_redirect\n redirect_to('https://carto.com/signin/') if CartoDB.extract_subdomain(request) == 'developers'\n end",
"def redirect\n redirect_to volunteershome_url if current_user.volunteer?\n redirect_to serviceusershome_url if current_user.service_user?\n show_browser_alert\n end",
"def show\n redirect_to_default_page_if_no_city(\"First create the ship\")\n end",
"def office_user\n redirect_to(office_page_url) if current_user.office?\n end",
"def login_redirect(user, url)\n auto_login(user)\n redirect_to url\n end",
"def redirect_from_params\n if params[:redirect_to]\n redirect_to params[:redirect_to]\n end\n end",
"def office_user\n redirect_to(office_page_url) if current_user.office?\n end",
"def redirect_url; end",
"def test_redirect_url\n common_opts = {}\n if user_is_in_proper_account?\n Rails.application.routes.url_helpers.workplace_start_path(common_opts.merge({success: true, refresh: true}))\n elsif UserSession.find\n Rails.application.routes.url_helpers.workplace_failure_path(common_opts.merge({network: params[:network], wrong_network: true}))\n else\n Rails.application.routes.url_helpers.identity_provider_path(common_opts.merge({network: params[:network], fb_workplace_network: false}))\n end\n end",
"def set_city\n if current_user.is_admin\n # @city = City.find(params[:id])\n @city = City.friendly.find(params[:id])\n else\n redirect_to dashboard_index_path, alert: 'You don\\'t have permission to do that.'\n end\n end",
"def redirect_path_for(user)\n requested_path = session.delete(:requested_path)\n requested_path_from_cookie = cookies.delete(:requested_path)\n if requested_path_from_cookie\n requested_path_from_cookie\n elsif requested_path\n requested_path\n elsif user.courses.any?\n root_path\n else\n root_path\n end\n end",
"def redirect_back_or(default)\n #forwarding_url = session[:forwarding_url] if \"#{session[:forwarding_url]}\".include? \"users/#{@user.id}/edit\" #URL CONTAINS MANY NUMBERS REMMEBER!\n if !session[:forwarding_url].nil? \n forwarding_url = edit_user_path @user #session[:forwarding_url] chenged from this to redirec to edit no matter what edit one was trying to access\n end\n redirect_to(forwarding_url || default) # review this notation; nill if previous statement false (goes to default)\n delete_store\n end",
"def patient_user\n redirect_to(patient_page_url) if current_user.patient?\n end",
"def redirect_to_user_page\n if teacher_signed_in?\n redirect_to :controller => 'search'\n elsif volunteer_signed_in?\n redirect_to :controller => 'conversations'\n end\n end",
"def create\n redirect_to ctos_path :myLocation=>params[:myLocation],:radius=>params[:radius], :page=>params[:page]\n end",
"def redirect\n if params[:role] == \"restaurant\"\n redirect_to :action => \"new\", :invitation => { :first_name => params[:first_name], :last_name => params[:last_name], :email => params[:email] }\n elsif params[:role] == \"media\"\n redirect_to :controller => \"mediafeed/media_users\", :action => \"new\", :user => { :first_name => params[:first_name], :last_name => params[:last_name], :email => params[:email] }\n end\n end",
"def patient_user\n redirect_to(patient_page_url) if current_user.patient?\n end",
"def redirect(url); end",
"def get_location_or_redirect(options = {})\n redirect_to(options) if get_location() == nil\n end",
"def redirect_to_default_page_if_no_city(note)\n if(@city.blank?)\n respond_to do |format|\n format.html { redirect_to new_city_url, notice: note }\n format.json { head :no_content }\n end\n end\n end",
"def redirect_to_stored_or_default(default)\n if session['return-to'].nil?\n redirect_to default\n else\n redirect_to_url session['return-to']\n session['return-to'] = nil\n end\nend",
"def redirect_to_origin(opts = {})\n if params[:ret].present?\n redirect_to params[:ret], opts\n else\n redirect_to opts.merge!(action: :index)\n end\n end",
"def store_location\n session[:user_return_to] = request.url if request.get? and controller_name != \"sessions\" and controller_name != \"registrations\" and controller_name != \"omniauth_callbacks\"\n end",
"def redirect_to_stored_location_or(default)\n redirect_to(session[:forward_url] || default)\n session.delete(:forward_url)\n end",
"def change_user\n store_location(params[:return_to]) if params[:return_to]\n destroy_session\n redirect_to \"/sign_in\"\n end",
"def logged_in_user_or_customer\n unless user_logged_in? || customer_logged_in?\n store_location\n flash[:danger] = 'Please log in.'\n redirect_to login_url\n end\n end",
"def redirect_if_not_logged_in\n #redirect the user if the user is not logged in\n end",
"def legacy_redirect\n community = Community.where(\"lower(legacy_url) = ?\", params[:legacy_community_name].to_s.downcase).first\n \n if community\n redirect_to community, status: 301\n elsif college = College.where(\"lower(short_name) = ?\", params[:legacy_college_name].to_s.downcase).first\n redirect_to college, status: 301\n else\n flash[:notice] = \"The link you clicked is out of date! We couldn't figure out where you wanted to go...\"\n redirect_to listings_url, status: 301\n end\n end",
"def redirect_to_url(callback_url)\n client_details = \"client_id=#{self.client_id}\"\n return callback_url + \"?#{client_details}\"\n end",
"def store_location\n session[:redirect_url] = params[:redirect_url] if params[:redirect_url]\n session[:role] = params[:role] if params[:role]\n end",
"def redirect\n redirect_to @goto_url\n end",
"def authorize_redirect\n \tif session[:user_id]\n\t\tredirect_to :controller => 'home'\n \tend\n end",
"def redirect_to_terms_and_conditions\n if current_user && !current_user.current_tc? && !params[:redirected]\n redirect_to root_url(:redirected => true)+\"#!\"+edit_acceptance_path\n end\n end",
"def redirect_if_logged_in\n if logged_in?\n redirect \"/users/#{current_user.id}\"\n end\n #def redirect_if_logged_in_as_someone_else\n #end\n end",
"def redirect_login(url)\n redirect_to(redirect_login_url(url))\n end",
"def choose_location\n params[:location_id] || current_user.location_id\n end",
"def redirect_user_to_country_site(subdomain)\n redirect_to(\"http://#{subdomain}.#{Rails.application.config.main_domain}#{request.fullpath}\")\n return\n end",
"def city\n if !session[:user_id].nil?\n if params[:city] == \"new\"\n redirect_to :controller => :listings, :action => :req\n else\n if params[:city] == \"sf\"\n @city = \"San Francisco\"\n elsif params[:city] == \"ny\"\n @city = \"New York\"\n end\n @listings = Listing.find_all_by_city(@city)\n @categories ||= Array.new\n @listings.each do |l|\n if([email protected]?(l.category))\n @categories.push(l.category)\n end\n end\n end\n else\n redirect_to :controller => :user, :action => :login\n end\n end",
"def store_location\n # after registration is another special case - do not redirect to \"current page\"\n session[:user_return_to] = request.url unless [\"devise/passwords\", \"devise/sessions\", \"devise/registrations\"].include?(params[:controller])\n end",
"def require_correct_user\n if session[:donor_id]\n user = Donor.find(params[:id])\n end\n if session[:charityRep_id]\n user = CharityRep.find(params[:id])\n # binding.pry - adds a breakpoint to debug in console\n end\n redirect_to \"/\" if current_user != user || current_user == nil\n end",
"def login_required\n return true if session[:affiliate]\n\n # store current location so that we can \n # come back after the user logged in\n store_location\n redirect_to :action =>\"login\" and return false \n end",
"def redirect_ok; end",
"def redirect_ok; end",
"def set_user_city\n @user_city = UserCity.find(params[:id])\n end",
"def create\n city = Post.new(city_params)\n city.user_id = user_id\n if city.save\n redirect_to user_path user.username\n end\n end",
"def filter_redirect; end",
"def filter_redirect; end",
"def require_user\r\n if ##LOGIC##\r\n redirect_to '/user/sign_in'\r\n end\r\n end",
"def login_required\n if session[:customer]\n return true\n end\n\n # store current location so that we can \n # come back after the user logged in\n store_location\n \n redirect_to :action =>\"login\" and return false \n end",
"def redirect_back_or_to(url)\n if session[:return_url]\n redirect_to session[:return_url]\n session[:return_url] = nil\n else\n redirect_to url\n end\n end",
"def product_revenue\n p '#{request.referer}'\n redirect_to \"http://www.google.com\" ,status: 301\n end",
"def org_redirection_method\n if org_present?\n redirect_to root_path if org_controller?\n else\n redirect_to new_organization_path unless org_controller?\n end\n end",
"def validate_merchant\n redirect_to merchants_login_path unless is_merchant_logged_in?\n end",
"def farmer_redirect_check\n if session[:farmer_id] && current_user\n return true\n else\n redirect_to login_path\n end\n end",
"def update\n\ncity = City.find params[:id]\n\ncity.update(\n name: params[:city][:name],\n population: params[:city][:population],\n best_food: params[:city][:best_food],\n image_url: params[:city][:image_url],\n must_see: params[:city][:must_see],\n image_url_see: params[:city][:image_url_see]\n)\n\nredirect_to city_path(city.id)\n\nend",
"def redirect_to_user_home\n redirect_to :controller=>'virtual_machines', :action=>'index'\n end",
"def user_session_redirect_url(url)\n # Work with what we have\n case\n when url.present?\n url\n when request.referer.present?\n request.referer\n else\n root_url\n end\n end",
"def safe_redirect(url)\n url ||= '/explore'\n url = url_for(url) if url.is_a?(Hash)\n return url if RAILS_ENV == 'development' || RAILS_ENV == 'test'\n # Remember that kroogi.eu (and many more) is/are just as valid as kroogi.com. AND, we have krugi.net ...\n return url if url && (url.starts_with?('/') || kroogi_url?(url))\n return url\n #raise Kroogi::NotPermitted, url\n end",
"def follow_redirect?; end",
"def my\n redirect_to kases_person_path(@person), :status => :moved_permanently\n return\n end",
"def redirect_user_to_dashboard\n redirect_to dashboard_path if current_contact\n end",
"def require_login\n if session[:donor_id]\n # binding.pry\n redirect_to '/' if session[:donor_id] == nil\n end\n if session[:charityRep_id]\n redirect to '/' if session[:charityRep_id] == nil\n end\n end",
"def redirect_to_login\n\n redirect_to('/login')\n\n end",
"def redirects_to_page\n nil\n end",
"def redirects_to_page\n nil\n end",
"def redirect_returning_user(pathway, options = {})\n params = {}\n case pathway\n\t when \"gift_sent\"\n params[:action] = \"show_organization\"\n params[:organization_id] = options['organization_id']\n\t when \"self\"\n params[:action] = \"give_gift_self\"\n params[:gift_template_id] = options['gift_template_id']\n\t when \"friend\"\n params[:action] = \"give_gift_friends\"\n params[:gift_template_id] = options['gift_template_id']\n\t else\n\t\t flash[:notice] = \"We're sorry, but something went wrong. Please try again.\"\n params[:action] = \"index\"\n\t end\n redirect_to(params) and return\n end",
"def prev_location # :nologin: :norobots:\n redirect_to_next_object(:prev, Location, params[:id].to_s)\n end",
"def redirects; end",
"def set_redirect\n @redirect = params[:origin_url] == nil ? bookmarks_path : params[:origin_url]\n end",
"def redirect_if_not_logged_in\n redirect_to login_path unless logged_in?\n end",
"def store_current_location\n # To redirect to the url user hit before signin.\n store_location_for(:user, request.url)\n # devise handles redirect after sign in using session[:user_return_to]\n # updating redirect url for api\n session[:user_return_to] = params[:redirect_url] if params['redirect_url'].present?\n end",
"def redirect_path\n organization_path(self)\n end",
"def redirect_back_or_default(default = root_url(:protocol => \"http\"))\n # be sure we aren't returning the login, register or logout page\n if valid_return_to_url\n url = CGI.unescape(return_to_url)\n url = {:controller => url, :protocol => \"http\"} unless url.match(\"://\")\n redirect_to(url)\n else\n redirect_to(default)\n end\n store_location(nil)\n return false\n end",
"def redirect_if_logged_in\n if current_user && session[:url_on_missing_user_session]\n url = session[:url_on_missing_user_session]\n session[:url_on_missing_user_session] = nil\n redirect_to url\n end\n end",
"def correct_comite\n @comite = Comite.find(params[:id])\n redirect_to \"/comites\" unless @comite.id == current_comite.id\n end",
"def store_redirect\n if params.key?(:redirect)\n store_redirect_url_for(params[:redirect], request.referer)\n end\n end",
"def redirect_to_referer_or_default(default)\n\t\tredirect_to( session[:refer_to] || \n\t\t\trequest.env[\"HTTP_REFERER\"] || default )\n\t\tsession[:refer_to] = nil\n\tend",
"def redirect_to_target(default=nil)\n \n goto_url=params[:return_to] || session[:return_to] || default || \"/\"\n \n session[:return_to] = nil\n redirect_to(goto_url)\n end",
"def user_login\n unless logged_in?\n navigated_location #stores the location that was navigated before login\n flash[:alert]= \"You Must Be Log In Order To Access that Portion of the Site\" \n redirect_to login_path\n end\n end",
"def redirect_to url, options = {}\n\t\t\t\treturn super() if defined? super\n\t\t\t\turl = full_url_for(url, params) unless url.is_a?(String) || url.nil?\n\t\t\t\t# redirect\n\t\t\t\tresponse.redirect_to url, options\n\t\t\tend",
"def store_location\n session[:redirect] = request.url\n end",
"def redirect_back_or_default(default)\n redirect_to url_for_redirect(default)\n end",
"def redirect_back_or_default(default)\n redirect_to(default)\n end",
"def store_location\n store_location_for(:user, params[:redirect_to]) if params[:redirect_to].present?\n\n # note: don't store the previous url on each call. this led to an issue where\n # missing asset might get run through this code, causing the user to be redirected\n # to the missing asset during a login\n # session[:previous_url] = request.url if request.url != new_user_session_url\n end",
"def redirect_if_single_result\n redirect_to asq_path(one_result) if one_result\n end",
"def redirect_back_or(default)\n #send back to what was stored in\n #\"session[:return_to] or default location\n redirect_to(session[:return_to] || default)\n #deletes saved return location\n session.delete(:return_to)\n end",
"def redirect_to_path(path)\n redirect_to path\n end",
"def login_user_and_redirect(user,redirect=nil)\n if user.active?\n user.last_login = Time.now\n Extender::Activities.day_activity(user)\n user.save\n session[:cuid] = user.id\n else\n flash[:notice] = t(\"users.email_not_exists_or_blocked\")\n end\n\n if redirect.blank? || redirect == login_index_url\n redirect_to root_url\n else\n redirect_to redirect\n end\n end",
"def redirect_back_or(default)\n #redirect_to(session[:forwarding_url] || default)\n #session.delete(:forwarding_url)\n end",
"def require_user \n redirect(to('/')) unless current_user \nend",
"def redirect_to_forwarding_url_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n end",
"def validate_location\n\n if params[:location_id]\n location ||= (Location.find_by(slug: params[:location_id]) || Location.find_by(id: params[:location_id]))\n else\n location ||= (Location.find_by(slug: params[:id]) || Location.find_by(id: params[:id]))\n end\n\n redirect_to root_path unless location\n end",
"def my_redirect url \r\n session[:plugin_redirection] = true if is_request_from_plugin?()\r\n redirect_to(url)\r\n end"
] | [
"0.6844658",
"0.68416417",
"0.68363196",
"0.6830071",
"0.6822103",
"0.65143234",
"0.6478576",
"0.64067507",
"0.6383761",
"0.6354633",
"0.6353494",
"0.6351806",
"0.6340754",
"0.63127124",
"0.62580705",
"0.62419176",
"0.6209978",
"0.61982346",
"0.6175846",
"0.6175812",
"0.6165059",
"0.6160013",
"0.6158538",
"0.614292",
"0.61335415",
"0.6132326",
"0.61120635",
"0.6111886",
"0.60990614",
"0.6081539",
"0.60517967",
"0.6049878",
"0.6047925",
"0.6033162",
"0.60284394",
"0.60263234",
"0.60190314",
"0.60100174",
"0.59900695",
"0.59776026",
"0.5975761",
"0.59561324",
"0.5954735",
"0.5928414",
"0.5920839",
"0.59075874",
"0.58981955",
"0.5882462",
"0.5875296",
"0.5873945",
"0.5873945",
"0.5869198",
"0.58672696",
"0.5862228",
"0.5862228",
"0.5855453",
"0.5852275",
"0.5839467",
"0.5822979",
"0.58224213",
"0.58178765",
"0.58080155",
"0.5807782",
"0.58050746",
"0.58021164",
"0.5792317",
"0.57901317",
"0.5782898",
"0.5764749",
"0.57604676",
"0.5757741",
"0.5747291",
"0.5747291",
"0.57367265",
"0.57341266",
"0.57328045",
"0.5732205",
"0.57311565",
"0.5727625",
"0.5720521",
"0.57203096",
"0.5713742",
"0.56999254",
"0.56988496",
"0.56929094",
"0.56873333",
"0.56864077",
"0.56817377",
"0.5681566",
"0.56806064",
"0.5680199",
"0.5679779",
"0.5677757",
"0.56765854",
"0.56728077",
"0.5669682",
"0.56689334",
"0.5668047",
"0.5667012",
"0.5665054",
"0.56612897"
] | 0.0 | -1 |
def create_stripe_customer_and_subscription(user) begin s_customer = Stripe::Customer.create(description: user.first_name, card: self.stripe_card_token,email: user.email) stripe_customer = StripeCustomer.create(object: s_customer.object, description: s_customer.description, livemode: s_customer.livemode, created_timestamp: s_customer.created, reference_id: s_customer.id, user_id: self.user_id) customer = Stripe::Customer.retrieve(stripe_customer.reference_id) user.plan_name = "school_closing" user.plan = "daily" if user.plan_name == "school_closing" && user.plan == "daily" | def create_stripe_customer_and_subscription(user)
begin
s_customer = Stripe::Customer.create(description: user.first_name, card: self.stripe_card_token, email: user.email)
stripe_customer = StripeCustomer.create(object: s_customer.object, description: s_customer.description, livemode: s_customer.livemode, created_timestamp: s_customer.created, reference_id: s_customer.id, user_id: self.user_id)
customer = Stripe::Customer.retrieve(stripe_customer.reference_id)
if user.plan_name == "school_closing_date" && user.plan == "daily"
stripe_charge = Stripe::Charge.create(amount: stripe_charge_amount(user), currency: "usd", customer: s_customer.id, description: "school_closing daily")
user.stripe_charges.create(amount: stripe_charge_amount(user), currency: "usd", description: "test", stripe_customer_id: stripe_customer.id)
elsif user.plan_name == "school_closing_date" && user.plan == "all_days"
stripe_charge = Stripe::Charge.create(amount: stripe_all_dates, currency: "usd", customer: s_customer.id, description: "school_closing all days")
user.stripe_charges.create(amount: stripe_all_dates, currency: "usd", description: "test", stripe_customer_id: stripe_customer.id)
elsif user.plan_name == "christmas_break" && user.plan == "daily"
stripe_charge = Stripe::Charge.create(amount: stripe_charge_amount(user), currency: "usd", customer: s_customer.id, description: "xmas daily")
user.stripe_charges.create(amount: stripe_charge_amount(user), currency: "usd", description: "test", stripe_customer_id: stripe_customer.id)
elsif user.plan_name == "christmas_break" && user.plan == "all_days"
stripe_charge = Stripe::Charge.create(amount: stripe_all_dates, currency: "usd", customer: s_customer.id, description: "Xmas all days")
user.stripe_charges.create(amount: stripe_all_dates, currency: "usd", description: "test", stripe_customer_id: stripe_customer.id)
elsif user.plan_name == "spring_break" && user.plan == "daily"
stripe_charge = Stripe::Charge.create(amount: stripe_charge_amount(user), currency: "usd", customer: s_customer.id, description: "spring break daily")
user.stripe_charges.create(amount: stripe_charge_amount(user), currency: "usd", description: "test", stripe_customer_id: stripe_customer.id)
elsif user.plan_name == "spring_break" && user.plan == "all_days"
stripe_charge = Stripe::Charge.create(amount: stripe_all_dates, currency: "usd", customer: s_customer.id, description: "spring break all days")
user.stripe_charges.create(amount: stripe_all_dates, currency: "usd", description: "test", stripe_customer_id: stripe_customer.id)
elsif user.plan_name == "charlotte" || user.plan_name == "noresmen_cheer"
stripe_charge = Stripe::Charge.create(amount: stripe_football_amount(user), currency: "usd", customer: s_customer.id, description: "Charge For Charlotte")
user.stripe_charges.create(amount: stripe_football_amount(user), currency: "usd", description: "Charlotte", stripe_customer_id: stripe_customer.id)
elsif user.plan_name == "eden" || user.plan_name == "noresmen_cheer"
stripe_charge = Stripe::Charge.create(amount: stripe_football_amount(user), currency: "usd", customer: s_customer.id, description: "Charge for Eden")
user.stripe_charges.create(amount: stripe_football_amount(user), currency: "usd", description: "Eden", stripe_customer_id: stripe_customer.id)
elsif user.plan_name == "early_bird" || user.plan_name == "norsemen_baseball"
stripe_charge = Stripe::Charge.create(amount: stripe_early_bird_amount(user), currency: "usd", customer: s_customer.id, description: "EarlyBird")
user.stripe_charges.create(amount: stripe_early_bird_amount(user), currency: "usd", description: "EarlyBird", stripe_customer_id: stripe_customer.id)
elsif user.plan_name == "wffull" || user.plan_name == "norsemen_baseball"
stripe_charge = Stripe::Charge.create(amount: stripe_wffull_amount(user), currency: "usd", customer: s_customer.id, description: "WFF FULL DAY")
user.stripe_charges.create(amount: stripe_wffull_amount(user), currency: "usd", description: "WFF FULL", stripe_customer_id: stripe_customer.id)
elsif user.plan_name == "wffhalf" || user.plan_name == "norsemen_baseball"
stripe_charge = Stripe::Charge.create(amount: stripe_wffhalf_amount(user), currency: "usd", customer: s_customer.id, description: "WFF HALF DAY")
user.stripe_charges.create(amount: stripe_wffhalf_amount(user), currency: "usd", description: "WFF HALF DAY", stripe_customer_id: stripe_customer.id)
elsif user.plan_name == "nonfull" || user.plan_name == "norsemen_baseball"
stripe_charge = Stripe::Charge.create(amount: stripe_nonfull_amount(user), currency: "usd", customer: s_customer.id, description: "NON FULL DAY")
user.stripe_charges.create(amount: stripe_nonfull_amount(user), currency: "usd", description: "NON FULL DAY", stripe_customer_id: stripe_customer.id)
elsif user.plan_name == "nonhalf" || user.plan_name == "norsemen_baseball"
stripe_charge = Stripe::Charge.create(amount: stripe_nonhalf_amount(user), currency: "usd", customer: s_customer.id, description: "NON HALF DAY")
user.stripe_charges.create(amount: stripe_nonhalf_amount(user), currency: "usd", description: "NON HALF DAY", stripe_customer_id: stripe_customer.id)
else
subscription = customer.subscriptions.create(:plan => payment_discount(user.plan_name))
user.subscriptions.create(stripe_card_token: subscription.id,plan_name: user.plan_name, stripe_customer_id: stripe_customer.id)
end
rescue Exception => e
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_subscription\n subscription = nil\n stripe_call do\n local_plan = Plan.active.find(@params[:user][:plan_id])\n return false if local_plan.nil?\n stripe_plan = Stripe::Plan.retrieve(local_plan.stripe_id)\n # If the plan has a trial time, it does not need a stripe token to create a subscription\n # We assume you have a trial time > 0. Otherwise there will be 2 customers created for\n # each subscribed customer. One at registration and another when subscribing.\n subscription = customer.subscriptions.create(\n source: @params[:stripeToken],\n plan: stripe_plan.id\n )\n end\n return false if subscription.nil?\n\n user_attributes_to_update = {\n stripe_id: customer.id,\n stripe_subscription_id: subscription.id\n }\n assign_card_details(user_attributes_to_update, @params)\n @user.update(user_attributes_to_update)\n end",
"def subscribe\n # Find the user to pay.\n user = User.find( params[:id] )\n\n # Calculate the fee percentage that applies to\n # all invoices for this subscription.\n fee_percent = (Rails.application.secrets.fee_percentage * 100).to_i\n begin\n if user.stripe_customer_id\n customer = Stripe::Customer.retrieve(user.stripe_customer_id)\n customer.coupon = 'ahip200off'\n customer.save\n\n customer.subscriptions.create({:plan => params[:plan]})\n #customer.application_fee_percent = fee_percent\n # customer.save\n else\n # Create a customer and subscribe them to a plan\n # in one shot.\n # Normally after this you would store customer.id\n # in your database so that you can keep track of\n # the subscription status/etc. Here we're just\n # fire-and-forgetting it.\n customer = Stripe::Customer.create(\n {\n card: params[:token],\n email: current_user.email,\n plan: params[:plan],\n application_fee_percent: fee_percent,\n metadata: {name: user.name},\n # coupon: 'ahip200off',\n },\n user.secret_key\n )\n user.stripe_customer_id = customer.id\n user.save!\n\n end\n flash[:notice] = \"Subscribed! <a target='_blank' rel='app-owner' href='https://dashboard.stripe.com/test/customers/#{customer.id}'>View in dashboard »</a>\"\n\n rescue Stripe::CardError => e\n error = e.json_body[:error][:message]\n flash[:error] = \"Charge failed! #{error}\"\n end\n\n redirect_to user_path( user )\n end",
"def save_with_subscription\n #If user data passes validations, then call Stripe with user information\n #to get a new subscription created upon charging their card\n if valid?\n customer = Stripe::Customer.create(description: email, plan: plan_id, card: stripe_card_token)\n self.stripe_customer_token = customer.id\n save!\n end\n end",
"def create\n customer = Stripe::Customer.create({\n :description => current_user.id,\n :email => current_user.email,\n :card => params[:stripeToken],\n })\n\n current_user.stripe_id = customer.id\n current_user.save!\n\n Stripe::Charge.create(\n :customer => current_user.stripe_id,\n :amount => 250,\n :description => 'Fantasy Rocket Monthly Subscription',\n :currency => 'usd',\n )\n\n current_user.create_subscription!\n redirect_to params[:redirect_to] || root_url, notice: \"Thanks! You're now subscribed.\"\n rescue Stripe::CardError => e\n redirect_to new_subscriptions_url, alert: e.message\n end",
"def create_stripe_subscription!\n Stripe::Subscription.create(\n customer: create_stripe_customer!,\n tax_percent: Price::DEFAULT_TAX_RATE,\n trial_from_plan: store.eligible_for_trial_subscription?,\n items: [\n {plan: stripe_plan_id},\n ],\n metadata: {store: store.name}\n )\n end",
"def create\n params.permit(:interval, :plan, :stripeEmail, :stripeToken)\n if current_user\n @user = current_user\n begin\n customer = Stripe::Customer.create(\n :email => params[:stripeEmail],\n :source => params[:stripeToken],\n :plan => params[:plan]\n )\n if @user.plan.nil? || @user.plan != params[:plan]\n case params[:interval]\n when \"month\"\n active_date_increment = Time.now + 1.month\n when \"year\"\n active_date_increment = Time.now + 1.year\n when \"week\"\n active_date_increment = Time.now + 1.week\n end\n @user.update_attributes!(\n stripe_customer_id: customer.id,\n active_until: active_date_increment,\n plan: params[:plan],\n stripe_token: params[:stripeToken]\n )\n end\n redirect_to @user\n rescue\n puts \"Unable to register customer with Stripe: #{params[:stripeEmail]}\"\n flash[:alert] = \"There was an error processing the payment. Please try again.\"\n redirect_to plan_path(Stripe::Plan.retrieve(params[:plan]))\n end\n end\n end",
"def save_withsubscription\n if valid?\n customer = Stripe::Customer.create(description: email, plan: plan_id, card: stripe_card_token)\n self.stripe_card_token = customer.id\n save!\n end\n end",
"def subscribe!\n Subscription.transaction do\n subscription = create_stripe_subscription!\n store.subscriptions.create!(\n customer: user,\n stripe_plan_id: stripe_plan_id,\n stripe_id: subscription.id,\n first_date: Date.today,\n status: :active\n )\n end\n end",
"def save_with_subscription\n if valid?\n customer = Stripe::Customer.create(description: email, plan: plan_id, card: stripe_card_token)\n self.stripe_customer_token = customer.id\n save!\n end\n end",
"def create_stripe_subscription(card_details)\n @error = \"\"\n\t\tbegin\n\t\t\tcustomer = Stripe::Customer.create(\n\t\t\t\t:email => self.email,\n\t\t \t\t## if you are using the js to fetch the stripe_card_token change the ':card => card_details[\"stripe_card_token\"]' ##\n\t\t \t\t:card => {\n\t\t \t\t\t:number => card_details[\"card_number\"],\n\t\t \t\t\t:exp_month => card_details[\"exp_month\"],\n\t\t \t\t\t:exp_year => card_details[\"exp_year\"],\n\t\t \t\t\t:cvc => card_details[\"cvc\"]\n },\n\t\t\t :plan => card_details[\"plan_id\"]\n )\n\n \t\tputs \"==Customer_id : ====#{customer.id}============\"\n puts \"--------------User Model Stripe Customer Object: \" + customer.inspect\n @transaction = Transaction.new( :user_id => self.id,\n :payment_service => \"Stripe\",\n :trans_type => \"CreateStripeCustomer\",\n :stripe_id => customer.id,\n :last4 => customer.cards.data.first['last4'],\n :brand => customer.cards.data.first['brand'],\n :funding => customer.cards.data.first['funding'],\n :exp_month => customer.cards.data.first['exp_month'],\n :exp_year => customer.cards.data.first['exp_year']\n )\n unless @transaction.save\n puts \"-----UserModel - Stripe - Our Transaction Did Not Save on Stripe Fail\"\n end\n\n\t \trescue Stripe::StripeError => e\n logger.warn(\"====#{e.message}==\")\n puts \"====User-Model - Stripe Transaction Failed Due to #{e.message}=====\"\n @error = (\"card error: \" + e.message)\n # Transaction Error Record Created In Controller\n # @transaction = Transaction.new( :user_id => self.id,\n # :payment_service => \"Stripe\",\n # :trans_type => \"Failed\",\n # :stripe_callback_data => @error\n # )\n # unless @transaction.save\n # puts \"-----UserModel - Stripe - Our Transaction Did Not Save on Stripe Fail\"\n # end\n\t\tend\n\t\treturn @error\n\n end",
"def create_stripe_customer!\n Stripe::Customer.create(\n email: user.email,\n description: store.name,\n source: stripe_source_id\n )\n end",
"def create\n @subscription = Subscription.new(subscription_params)\n\n @subscription.sub_create(current_user,subscription_params[:stripe_plan_id],subscription_params[:coupon_code])\n\n # Create a subscription with the following information:\n #\n # 1) Customer Account\n # 2) Subscription Type (GOLD, Silver, etc.)\n # 3) Discount Coupom (if applicable)\n\n if @subscription.save\n redirect_to @subscription, notice: 'Subscription was successfully created.'\n else\n @verrors = @subscription.errors.full_messages\n render 'new'\n end\n end",
"def create\n plan = params[\"payment\"][\"plan\"]\n plan=\"premium_monthly\" if plan.empty?\n stripe_token = params[:payment][:stripe_customer_token]\n cardHolderName = params[\"cardHolderName\"]\n email = params[\"payment\"][\"email\"]\n flag = false\n\n if stripe_token\n begin\n @payment = current_user.payments.new(payment_params)\n customer = current_user.do_transaction(params[:payment_type], stripe_token, plan, cardHolderName, email)\n if customer\n @payment.stripe_customer_token = customer.id\n subcripted_detail = customer.subscriptions[\"data\"][0]\n flash[:notice] = 'Card charged successfully'\n else\n flag = true\n flash[:alert] = 'Some error happened while charging you, please double check your card details'\n end\n rescue Stripe::APIError => e\n flash[:alert] = e\n flag = true\n end\n else\n flag = true\n flash[:alert] = 'You did not submit the form correctly'\n end\n\n if flag\n render new_payment_path({plan: plan, error: e})\n end\n\n respond_to do |format|\n if @payment.save\n plan = Payment.plans[plan]\n current_user.update_attributes(subscription: plan, remaining_days: -1, stripe_customer_id: customer.id, is_paid_user: true)\n NotificationMailer.monthly_subscription_email(current_user, subcripted_detail).deliver_now\n format.html { redirect_to \"/users/edit\", notice: 'Payment made successfully.'}\n format.json { render json: @payment, status: :created, location: @payment }\n end\n end\n\n end",
"def create\n @new_sign_up = false #don't call alias again, but do call identify from here on\n Stripe.api_key = ENV['STRIPE_SECRET_KEY']\n\n unless ( params[:card].present? && params[:card][:card_number].present? &&\n params[:card][:exp_year].present? && params[:card][:exp_month].present? &&\n params[:card][:cvc].present? && params[:card][:plan_id].present? &&\n params[:phone].present? && params[:customer_card_name].present?\n )\n\n puts \"-----StripeCC - Missing Fields In Form\"\n flash.now[:alert] = \"Missing Details - All Fields are compulsory\"\n @name = params[:customer_card_name]\n @phone = params[:phone]\n render 'users/payment'\n return\n end\n\n \t\t@error = current_user.create_stripe_subscription(subscription_params)\n\n\t \tif @error.present?\n\t \t\tflash.now[:alert] = @error\n\t \t\tlogger.warn(\"=========Stripe Controller - Transaction Failure=========\")\n @transaction = Transaction.new( :user_id => current_user.id,\n :payment_service => \"Stripe\",\n :trans_type => \"Failed\",\n :stripe_callback_data => @error\n )\n unless @transaction.save\n puts \"-----StripeCC - Our Transaction Did Not Save on Stripe Fail\"\n end\n\n # back to payment screen:\n\t \t\trender 'users/payment'\n\n\t \telse #success\n\t \t\tflash.now[:notice] = \"Subscription Successfull\"\n\t \t\tlogger.warn(\"=========Transaction Successfull=========\")\n @transaction = Transaction.where(:user_id => current_user.id).order(\"id DESC\").first\n if @transaction.present?\n @transaction.update_attributes(\n :payment_service => \"Stripe\",\n :trans_type => \"Recurring\"\n )\n else\n puts \"-----StripeCC - Our Transaction Did Not Save on Stripe Success\"\n end\n\n namearray = (params[:customer_card_name]).split(' ', 2)\n save_user = current_user.update_attributes(:phone => (params[:phone]),\n :first_name => namearray.first, :last_name => namearray.last)\n puts \">>> current user did not save email and name.\" if save_user == false\n\n\t \t\tredirect_to submit_bill_path, :notice => \"Subscription Successful.\"\n\t end\n\n end",
"def save_with_subscription\n if valid?\n customer = Stripe::Customer.create(description: email, plan: plan_id, card: stripe_card_token)\n # save customer id in DB with response\n self.stripe_customer_token = customer.id \n # runs save\n save!\n end\n end",
"def update_card_and_new_subscription(token, plan, code) # plan is now a my_plan_id\n #should be a customer_id b/c downstream from option in which user has an existing stripe customer id\n c = Stripe::Customer.retrieve(current_user.customer_id)\n \n\n #updates customer with new card\n c.card = token\n c.save\n\n if !code.nil? && is_valid_sub_coupon(code) \n #create subscription for this customer in stripe (note that update_subscription creates a new subscription for this customer in this case)\n if has_not_trialed?\n c.update_subscription(:plan => plan, :coupon => code)\n else #this shouldn't happen b/c in an upstream controller, set code to nil if has_trialed\n c.update_subscription(:plan => plan, :trial_end => (Date.today + 1.day).to_time.to_i, :coupon => code)\n end \n else\n #create subscription for this customer in stripe (note that update_subscription creates a new subscription for this customer in this case)\n if has_not_trialed?\n c.update_subscription(:plan => plan)\n else\n c.update_subscription(:plan => plan, :trial_end => (Date.today + 1.day).to_time.to_i)\n end \n end \n\n rescue Stripe::InvalidRequestError => e\n logger.error \"Stripe error while creating customer: #{e.message}\"\n flash[:error] = \"There was a problem processing your credit card. #{e.message}. Please try again.\"\n false\n \n rescue Stripe::CardError => e\n logger.error \"Stripe error while creating customer: #{e.message}\"\n flash[:error] = \"There was a problem processing your credit card. #{e.message}. Please try again.\"\n false\n\n rescue Stripe::StripeError => e\n logger.error \"Stripe error while creating customer: #{e.message}\"\n flash[:error] = \"There was a problem processing your credit card. #{e.message}. Please try again.\"\n false\n\n end",
"def purchase_sub_existing_card\n @plan = params[:sub][:plan] #integer corresponding to my_plan_id\n @events_number = params[:sub][:events_number]\n @code = params[:sub][:code]\n @new_price = params[:sub][:new_price]\n\n # retrieve stripe customer object yet again\n if !current_user.customer_id.blank?\n c = Stripe::Customer.retrieve(current_user.customer_id)\n end \n \n if is_valid_sub_coupon(@code) \n\n #create subscription for this customer in stripe (note that update_subscription creates a new subscription for this customer in this case)\n if has_not_trialed?\n c.update_subscription(:plan => @plan, :coupon => @code)\n else\n c.update_subscription(:plan => @plan, :trial_end => (Date.today + 1.day).to_time.to_i, :coupon => @code) \n end \n #create new subscription object in my database\n @sub = Subscription.new(:user_id => current_user.id, :email => current_user.email, :customer_id => c.id, :my_plan_id => @plan, :plan_name => Plan.find_by_my_plan_id(@plan).name, :active => true)\n @sub.events_remaining = @events_number\n @sub.coupon = @code\n @sub.save \n\n #create receipt\n @r = Receipt.new(:user_id => current_user.id, :email => current_user.email, :customer_id => c.id,\n :subscription_id => @sub.id, :sub_my_plan_id => @sub.my_plan_id, :sub_plan_name => @sub.plan_name,\n :sub_events_number => @sub.events_remaining, :sub_reg_monthly_cost_in_cents => Plan.find_by_my_plan_id(@sub.my_plan_id).monthly_cost_cents,\n :sub_actual_monthly_cost_in_cents => @new_price, :sub_coupon_name => @sub.coupon) \n @r.save\n\n #mail receipt\n UserMailer.sub_receipt(current_user, @r).deliver\n\n else\n #create subscription for this customer in stripe (note that update_subscription creates a new subscription for this customer in this case)\n if has_not_trialed?\n c.update_subscription(:plan => @plan)\n else\n c.update_subscription(:plan => @plan, :trial_end => (Date.today + 1.day).to_time.to_i) \n end \n #create new subscription object in my database\n @sub = Subscription.new(:user_id => current_user.id, :email => current_user.email, :customer_id => c.id, :my_plan_id => @plan, :plan_name => Plan.find_by_my_plan_id(@plan).name, :active => true)\n @sub.events_remaining = @events_number\n @sub.save \n\n #create receipt\n @r = Receipt.new(:user_id => current_user.id, :email => current_user.email, :customer_id => c.id,\n :subscription_id => @sub.id, :sub_my_plan_id => @sub.my_plan_id, :sub_plan_name => @sub.plan_name,\n :sub_events_number => @sub.events_remaining, :sub_reg_monthly_cost_in_cents => Plan.find_by_my_plan_id(@sub.my_plan_id).monthly_cost_cents,\n :sub_actual_monthly_cost_in_cents => @new_price, :sub_coupon_name => @sub.coupon) \n @r.save\n\n #mail receipt\n UserMailer.sub_receipt(current_user, @r).deliver\n end \n\n\n flash[:success] = \"Thank you! You are now subscribed to the #{Plan.find_by_my_plan_id(@plan).name.titleize} plan!\"\n redirect_to current_user\n\n #rescue Stripe::StripeError => e # THIS CODE WORKS!!! NEEED TO FIGURE OUT HOW EXACTLY\n # logger.error \"Stripe error while creating subscription w/o active sub for existing user with card on file (purchase_sub_existing_card)\"\n # flash[:error] = \"Something went wrong. Please try again or contact us!\"\n # redirect_to current_user\n\nend",
"def create\n @Payment = Payment.new\n @Payment.user_id = current_user\n\n Stripe.api_key = ENV[\"STRIPE_API_KEY\"]\n token = params[:stripeToken]\n\n begin\n charge = Stripe::Charge.create(\n :amount => (25 * 100).floor,\n :currency => \"usd\",\n :card => token\n )\n flash[:notice] = \"Thanks for purchasing!\"\n rescue Stripe::CardError => e\n flash[:danger] = e.message\n end\n\n @Payment.stripe_id = charge.id\n @Payment.amount = charge.amount\n\n if current_user.subscribed != true\n current_user.subscribed = true\n current_user.credit = 25.00\n else\n current_user.credit = current_user.credit + 25.00\n end\n\n current_user.save\n redirect_to caves_path\n end",
"def create\n customer = StripeTool.create_customer(email: params[:stripeEmail], stripe_token: params[:stripeToken])\n\n\tcharge = StripeTool.create_charge(customer_id: customer.id, amount: @amount, description: @description)\n\n current_user.stripe_id = customer.id\n\n\treceipt = Charge.new charge_stripe_token: charge.id, price: @amount, description: @description)\n\n\tif Charge.save\n\n\telse\n\n\tend",
"def save_with_subscription\n if valid?\n customer = Stripe::Customer.create(description: email, card: stripe_card_token)\n self.stripe_customer_token = customer.id\n save! \n end\n end",
"def process_payment_unlimitess\n customer = Stripe::Customer.create email: email, card: token\n update_stripe_customer_id(customer)\n Stripe::Subscription.create customer: customer.id,\n items: [\n {price: 'price_1IndU1Bje2Voz8401SdrQuM0'},\n ]\n\n# customer = Stripe::Customer.create email: email, card: token\n# Stripe::Charge.create customer: customer.id,\n# amount: 10000,\n# description: 'Premium',\n# currency: 'usd'\n end",
"def create_subscription(credit_card, options = {})\n\n u = self.user\n options[:order_id] = number # currently just loading a date\n options[:email] = u.email\n options[:address] = {\n :first_name => u.first_name,\n :last_name => u.last_name,\n :address1 => u.street_address1,\n :address2 => (u.street_address2 || \"\"),\n :company => (u.company || \"\"),\n :city => u.city,\n :state => u.us_state,\n :zip => u.zip,\n :country => 'United States',\n :phone => u.primary_phone\n }\n\n subscription = OrderTransaction.generate_yearly_subscription(credit_card, options)\n self.save!\n order_transactions << subscription\n\n if subscription.success?\n self.payment_captured!\n else\n self.transaction_declined!\n end\n\n subscription\n end",
"def create\n\t@plan=Plan.find(params[:plan_id])\n\tif [email protected]?\n\t\tredirect_to new_buy_plan_path, :flash => { :error => \"plan not found\" }\n\t\treturn\n\tend\n\n\tif current_user.stripe_id.present?\n\t\tcustomer_id=current_user.stripe_id\n\t\tcustomer = Stripe::Customer.retrieve(customer_id)\n\t\tcustomer.sources.create(:source => params[:stripeToken])\n\telse\n\t\tcustomer = Stripe::Customer.create(\n\t\t\t:email => params[:stripeEmail],\n\t\t\t:source => params[:stripeToken]\n\t\t)\n\t\tcustomer_id=customer.id\n\t\tcurrent_user.stripe_id=customer_id\n\t\tcurrent_user.save(validate: false)\n\tend\n\n\tsubscription = customer.subscriptions.create(:plan => @plan.stripe_id )\n\n\t@plan=BuyPlan.new(:plan_id => params[:plan_id], :user_id => current_user.id, :status=>1)\n\[email protected]\n\n\tredirect_to pages_page0_path, :flash => { :notice => \"purchase completed\" }\n\n\trescue Stripe::CardError => e\n\t\tflash[:error] = e.message\n\t\tredirect_to new_buy_plan_path(:id => params[:plan_id])\n end",
"def new_subscription(user_name, email, plan)\n @user_name = user_name\n @email = email\n @plan = plan\n\n mail to: \"Susie Ye <[email protected]>\", subject: \"#{plan.capitalize} User: #{email}\"\n end",
"def purchase_sub_not_stripe_customer\n token = params[:stripeToken]\n @plan = params[:plan] #integer corresponding to my_plan_id\n @events_number = params[:events_number] #not being used right now because create_customer helper finds the events_number form the plan object via @plan argument\n @code = params[:code] \n @new_price = params[:new_price]\n event_type = \"voicegems\"\n\n if create_customer(token, @plan, @code, @new_price, event_type) #using the same helper as when a new user signs up as a customer\n #record stripe's (?) customer_id for this user\n # this helper is in users helper\n \n redirect_to current_user\n else\n @first_plan = Plan.find_by_my_plan_id(plan_set_one) # sets @first_plan the first plan object ACCORDING TO MY LEGEND (with my_plan_id)\n @second_plan = Plan.find_by_my_plan_id(plan_set_two)\n @third_plan = Plan.find_by_my_plan_id(plan_set_three)\n #These above are required to properly render purchase_sub_existing. Not changing below to redirect because the create_customer helper is creating Flash.nows, not Flashs, and this helper also being used in for totally new customers/users\n render 'purchase_sub_existing'\n end \n\n\nend",
"def update_stripe\n Stripe.api_key = \"sk_test_fVKfBEBDcWPZl5mLFk44KBJX\"\n \n # create the charge on Stripe's servers - this will charge the user's card\n if customer = Stripe::Customer.create(\n :card => stripe_token,\n :plan => \"basic_plan\",\n :description => email\n )\n \n User.update(user_id, :status => 'paid', :stripe_customer_id => customer.id)\n end\n end",
"def stripe_customer_subscription_created(event, req)\n stripe_customer_subscription_updated(event, req)\n end",
"def subscription_checkout\n\n @code = params[:couponCode]\n\n if [email protected]?\n @discount = @code\n\n if @discount.nil?\n flash[:error] = 'Coupon code is not valid or expired.'\n redirect_to pricing_path\n return\n end\n\n charge_metadata = {\n :coupon_code => @code,\n :coupon_discount => (@discount * 100).to_s + \"%\"\n }\n end\n\n charge_metadata ||= {}\n\n plan_id = params[:plan_id]\n plan = Stripe::Plan.retrieve(plan_id)\n #This should be created on signup.\n customer = Stripe::Customer.create(\n #:description => \"Customer for [email protected]\",\n :source => params[:stripeToken],\n :email => current_user.email\n )\n\n user = current_user\n user.stripe_id = customer.id\n user.subscribed = true\n user.save\n\n # Save this in your DB and associate with the user;s email\n stripe_subscription = customer.subscriptions.create(:plan => plan.id, :coupon => @discount)\n\n flash[:notice] = \"Successfully Subscribed!\"\n redirect_to '/dashboard'\n end",
"def update_card_and_subscription(token, plan) # plan is now a my_plan_id\n \n c = Stripe::Customer.retrieve(current_user.customer_id) #have this in the enveloping controller action as well, because of the 'undefined variable c' error i was getting from the 4000000000000341 card test\n\n #updates customer with new card\n c.card = token\n c.save\n\n #updates subscription plan in stripe \n c.update_subscription(:plan => plan, :prorate => true)\n\n rescue Stripe::InvalidRequestError => e\n logger.error \"Stripe error while creating customer: #{e.message}\"\n flash[:error] = \"There was a problem processing your credit card. #{e.message}. Please try again.\"\n false\n \n rescue Stripe::CardError => e\n logger.error \"Stripe error while creating customer: #{e.message}\"\n flash[:error] = \"There was a problem processing your credit card. #{e.message}. Please try again.\"\n false\n\n rescue Stripe::StripeError => e\n logger.error \"Stripe error while creating customer: #{e.message}\"\n flash[:error] = \"There was a problem processing your credit card. #{e.message}. Please try again.\"\n false\n\n end",
"def create_initial_subscription\n return unless self.subscription_plan_id.to_i > 0\n\n @subscription_plan = SubscriptionPlan.find(self.subscription_plan_id)\n if @subscription_plan.user?\n self.subscribe_to_plan(@subscription_plan)\n else\n create_organization_and_subscription_plan\n end\n end",
"def change_subscription\n\tbounce_free_account\n\n\t@subs = current_user.subscriptions \n\tif @subs && [email protected]?\n\t@s = @subs.active.first\n\t@s_year = @s.created_at + 365.days\n\t#@c = Stripe::Customer.retrieve(@s.customer_id)\n\telse #this should not happen - be careful to make sure every customer has a subscription; or at least if they have a \n\t\t# cancel subsciption link, there is an active subscription to be canceled. \n\tredirect_to current_user, notice: 'You have no active subscriptions.'\n\t # return false is this line needed to end the action?\n\tend \n\n\t# users first (oldest) subscription, for displaying free trial information\n\t@firstsub = @subs.first\n\t@firstsub_end = @firstsub.created_at + 14.days\n\n\t#@plan = Plan.find_by_name(@s.plan_id) #this would be better for easily retrieving other associated plan info; but could have just used @s.plan_id for the plan name\n\tif [email protected]_plan_id.nil? # so that @plan isn't nil, which would cause problems in the view \n\t@plan = Plan.find_by_my_plan_id(@s.my_plan_id) # NOTE THAT @PLAN IS THE PLANOBJECT\n\t\t\t\t#see if active subscription has a coupon associated with it\n\t\t\t\tif [email protected]? && Coupon.find_by_name(@s.coupon)\n\t\t\t\t\t@coupon = Coupon.find_by_name(@s.coupon)\n\t\t\t\t\t@code = @coupon.name\n\t\t\t\t\t@new_price = @plan.monthly_cost_cents * (100 - @coupon.percent_off)/100\n\t\t\t\telse\n\t\t\t\t\t@coupon = nil \n\t\t\t\t\t@code = nil\n\t\t\t\t\t@new_price = nil \n\t\t\t\tend \n\telse\n\t\t@plan = nil\n\t\t@coupon = nil \n\t\t@code = nil \n\t @new_price = nil \n\tend \n\nend",
"def success\n if params[:reference].present?\n\n paystackObj = Paystack.new(ENV['PAYSTACK_PUBLIC_KEY'], ENV['PAYSTACK_PRIVATE_KEY'])\n\n subscriptions = PaystackSubscriptions.new(paystackObj)\n result = subscriptions.create(\n\n :customer => current_user.email,\n :plan => \"PLN_96ws6ovviw8028d\", #plan id\n :amount => 200000 #in KOBO\n\n \n )\n\n\n u = current_user\n u.subscribed = true\n u.subscription_code = code\n u.email_token = token\n u.save!\n \n else\n redirect_to new_subscription_path, notice: \"Error Making Payment, Try Again\"\n\n end\n end",
"def create_subscription(options)\n # Get the plan.\n plan = Stripe::Plan.retrieve(options[:plan])\n\n # Charge VAT in advance because subscription call will create and pay an invoice.\n # TK actually we need to apply VAT for invoiceitems that are pending and scheduled\n # for the next invoice.\n # Do not charge VAT if the plan or the subscription is still in trial (invoice will come later).\n vat, invoice_item = charge_vat_of_plan(plan) unless \\\n plan.trial_period_days || (options[:trial_end] && options[:trial_end] != 'now')\n\n # Start subscription.\n # This call automatically creates an invoice, always.\n subscription = customer.subscriptions.create(options)\n\n [subscription, last_invoice]\n rescue Stripe::StripeError, Stripe::CardError => e\n # Something failed in Stripe, if we already charged for VAT,\n # we need to rollback this. As we may charge twice later otherwise.\n invoice_item.delete if invoice_item\n raise e\n end",
"def postfill!(customer)\n self.price = customer.subscription.plan.amount / 100\n self.stripe_id = customer.id\n self.exp_month = customer.active_card.exp_month\n self.exp_year = customer.active_card.exp_year\n self.last4 = customer.active_card.last4\n self.status = \"active\"\n self.save!\n self\n end",
"def create_customer(customer_data)\n ::Stripe::Customer.create(customer_data)\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 @user, 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\n Stripe.api_key = ENV[\"STRIPE_SECRET_KEY\"]\n\n stripe_customer = Stripe::Customer.create(\n :email => @user.email,\n )\n @user.stripe_id = stripe_customer.id\n end",
"def create_stripe_account\n unless stripe_token.present? || Rails.env.test?\n customer = Stripe::Customer.create(description: \"User ID: #{id}\", email: email)\n update_columns(stripe_token: customer.id)\n end\n end",
"def subscribe!(params)\n raise Errors::AlreadySubscribedError if subscribed?\n raise Errors::StripeCustomerExistsError if stripe_customer_id\n\n customer = ::Stripe::Customer.create(\n source: params[:stripe_token],\n plan: params[:subscription_plan_id] || SlackRubyBotServer::Stripe.config.subscription_plan_id,\n email: params[:stripe_email],\n metadata: {\n id: id,\n team_id: team_id,\n name: name,\n domain: domain\n }\n )\n\n update_attributes!(\n subscribed: true,\n subscribed_at: Time.now.utc,\n stripe_customer_id: customer['id'],\n subscription_expired_at: nil,\n subscription_past_due_at: nil,\n subscription_past_due_informed_at: nil\n )\n\n customer\n end",
"def create(params)\n If(Hr.find(params[:user_id])) do |hr|\n customer = Stripe::Customer.create(source: params[:stripe][:token])\n hr.update_attribute(:stripe_id, customer.id)\n hr.update_attribute(:last_four_digits, customer.sources.data.first.last4)\n end\n end",
"def purchase_sub_new_card\n token = params[:stripeToken]\n @plan = params[:plan] #integer corresponding to my_plan_id\n @events_number = params[:events_number] \n @code = params[:code]\n @new_price = params[:new_price]\n\n if update_card_and_new_subscription(token, @plan, @code)\n c = Stripe::Customer.retrieve(current_user.customer_id)\n \n #create new subscription object in my database\n @sub = Subscription.new(:user_id => current_user.id, :email => current_user.email, :customer_id => c.id, :my_plan_id => @plan, :plan_name => Plan.find_by_my_plan_id(@plan).name, :active => true)\n @sub.events_remaining = @events_number\n @sub.coupon = @code \n @sub.save \n\n #create receipt\n @r = Receipt.new(:user_id => current_user.id, :email => current_user.email, :customer_id => c.id,\n :subscription_id => @sub.id, :sub_my_plan_id => @sub.my_plan_id, :sub_plan_name => @sub.plan_name,\n :sub_events_number => @sub.events_remaining, :sub_reg_monthly_cost_in_cents => Plan.find_by_my_plan_id(@sub.my_plan_id).monthly_cost_cents,\n :sub_actual_monthly_cost_in_cents => @new_price, :sub_coupon_name => @sub.coupon) \n @r.save\n\n #mail receipt\n UserMailer.sub_receipt(current_user, @r).deliver\n\n flash[:success] = \"Thank you for subscribing to the #{Plan.find_by_my_plan_id(@plan).name.titleize} plan!\"\n redirect_to current_user\n\n else\n redirect_to purchase_sub_existing_path\n end \n\n\nend",
"def create_subscription(options)\n # This call automatically creates an invoice, always.\n Stripe::Subscription.create({\n customer: customer.id,\n tax_percent: calculate_vat_rate\n }.merge(options))\n end",
"def create\n plan = Billingly::Plan.find(params[:plan_id])\n unless current_customer.can_subscribe_to?(plan)\n return redirect_to subscriptions_path, notice: 'Cannot subscribe to that plan'\n end\n current_customer.subscribe_to_plan(plan)\n on_subscription_success\n end",
"def create\n plan = Billingly::Plan.find(params[:plan_id])\n unless current_customer.can_subscribe_to?(plan)\n return redirect_to subscriptions_path, notice: 'Cannot subscribe to that plan'\n end\n current_customer.subscribe_to_plan(plan)\n on_subscription_success\n end",
"def create\n @payment = Payment.new(payment_params)\n\n @amount = @payment.amount * 100\n\n Stripe.api_key = 'sk_test_CfSPVwqeJbuCxJSnCDcXuKRG';\n\n begin\n if current_user.stripe_customer_id.present?\n @customer = Stripe::Customer.retrieve(current_user.stripe_customer_id) \n else\n card_details = {}\n card_details[:name] = payment_params[:first_name]\n card_details[:number] = payment_params[:credit_card_number]\n card_details[:cvc] = payment_params[:card_security_code]\n card_details[:exp_month] = payment_params[:expiration_month]\n card_details[:exp_year] = payment_params[:expiration_year]\n\n @card = Stripe::Token.create(card: card_details)\n \n @customer = Stripe::Customer.create(\n :email => current_user.email,\n :card => @card.id\n )\n\n if @customer.present?\n current_user.stripe_customer_id = @customer.id\n current_user.save!\n end\n end\n\n\n @charge = Stripe::Charge.create(\n :customer => @customer.id,\n :amount => @amount,\n :description => 'Autopass payment',\n :currency => 'usd'\n )\n\n if @payment.save\n redirect_to success_payment_path(@payment), notice: 'Payment was successfully created. Vender will be notified.'\n end\n rescue Stripe::CardError => e\n redirect_to \"/siteparking/sitepayments/#{@payment.parking.token}\"\n flash[:error] = e.message\n end \n\n\n end",
"def create\n sub_id = params[:spree_user][:sub_type].blank? ? \"1\" : params[:spree_user][:sub_type]\n coupon_code = params[:spree_user][:coupon_code]\n @cart = Cart.new\n @user = build_resource(user_params_list)\n\n credit_card_params = params[:spree_user][:creditcards_attributes][\"0\"]\n respond_to do |format|\n format.js do\n if @user.valid?\n billing_address = @user.addresses.last\n result = Creditcard.create_customer_and_creditcard_over_braintree(billing_address, @user.email,credit_card_params)\n @success = result.success? ? true : false\n puts \"i am in user success with params#{@success} and #{billing_address}\"\n\n\n if @success && @user.save\n customer =result.customer\n @credit_card_details = Creditcard.update_creditcard(customer.credit_cards.first, @user.id)\n @user.push_subscription_and_customer_id(sub_id, customer.id)\n @cart.prepare_cart(@user.id, sub_id)\n @user.update_bill_and_ship_address_details\n @user.update_address_type_and_name_fields\n\n #####code for creating new orders#####\n # first order\n plan_price = Subscription.where(id: sub_id).first.plan_price.to_f\n @order_1 = place_order_registration(sub_id, FIRST_DELIVERY_DAYS.days.from_now, @user, @credit_card_details.id, request.remote_ip, plan_price)\n new_token_1 = @order_1.get_unique_ID\n new_token_subscr = Spree::Order.get_unique_subscription_token\n #entry in user subscription\n\n coupon = Coupon.get_briantree_discount_id_and_calculate_final_amount(plan_price, coupon_code)\n\n if coupon.present?\n user_subscription_id = UserSubscription.create_user_subscription(sub_id, @user.id, new_token_subscr, coupon[\"id\"])\n sub_result = Subscription.place_subscription_with_coupon(@order_1.delivery_date, @order_1.subscription_id, @credit_card_details.id, new_token_subscr, coupon)\n @order_1.update_attributes(coupon_id: coupon[\"id\"])\n Coupon.raise_counter(coupon[\"id\"])\n else\n user_subscription_id = UserSubscription.create_user_subscription(sub_id, @user.id, new_token_subscr)\n sub_result = Subscription.place_subscription_without_coupon(@order_1.delivery_date, @order_1.subscription_id, @credit_card_details.id, new_token_subscr)\n end\n\n @order_1.update_attributes(number: new_token_1, user_subscription_id: user_subscription_id, subscription_token: new_token_subscr)\n\n # second order\n @order_2 = place_order_registration(sub_id, SECOND_DELIVERY_DAYS.days.from_now, @user, @credit_card_details.id, plan_price)\n new_token_2 = @order_2.get_unique_ID\n @order_2.update_attributes(number: new_token_2, subscription_token: new_token_subscr, user_subscription_id: user_subscription_id)\n\n # third order\n @order_3 = place_order_registration(sub_id, THIRD_DELIVERY_DAYS.days.from_now, @user, @credit_card_details.id, plan_price)\n new_token_3 = @order_3.get_unique_ID\n @order_3.update_attributes(number: new_token_3, subscription_token: new_token_subscr, user_subscription_id: user_subscription_id)\n\n #creating new line-items-default\n\n create_new_line_items(sub_id,@order_1)\n create_new_line_items(sub_id,@order_2)\n create_new_line_items(sub_id,@order_3)\n\n @order_1.update_total_and_item_total #reupdated total & item_total as its changed by is_pushed = 1 , in push notification method.\n @order_2.update_total_and_item_total\n @order_3.update_total_and_item_total\n ######################################\n\n sign_in(:spree_user, @user)\n session[:spree_user_signup] = true\n #MyMailer.notify_user_after_registration(current_user).deliver\n result = signup_mail_params(@order_1)\n VeganMailer.signup_email(result).deliver\n\n result = vendor_email_params(@order_1)\n VeganMailer.vendor_email(result).deliver\n\n render js: %(window.location.href='/spree/orders/snack_queue') and return\n\n else\n @user.destroy\n @user.remove_errormessages_added_by_spree\n @user.errors.add(:creditcards,\"invalid credit card details\")\n end\n else\n \n end\n end\n end\n\n end",
"def create\n super do |resource| #super means inherit the 'create' action, but then extend it\n if params[:plan]\n #is there a parameter called param?\n resource.plan_id = params[:plan] #resource means user in this case. So take whatever is in the form and set this users plan to be that plan id\n if(resource.plan_id == 2) #so if the form is coming from the pro form, then don't just save the user. We also wanyt to keep the plan id. run the function that we create called save_with_subscription\n resource.save_with_subscription #write a user created function in the model. So in this case models/user.rb\n #the save is done in the model.\n else\n #otherwise just save as normal devise save\n resource.save\n end\n end\n end\n end",
"def create_account_and_subscribe_single_call account_name\n contact = {\n address1: '1051 E Hillsdale Blvd',\n city: 'Foster City',\n country: 'United States',\n firstName: 'John',\n lastName: 'Smith',\n zipCode: '94404',\n state: 'CA'\n }\n #get the rate plans for the product\n product_rate_plan = get_product_rate_plans_for_product 'Medium Monthly Plan'\n myDate = DateTime.now + 10.days;\n #create an account and subscribe to a rate plan at the same time\n subscribe(\n account_name,\n contact,\n DateTime.now.strftime(\"%Y-%m-%d\"),\n myDate.strftime(\"%Y-%m-%d\"),\n product_rate_plan['id']\n )\nend",
"def create\n # Each shop can have only one recurring charge per app. When a new recurring application charge is activated for a shop\n # that already has one, the existing recurring charge is canceled and replaced by the new charge.\n # The new recurring charge is then activated.\n\n plan_info = @subscriptions_info[params[:subscription_type]]\n local_charge = @shop.charges.create\n\n shopify_charge = ShopifyAPI::RecurringApplicationCharge.new(\n name: plan_info[\"name\"],\n price: plan_info[\"price\"],\n return_url: \"#{ENV['APP_URL']}/charges/#{local_charge.id}/activate\",\n test: plan_info[\"test\"],\n capped_amount: plan_info[\"capped_amount\"],\n terms: plan_info[\"terms\"]\n )\n if shopify_charge.save\n fullpage_redirect_to shopify_charge.confirmation_url\n else\n # make sure this works\n local_charge.delete\n # recurring charge could not be created\n end\n end",
"def purchase_events_new_stripe_customer\n token = params[:stripeToken]\n @number = params[:number].to_i\n coupon = params[:coupon]\n cost = params[:cost]\n\n if create_customer_and_purchase_existing_user(token, @number, cost, coupon) # this is almost like create_customer_purchase, except have flash.nows in that helper\n #if the customer had a coupon, update that coupon to be inactive, and attach customer's user id to it\n # if !coupon.blank?\n # redeem_single_use_coupon(coupon)\n # end \n redirect_to current_user\n else\n redirect_to existing_user_purchase_path\n end \n\nend",
"def create_gocardless_subscription\n GO_CARDLESS_CLIENT.subscriptions.create(\n params: {\n amount: User::PLAN_AMOUNT.to_i,\n currency: User::GO_CARDLESS_CURRENCY,\n name: User::GO_CARDLESS_NAME,\n interval_unit: User::INTERVAL_UNIT,\n interval: 1,\n start_date: Date.current + 2.month,\n day_of_month: 1,\n links: {\n mandate: current_user.go_cardless_mandate\n }\n }\n )\n end",
"def create\n Payjp.api_key = \"sk_test_c62fade9d045b54cd76d7036\"\n @user = user\n\n if customer_id = @user.customer_id\n customer = Payjp::Customer.retrieve(id: customer_id)\n else\n customer = Payjp::Customer.create(card:payjp_token)\n @user.customer_id = customer.id\n @user.save!\n end\n\n plans = customer.subscriptions.data.collect(&:plan).collect(&:id)\n plan_id = \"#{@item.id}_#{@item.interval}\"\n if plans.include?(plan_id)\n plan = Payjp::Plan.retrieve(id: \"#{@item.id}_#{@item.interval}\")\n subscription = customer.subscriptions.data.select{|data| data.plan.id == plan_id}.first\n if subscription\n unless subscription.status == \"active\"\n subscription.resume\n end\n update_role(subscription)\n else\n subscription = Payjp::Subscription.create(customer:customer.id, plan: plan.id)\n update_role(subscription)\n end\n else\n plan = Payjp::Plan.create(id: \"#{@item.id}_#{@item.interval}\", amount: \"#{@item.price}\", interval: \"#{@item.interval}\", currency: \"jpy\")\n subscription = Payjp::Subscription.create(customer:customer.id, plan: plan.id)\n update_role(subscription)\n end\n\n if subscription\n @order = Order.find_or_create_by(subscription: subscription.id)\n @order.item = item\n @order.user = @user\n @order.current_period_end = Time.at(subscription.current_period_end)\n @order.save\n redirect_to @order, notice: 'Order was successfully created.'\n else\n redirect_to new, notice: 'Order was not created.'\n end\n\n end",
"def create\n customer = Stripe::Customer.create(\n email: current_user.email,\n card: params[:stripeToken]\n )\n # Changes the user role to premium\n charge = Stripe::Charge.create(\n customer: customer.id, \n amount: amount_for_upgrade,\n description: \"Premium Membership! - #{current_user.email}\",\n currency: 'usd'\n )\n\n # @param: customer, the string representation of the customer id\n # @param: amount, an integer represenation of amount \n # @param: description, the string representation of description \n # @param: currency, the string representation of currancy\n\n current_user.update_attribute(:role, 'premium')\n flash[:notice] = \"Thanks for upgrading your account!, #{current_user.email}! \"\n redirect_to wikis_path(current_user) \n\n# Rescue block catches and displays error \n rescue Stripe::CardError => e\n flash[:error] = e.message\n redirect_to new_charge_path\nend",
"def create_subscription(options)\n stripe_service.create_subscription(options)\n end",
"def thank_you\n user = session[:user]\n user.zip = params[:zip]\n \n start_date = Date.today\n start_date += 61\n \n response = create_autorrecuring_subscription(start_date, user, params[:card_number], params[:month], params[:year], \n params[:cvc], params[:card_type], params[:city], params[:state],\n params[:billing_address_1], params[:billing_address_2])\n if response.success?\n session[:errors] = nil\n session[:user] = nil\n user.arb_subscription_id = response.subscription_id\n user.arb_status = AuthorizeNet::ARB::Subscription::Status::ACTIVE\n user.billing_information_id = user.add_billing_information(params[:fullname], params[:billing_address_1] ,\n params[:billing_address_2], params[:city], params[:state],\n params[:zip]).id\n user.save\n else\n puts \"Failed to make purchase. \" + response.response_reason_code + \" - \" + response.response_reason_text\n user.errors.clear()\n user.errors.add(:transaction, response.response_reason_text)\n session[:errors] = user.errors\n redirect_to admin_signup_step3_path\n end \n\n \n end",
"def create\n #create a random key to identify the new customer\n customer_id = Array.new(8/2) { rand(256) }.pack('C*').unpack('H*').first\n\n # The APP_CONFIG value comes from app_config.yml in the Config dir\n @subscription = Subscription.new(params[:subscription])\n\n #maybe this should be in the model?\n @subscription.plan_id = APP_CONFIG[:subscription_token]\n @subscription.customer_id = customer_id\n @subscription.sub_id = \"#{Time.now.strftime(\"%Y%m%d%H%M%s\")}\"\n # First try to create the customer in BrainTree's vault, if successful then save the subscription record.\n # I'd like this process improved to so it's using error handling instead of flash messages\n @result = Braintree::Customer.create(\n :id => customer_id,\n :first_name => params[:subscription][\"billing_first_name\"],\n :last_name => params[:subscription][\"billing_last_name\"],\n :company => params[:subscription][\"billing_company\"],\n :credit_card => {\n :cardholder_name => params[:subscription][\"credit_card_name\"],\n :number => params[:subscription][\"credit_card_number\"],\n :token => @subscription.sub_id,\n :expiration_date => \"#{params[:subscription][\"credit_card_month\"]}/#{params[:subscription][\"credit_card_year\"]}\",\n :cvv => params[:subscription][\"credit_card_cvv_code\"],\n :billing_address => {\n :street_address => params[:subscription][\"billing_address\"],\n :extended_address =>params[:subscription][\"billing_address2\"],\n :locality => params[:subscription][\"billing_city\"],\n :region => params[:subscription][\"billing_state\"],\n :postal_code => params[:subscription][\"billing_zipcode\"],\n :country_code_numeric => params[:subscription][\"billing_country\"]\n }\n }\n )\n if @result.success?\n if create_subscription( @subscription.sub_id, params[:subscription][\"fee\"])\n @merchant = Merchant.find(session[:merchant_id])\n @merchant.update_attributes(:customer_id => customer_id)\n # I removed all the respond_to code, I don't think I'll be using XML formating, shoudl all the respond_do code be removed?\n if @subscription.save\n redirect_to(:controller => 'subscriptions', :action => 'index', :notice => 'Subscription was successfully created.')\n else\n render :action => \"new\"\n end\n else\n render :action => \"new\"\n end\n else\n #was not able to create the customer, display error messages\n render :action => \"new\"\n end\n end",
"def create\n\t\t#Prepare the models\n\t\t@subscription = Subscription.new(\n\t\t\tcampaign_id: @subscribed.active_campaign.id,\n\t\t\tshipping_country: params[:subscription][:shipping_country],\n\t\t\tget_reward: params[:subscription][:get_reward],\n\t\t\tfunding_type: params[:subscription][:funding_type],\n\t\t\tamount: params[:subscription][:amount],\n\t\t\tsubscriber_id: @subscriber.id,\n\t\t\tsubscribed_id: @subscribed.id,\n\t\t\tcurrency: 'usd',\n\t\t\tcampaign_funding_type: @subscribed.active_campaign.funding_type\n\t\t)\n\t\tif params[:subscription][:majorpost_id]\n\t\t\[email protected]_id = params[:subscription][:majorpost_id]\n\t\tend\n\t\tif params[:subscription][:upper_limit]\n\t\t\[email protected]_limit = params[:subscription][:upper_limit]\n\t\tend\n\t\tif params[:subscription][:cards_attributes]\n\t\t\tadd_card\n\t\tend\n\t\t#Charge if charge\n\t\tif @subscription.funding_type == 'one_time'\n\t\t\t#Charge the card now\n\t\t\tsubscribe_through_stripe\n\t\telse\n\t\t\t#Do not charge the card\n\t\t\tsubscription_post_payment\n\t\tend\n\trescue Stripe::CardError => e\n\t\t# Since it's a decline, Stripe::CardError will be caught\n\t\tbody = e.json_body\n\t\terr = body[:error]\n\n\t\tputs \"Status is: #{e.http_status}\"\n\t\tputs \"Type is: #{err[:type]}\"\n\t\tputs \"Code is: #{err[:code]}\"\n\t\t# param is '' in this case\n\t\tputs \"Param is: #{err[:param]}\"\n\t\tputs \"Message is: #{err[:message]}\"\n\t\t#Show to the user\n\t\tflash[:error] = \"#{err[:message]}\"\n\t\tredirect_to how_i_pay_user_studio_wallets_path(@subscriber.username)\n\trescue Stripe::RateLimitError => e\n\t\t# Too many requests made to the API too quickly\n\t\tflash[:error] = t('errors.messages.too_many_requests')\n\t\tredirect_to profile_url_path(@subscribed.username)\n\trescue Stripe::InvalidRequestError => e\n\t\t# Invalid parameters were supplied to Stripe's API\n\t\tflash[:error] = t('errors.messages.not_saved')\n\t\tredirect_to profile_url_path(@subscribed.username)\n\trescue Stripe::AuthenticationError => e\n\t\t# Authentication with Stripe's API failed\n\t\t# (maybe you changed API keys recently)\n\t\tflash[:error] = t('errors.messages.not_saved')\n\t\tredirect_to profile_url_path(@subscribed.username)\n\trescue Stripe::APIConnectionError => e\n\t\t# Network communication with Stripe failed\n\t\tflash[:error] = t('errors.messages.not_saved')\n\t\tredirect_to profile_url_path(@subscribed.username)\n\trescue Stripe::StripeError => e\n\t\t# Display a very generic error to the user, and maybe send\n\t\t# yourself an email\n\t\tflash[:error] = t('errors.messages.not_saved')\n\t\tredirect_to profile_url_path(@subscribed.username)\n\trescue \n\t\t# General rescue\n\t\tflash[:error] = t('errors.messages.not_saved')\n\t\tredirect_to profile_url_path(@subscribed.username)\n\tend",
"def perform\n @previousMonth = (Date.today - 1.months).strftime(\"%Y-%m\")\n\n \t# Only exec with subscription status is active\n # Subscription subscription_type == 1 is free trial\n # If user upgrade subscription, and then subscription_type update to 2 is invidual account\n # Update subscription_type == 2 on production, because in test we manual modify account\n\t\tSubscription.where(status: 1).each do |subscription|\n\n\t\t\t# Find user\n\t\t\t@user = User.find(subscription.user_id)\n\n # Get bandwidth & storage usage on previous month\n if @user.bandwidths.present? && @user.bandwidths.find_by(monthly: @previousMonth).present?\n bwdUsage = @user.bandwidths.find_by(monthly: @previousMonth).bandwidth_usage * 1000.00\n else\n bwdUsage = 0\n end\n\n if @user.storages.present? && @user.storages.find_by(monthly: @previousMonth).present?\n stgUsage = @user.storages.find_by(monthly: @previousMonth).storage_usage * 1000.00\n else\n stgUsage = 0\n end\n\n # Calculator usage pricing\n @totalPrice = (@user.subscription.stg_price * (stgUsage / 1000000000.00)) + (@user.subscription.bwd_price * (bwdUsage / 1000000000.00))\n\n @description = \"Delivery Appliance running in global: #{ApplicationController::FormatNumber.new(bwdUsage).formatHumanSize()}, and File Appliance in global: #{ApplicationController::FormatNumber.new(stgUsage).formatHumanSize()} (Source:#{Package.find(@user.subscription.package).name} [#{@user.subscription.name}])\"\n\t\t\t\n if @totalPrice != 0\n # Effect only with subscription type automatic payment by credit card\n if @user.subscription.payment_type == 2 && @user.credit.card_token.present?\n charge = Stripe::Charge.create(\n :amount => @totalPrice.to_i,\n :currency => \"vnd\",\n :customer => @user.credit.stripe_token,\n :source => @user.credit.card_token,\n :description => @description\n )\n\n # Defind charge succeeded response from Stripe\n if charge[\"status\"] == \"succeeded\"\n\n # Create transaction succeeded\n @user.credit.transactions.create(\n description: @description,\n transaction_type: 'Automatic Payment',\n stripe_id: charge[\"id\"],\n amount: @totalPrice.to_i,\n card_id: @user.credit.card_token,\n card_name: @user.credit.card_name,\n card_number: @user.credit.last4,\n card_brand: @user.credit.card_brand,\n status: 'succeeded',\n monthly: @previousMonth\n )\n end\n end\n\n # Effect only with subscription type automatic payment by deposit\n if @user.subscription.payment_type == 2 && @user.credit.card_token.nil?\n\n # Check credit\n if @user.credit.credit_value != 0 && @user.credit.credit_value > @totalPrice\n\n # Update credit balance\n @user.credit.decrement! :credit_value, @totalPrice\n\n # Create transaction of this month\n @user.credit.transactions.create(\n description: @description,\n transaction_type: 'Automatic Payment',\n amount: @totalPrice,\n status: 'succeeded',\n monthly: @previousMonth\n )\n else\n # Create transaction of this month\n @user.credit.transactions.create(\n description: @description,\n transaction_error: 'Deposit balance not enough for this payment. Please check your credit again',\n transaction_type: 'Automatic Payment',\n amount: @totalPrice,\n status: 'failed',\n monthly: @previousMonth\n )\n\n # Suspend subscription if payment failed\n @user.subscription.update(status: 2)\n end\n end\n\n # Effect only with subscription type manual payment\n if @user.subscription.payment_type == 3\n # Create invoice in previous month, default status is unpaid\n @user.credit.invoices.create(\n description: @description,\n invoice_type: 'Check Out',\n amount: @totalPrice,\n status: 'unpaid',\n monthly: @previousMonth\n )\n end\n end\n\t\tend\n\n # Rescue error and create transaction failed with message\n rescue Stripe::CardError => e\n\n # Create transaction failed\n @user.credit.transactions.create(\n description: @description,\n transaction_error: e.message,\n transaction_type: 'Automatic Payment',\n amount: @totalPrice.to_i,\n card_id: @user.credit.card_token,\n card_name: @user.credit.card_name,\n card_number: @user.credit.last4,\n card_brand: @user.credit.card_brand,\n status: 'failed',\n monthly: @previousMonth\n )\n\n # Suspend subscription if payment failed\n @user.subscription.update(status: 2)\n end",
"def transact\n get_subscription\n token = params[:stripe_token] || raise('Can not transact without stripe token')\n plan = Plan.find(params[:payment][:plan_id])\n \n cs = Ripple::Subscription::CompanySubscription.new(@subscription)\n new_subscription = cs.change_stripe_plan(plan.name, token)\n flash[:notice] = \"Customer was charged, and subscription upgraded.\"\n redirect_to admin_company_path(@company)\n end",
"def save_with_payment\n if valid? # We did added some validation to make sure user filled in properly ::contact.rb\n # After Stripe get this info, Stripe will do the charging, this method comes from Stripe gem\n # Stripe will return an id after charging\n customer = Stripe::Customer.create(description: email, plan: plan_id, source: stripe_card_token) # Stripe had upgrade their API from card: -> source:\n # Set a property to the user after received the id Stripe returned(stripe will return customer hash)\n # 'self' means the target of this function, in this case is User, and we set a new atribute stripe_customer_token to User. \n self.stripe_customer_token = customer.id # Setting stripe_customer_token to Stripe::customer.id \n save!\n end\n \n end",
"def create\n @traveler = Traveler.new(traveler_params)\n @amount = 2000\n @traveler.user_id = current_user.id\n\n token = params[:stripeToken]\n card_brand = params[:user][:card_brand]\n card_exp_month = params[:user][:card_exp_month]\n card_exp_year = params[:user][:card_exp_year]\n card_last4 = params[:user][:card_last4]\n\n charge = Stripe::Charge.create(\n amount: @amount,\n currency: \"myr\",\n description: \"ReadyBus\",\n source: token\n )\n\n current_user.stripe_id = charge.id\n current_user.card_brand = card_brand\n current_user.card_exp_month = card_exp_month\n current_user.card_exp_year = card_exp_year\n current_user.card_last4 = card_last4\n current_user.save!\n\n\n respond_to do |format|\n if @traveler.save\n format.html { redirect_to @traveler, notice: 'Your travel has successfully booked.' }\n format.json { render :show, status: :created, location: @traveler }\n else\n format.html { render :new }\n format.json { render json: @traveler.errors, status: :unprocessable_entity }\n end\n end\n\n rescue Stripe::CardError => e\n flash.alert = e.message\n render action: :new\n end",
"def create_customer(identity)\n customer = Stripe::Customer.create(\n card: posted['stripeToken'],\n plan: Lynr.config('app').fetch(:stripe, {}).plan,\n email: identity.email\n )\n end",
"def create\n\n # @stripe_account = StripeAccount.new(stripe_account_params)\n # @user = User.find(params[:user_id])\n # @stripe_account.user_id = current_user.id\n\n @user = (current_user || current_affiliate)\n @stripe_account = @user.build_stripe_account(stripe_account_params)\n\n\n\n acct = Stripe::Account.create({\n :country => \"US\",\n :type => \"custom\",\n legal_entity: {\n first_name: stripe_account_params[:first_name].capitalize,\n last_name: stripe_account_params[:last_name].capitalize,\n type: stripe_account_params[:account_type],\n dob: {\n day: stripe_account_params[:dob_day],\n month: stripe_account_params[:dob_month],\n year: stripe_account_params[:dob_year]\n },\n address: {\n line1: stripe_account_params[:address_line1],\n city: stripe_account_params[:address_city],\n state: stripe_account_params[:address_state],\n postal_code: stripe_account_params[:address_postal]\n },\n ssn_last_4: stripe_account_params[:ssn_last_4]\n },\n tos_acceptance: {\n date: Time.now.to_i,\n ip: request.remote_ip\n }\n\n })\n\n @stripe_account.acct_id = acct.id\n # @user.stripe_token = acct.id\n\n\n\n respond_to do |format|\n\n # @user = User.find(params[:id])\n\n if @stripe_account.save!\n # && @user.save\n\n\n\n\n format.html { redirect_to new_bank_account_path, notice: 'Stripe account was successfully created.' }\n format.json { render :show, status: :created, location: @stripe_account }\n\n\n else\n format.html { render :new }\n format.json { render json: @stripe_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_customer(user)\n customer = Mollie::Customer.create(\n email: user.email,\n api_key: get_preference(:api_key),\n )\n MollieLogger.debug(\"Created a Mollie Customer for Spree user with ID #{customer.id}\")\n customer\n end",
"def create\n ActiveRecord::Base.transaction do\n @membership = @member.memberships.build(membership_params)\n @plan = Plan.find(params[:membership][:plan_id])\n coupon = params[:membership][:coupon].present? ? params[:membership][:coupon] : nil\n @trial_period_end = params[:membership][:trial_period_days].present? ? set_trial_period_end_date : 'now'\n\n if params[:membership][:payment_type] == 'Stripe'\n stripe_sub = Stripe::Subscription.create(\n customer: @member.stripe_id,\n trial_end: @trial_period_end,\n coupon: coupon,\n :items => [\n {\n :plan => @plan.stripe_id,\n },\n ]\n )\n\n @membership.stripe_sub_id = stripe_sub.id\n @membership.next_invoice_date = Time.at(stripe_sub.current_period_end).to_datetime\n @membership.start_date = set_start_date\n elsif @plan.stripe_id.present?\n @stripe_plan = Stripe::Plan.retrieve(@plan.stripe_id)\n start_date = set_start_date\n plan_interval = @stripe_plan.interval\n plan_interval_count = @stripe_plan.interval_count\n next_date = case plan_interval\n when 'day'\n start_date + plan_interval_count.days\n when 'week'\n start_date + plan_interval_count.weeks\n when 'month'\n start_date + plan_interval_count.months\n when 'year'\n start_date + plan_interval_count.years\n end\n @membership.next_invoice_date = next_date\n end\n\n respond_to do |format|\n if @membership.save!\n format.html { redirect_to @member, notice: 'Membership was successfully created.' }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def new_customer\n @org = Organisation.find_by(permalink: params[:organisation_id])\n @customer = Customer.new\n\n Stripe.api_key = ENV[\"STRIPE_SECRET_KEY\"]\n end",
"def create\n @user = current_user\n @product = @event.title\n @amount = @event.price\n @stripe_amount = (@amount * 100).to_i\n begin\n customer = Stripe::Customer.create({\n email: params[:stripeEmail],\n source: params[:stripeToken],\n })\n charge = Stripe::Charge.create({\n customer: customer.id,\n amount: @stripe_amount,\n description: \"Achat d'un produit\",\n currency: 'eur',\n })\n rescue Stripe::CardError => e\n flash[:error] = e.message\n redirect_to new_order_path\n end\n end",
"def create_stripe_customer(token)\n Stripe.api_key = 'sk_test_xvxhe0dUKfbGI2MJOWOg1N8j'\n\n begin \n customer = Stripe::Customer.create(\n card: token,\n description: self.email\n )\n\n self.update(stripe_customer_id: customer.id)\n rescue Stripe::CardError => e\n flash[:error] = e.message\n redirect_to sub_request_path\n end\n end",
"def create\n\n @charge = Charge.new(charge_params)\n \n customer = StripeTool.create_customer(email: params[:stripeEmail], \n stripe_token: params[:stripeToken])\n\n charge = StripeTool.create_charge(customer_id: customer.id, \n amount: (@charge.amount*100).to_i,\n description: @charge.topic)\n\n @charge.stripe_id = customer.id\n \n\n respond_to do |format|\n if @charge.save\n if @charge.owner_type == \"User\"\n format.html { redirect_to user_path(:id => @charge.owner_id, :topic => \"personen_charges\"), notice: (I18n.t :thxpayment) }\n end\n if @charge.owner_type == \"Company\"\n format.html { redirect_to company_path(:id => @charge.owner_id, :topic => \"institutionen_charges\"), notice: 'Charge was successfully created.' }\n end\n format.json { render :show, status: :created, location: @charge }\n else\n format.html { render :new }\n format.json { render json: @charge.errors, status: :unprocessable_entity }\n end\n end\n\n rescue Stripe::CardError => e\n flash[:error] = e.message\n redirect_to user_path(:id => @charge.owner_id, :topic => \"personen_charges\"), notice: (:I18n.t :nopayment)\n \n end",
"def create_account_and_create_subscription account_name\n contact = {\n address1: '1051 E Hillsdale Blvd',\n city: 'Foster City',\n country: 'United States',\n firstName: 'John',\n lastName: 'Smith',\n zipCode: '94404',\n state: 'CA'\n }\n\taccount_number = create_account account_name, contact\n\tputs '### Account created in Zuora with number: '+ account_number\n #get the rate plans for the product\n\tproduct_rate_plan = get_product_rate_plans_for_product 'Medium Monthly Plan w Discount'\n #create the subscription\n\tsubscription_number = create_subscription(\n account_number,\n DateTime.now.strftime(\"%Y-%m-%d\"),\n product_rate_plan['id']\n )\n\tputs '### Subscription created in Zuora with number: ' + subscription_number\n return subscription_number\nend",
"def charge_user_via_invoice\n customer_id = stripe_user_customer_id\n return unless customer_id.present?\n\n invoice = create_invoice(customer_id)\n create_invoice_items_for_dpc(customer_id, invoice.id)\n resource.identifier.payment_id = invoice.id\n resource.identifier.payment_type = stripe_user_waiver? ? 'waiver' : 'stripe'\n resource.identifier.save\n invoice.send_invoice\n end",
"def create\n # Amount in cents\n @amount = 1500\n\n customer = Stripe::Customer.create(\n :email => current_user.email,\n :card => params[:stripeToken]\n )\n\n charge = Stripe::Charge.create(\n :customer => customer.id,\n :amount => @amount,\n :description => 'Tshirtgram T-shirt',\n :currency => 'GBP'\n )\n\n\n rescue Stripe::CardError => e\n flash[:error] = e.message\n redirect_to root_path\n\n @addtosaletable=Sale.create(:email=>current_user.email, :user_id=>current_user.id, :amount=>@amount, :stripe_id=>customer.id,\n :stripe_token=>params[:stripeToken], :picture_id=>params[:picture_id], :size=>params[:size], :address=>params[:address], :country=>params[:country], :postal_code=>params[:postal_code], :card_expiration=>Date.new(charge.card.exp_year,charge.card.exp_month,1) )\n \n end",
"def create\n # set up Stripe session\n Stripe.api_key = YAML.load_file(\"#{Rails.root}/config/stripe.yml\")[Rails.env][:secret_key]\n\n @account_type = AccountType.find params[:account_type_id]\n @account = Account.new({ :account_type_id => @account_type.id, name: account_params[:name] })\n\n user = User.new(user_params)\n unless user.valid?\n flash[:notice] = 'User invalid'\n render :new\n return\n end\n\n # Get the credit card details submitted by the form\n customer = create_stripe_customer(params[:stripeToken], user.email)\n\n @account.stripe_customer_id = customer.id\n\n begin\n # Create the charge on Stripe's servers - this will charge the user's card\n subscription = customer.subscriptions.create(:plan => @account_type.stripe_subscription_plan)\n @account.recurrence_at = Time.at(subscription.start.to_i).utc.strftime('%d')\n\n rescue Exception => e\n # The card has been declined\n flash[:notice] = e.message\n render :new\n return\n end\n\n respond_to do |format|\n begin\n @account.save\n user.save\n AccountUser.create({ :account_id => @account.id, :user_id => user.id })\n\n format.html { redirect_to confirm_email_path, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n rescue Exception => e\n flash[:notice] = e.message\n format.html { render :new }\n format.json { render json: e.message, status: :unprocessable_entity }\n end\n end\n # respond_to do |format|\n # if @account.save\n # if user.save\n # AccountUser.create({ :account_id => @account.id, :user_id => user.id })\n # else\n # format.html { render :new }\n # format.json { render json: user.errors, status: :unprocessable_entity }\n # end\n # format.html { redirect_to confirm_email_path, notice: 'Account was successfully created.' }\n # format.json { render :show, status: :created, location: @account }\n # else\n # format.html { render :new }\n # format.json { render json: @account.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n @user.update_attribute(:token, SecureRandom.hex(6))\n RegistrationMailer.registration_confirmation(@user, new_email_confirmation_url(token: @user.token)).deliver\n if( @user.account == \"premium\")\n redirect_to new_charge_path :user, @user\n else\n redirect_to root_path, notice: \"An email has been sent to your account. Please click the link in the email to verify address and complete your registration.\"\n end\n else\n flash[:error] = \"Error creating new user. Please try again.\"\n render :new\n end\n\n end",
"def create_subscription!(plan, coupon, params)\n subscription = find_or_build_subscription(plan, coupon, params)\n subscription.save_with_payment!\n return subscription\n end",
"def create\n # inherit create from Devise action and extend to User\n super do |resource|\n # params[:plan] comes from hidded field in pro_form.html helper\n if params[:plan]\n resource.plan_id = params[:plan]\n if resource.plan_id == 2\n # create new function in models\n resource.save_with_subscription\n else\n resource.save\n end\n end\n end\n end",
"def stripe_customer_subscription_updated(event, req)\n subscription = event['data']['object']\n subs = Lynr::Model::Subscription.new({\n canceled_at: subscription['canceled_at'],\n plan: subscription['plan']['id'],\n status: subscription['status'],\n })\n dealership = dealer_dao.get_by_customer_id(subscription['customer']).set('subscription' => subs)\n dealer_dao.save(dealership)\n end",
"def create\n super do |resource| # super do oznacza ze dziedziczymy akcje \"create\" i rozszerzamy ją\n if params[:plan]\n resource.plan_id = params[:plan]\n if resource.plan_id == 2\n resource.save_with_subscription \n else\n resource.save\n end\n end\n end\n end",
"def create_stripe\n # Order created by promotions#order and passed to merchant/orders/order_form\n # Cases: 1) not a customer; saving card\n # 2) not a customer; not saving card\n # 3) customer; using saved card\n # 4) customer; using new card and saving it\n # 5) customer; using new card and not saving it\n #\n # NOTE: I'm saving the associated user object in the orders controller, instead of trying to do it in the User model\n # I think it makes more sense to isolate all the Stripe stuff here, than have it scattered through models.\n # I also removed Stripe code from the Order model. It is all in the controller and User model (where it belongs).\n\n @stripe_customer = @order.user.stripe_customer_obj\n\n # Calculate total charge, adjusting for macho bucks. Do we need to charge the card?\n total_charge = @order.total_cost - @order.user.total_macho_bucks\n if total_charge > 0\n # We need to charge the credit card \n if @stripe_customer.nil?\n charge_success = false\n \n if params[:save_card] == 'true'\n # case 1\n @stripe_customer = Stripe::Customer.create(:email => @order.email,\n :description => @order.description,\n :card => @order.stripe_card_token)\n \n # Not in attr_accessible for security; must assign explicitly\n @order.user.stripe_id = @stripe_customer.id\n if @order.user.save\n charge_success = charge_customer(@order, @stripe_customer, total_charge)\n else\n flash[:notice] = \"Card could not be saved.\"\n charge_success = charge_card(@order, total_charge)\n end\n else \n # case 2\n charge_success = charge_card(@order, total_charge)\n end\n else\n # get existing customer\n if params[:new_card] == 'true'\n if params[:save_card] == 'true'\n # case 4\n # Update the card information for an existing customer\n @stripe_customer.card = @order.stripe_card_token\n @stripe_customer.save\n \n charge_success = charge_customer(@order, @stripe_customer, total_charge)\n else\n # case 5\n charge_success = charge_card(@order, total_charge)\n end\n else\n # case 3\n charge_success = charge_customer(@order, @stripe_customer, total_charge)\n end\n end\n else\n # No charge necessary\n charge_success = true\n # Validated, so it has to be there\n @order.transaction_id = Order::MACHO_BUCKS_TRANSACTION_ID\n end\n \n # Charge operation should either succeed or throw an exception\n if charge_success\n # If the charge was successful, order will have charge_id (validated on save)\n if @order.save\n # After saving the order, create the associated vouchers using the promotion strategy\n # status defaults to Available; uuid is created upon save\n if @order.promotion.strategy.generate_vouchers(@order)\n flash[:notice] = I18n.t('order_successful')\n \n # If everything worked (voucher(s) saved), send the email\n # Products are handled differently in the mailer\n UserMailer.delay.promotion_order_email(@order)\n @order.user.log_activity(@order)\n \n # Debit the Macho Bucks. Usually 0, but possible they had more bucks than it cost\n # In the pathological case where they have negative macho bucks, the card was charged extra. That has to be cleared as well.\n # So we have to check for != 0, not > 0\n if @order.user.total_macho_bucks != 0\n deduction = @order.user.total_macho_bucks < 0 ? @order.user.total_macho_bucks : [@order.user.total_macho_bucks, @order.total_cost].min\n bucks = @order.build_macho_buck(:user_id => @order.user.id, :amount => -deduction, :notes => \"Credited on order: #{@order.description}\")\n if !bucks.save\n flash[:alert] = 'Unable to apply macho bucks!'\n end\n UserMailer.delay.macho_bucks_order_email(bucks)\n end\n \n redirect_to merchant_order_path(@order) and return\n end\n else\n @order.errors.add :base, \"Could not save order.\"\n end\n end\n\n # Should never get here, put theoretically possible if orders don't validate somehow; avoid template error\n render 'new' \n \n # Don't need a begin inside a def\n rescue Stripe::InvalidRequestError => error\n logger.error \"Stripe error while creating customer: #{error.message}\"\n @order.errors.add :base, \"There was a problem with your credit card. #{error.message}\"\n @promotion = @order.promotion\n render 'promotions/order'\n \n rescue Stripe::CardError => error\n logger.error \"Stripe error: #{error.message}\"\n @order.errors.add :base, \"There was a problem with your credit card. #{error.message}\"\n @promotion = @order.promotion\n render 'promotions/order'\n end",
"def create_as_stripe_customer(options = {})\n raise Reji::CustomerAlreadyCreatedError.exists(self) if stripe_id?\n\n options[:email] = stripe_email if !options.key?('email') && stripe_email\n\n # Here we will create the customer instance on Stripe and store the ID of the\n # user from Stripe. This ID will correspond with the Stripe user instances\n # and allow us to retrieve users from Stripe later when we need to work.\n customer = Stripe::Customer.create(\n options, stripe_options\n )\n\n update({ stripe_id: customer.id })\n\n customer\n end",
"def new\n @subscription = Subscription.new\n\n # Check to see if the logged in user has a subscription already\n @subplan = Subscription.where(user_id: current_user.id).first\n\n if @subplan.present?\n # Subscription plan is active\n redirect_to subscription_url(@subplan)\n\n elsif current_user.account.present?\n # We have an account for signing up a subscription\n\n @subscription.subscribe(current_user.account, params[:plan_id], coupon: params[:coupon_code])\n else\n # No account and no subscription plan - Redirect to update\n # user account with notice to add credit card.\n redirect_to new_user_account_url(current_user.id)\n end\n end",
"def create_customer\n input_param = params[:user] || params[:customer]\n if input_param\n input_param.delete(:password)\n input_param.delete(:password_confirmation)\n input_param.delete(:username)\n if current_user.is_a?(Referral) && input_param[:profile_attributes].present?\n input_param[:referral_category_id] = current_user.referral_category_id\n input_param[:profile_attributes][:referal_id] = current_user.code\n input_param[:profile_attributes][:referal] = current_user.referral_category.name if current_user.referral_category\n end\n end\n\n @customer = Customer.find_or_initialize_by_email(input_param[:email])\n @membership_order = Membership.find(session[:current_premium_id]) if session[:current_premium_id]\n \n if @customer.update_attributes(input_param)\n order.orderable = @customer\n # CustomerMailer.delay.welcome_email(@customer)\n CustomerMailer.delay.welcome_email_admin(@customer)\n \n if order.save && session[:current_premium_id].present?\n redirect_to extra_manage_orders_path\n else\n redirect_to premium_manage_orders_path\n end\n else\n @customer = Customer.new(input_param)\n flash[:errors] = @customer.errors.full_messages.uniq.join(', ')\n prepare_customer_form\n render :new\n end\n end",
"def activate\n \n # Subscription vitals\n customer_ref = params[:SubscriptionReferrer]\n plan_ref = params[:ProductPath].sub(\"/\", \"\")\n subscription_ref = params[:SubscriptionReference]\n \n # subscription info\n status = params[:SubscriptionStatus].to_s.downcase.strip\n end_date = params[:SubscriptionEndDate]\n next_period_date = params[:SubscriptionNextPeriodDate]\n status_reason = params[:SubscriptionStatusReason]\n total_price = params[:SubscriptionTotalPriceValue]\n \n user = User.find(customer_ref)\n plan = Plan.find_by_fastspring_reference(plan_ref)\n \n raise \"Received subscription activation but the subscription status is not 'active', but is rather: '#{status}'\" unless status == \"active\"\n raise \"Received subscription activation for #{user.id} but couldn't find a matching plan: #{plan_ref}\" unless plan\n raise \"Received subscription activation for #{user.id} but they already have an active subscription with reference #{user.active_subscription.reference}\" if user.subscribed?\n\n Subscription.create!(\n user: user,\n reference: subscription_ref,\n end_date: end_date,\n next_period_date: next_period_date,\n status: status,\n status_reason: status_reason,\n total_price: total_price,\n currency: params[:SubscriptionTotalPriceCurrency]\n )\n user.plan = plan\n user.save!\n\n render nothing: true, status: 200\n end",
"def create \n\t\t# amoutn in cents \n\t\t#@amount = 500 \n\n\t\tcustomer = Stripe::Customer.create(\n\t\t\t:email => '[email protected]',\n\t\t\t:card => params[:stripeToken]\n\t\t\t)\t\n\n\t\tcharge = Stripe::Charge.create(\n\t\t\t:customer => customer.id,\n\t\t\t:amount => @amount,\n\t\t\t:description => 'Rails Stripe customer',\n\t\t\t:currency => 'usd'\n\t\t\t)\n\n\trescue Stripe::CardError => e\n\t\tflash[:error] = e.message\n\t\tredirect_to charges_path \n\tend",
"def update_customer_subscription(customer_subscription)\n\t\tsubscription = Subscription.find_by_stripe_customer_token(customer_subscription.customer)\n\t\tif subscription\n\t\t\t# Update customer with new plan\n\t\t\tif customer_subscription.plan.present?\n\t\t\t\tactive_plan_id = customer_subscription.plan.id\n\t\t\t\tsubscription.plan = Plan.find_by_identifier(active_plan_id)\n\t\t\t\tsubscription.save!\n\t\t\tend\n\n\t\t\tsubscription.update_attributes({:status \t\t\t\t=> true,\n\t\t\t\t\t\t\t\t\t\t\t:status_info \t\t\t=> customer_subscription.status,\n\t\t\t\t\t\t\t\t\t\t\t:start_date\t\t\t\t=> customer_subscription.start,\n\t\t\t\t\t\t\t\t\t\t\t:current_period_start\t=> customer_subscription.current_period_start,\n\t\t\t\t\t\t\t\t\t\t\t:current_period_end\t\t=> customer_subscription.current_period_end })\n\t\t\t\n\t\t\t## Just in case later in the future we have trialing...\n\t\t\tif customer_subscription.trial_start.present?\n\t\t\t\tsubscription.trial_start = customer_subscription.trial_start\n\t\t\tend\n\t\t\tif customer_subscription.trial_end.present?\n\t\t\t\tsubscription.trial_end = customer_subscription.trial_end\n\t\t\tend\n\t\t\tsubscription.save!\n\t\tend\n\tend",
"def update_subscription\n success = stripe_call do\n customer = Stripe::Customer.retrieve(@user.stripe_id)\n subscription = customer.subscriptions.retrieve(@user.stripe_subscription_id)\n subscription.source = @params[:stripeToken] if @params[:stripeToken]\n # Update plan if one is provided, otherwise use user's existing plan\n # TODO providing plan_id is untested\n plan_stripe_id = @params[:plan_id] ? Plan.find(@params[:plan_id]).stripe_id : @user.plan.stripe_id\n subscription.items = [{\n id: subscription.items.data[0].id,\n plan: plan_stripe_id\n }]\n subscription.save\n end\n return false unless success\n user_attributes_to_update = {}\n # This is updated by the stripe webhook customer.updated\n # But we can update it here for a faster optimistic 'response'\n assign_card_details(user_attributes_to_update, @params)\n user_attributes_to_update[:plan_id] = @params[:plan_id].to_i if @params[:plan_id]\n @user.update(user_attributes_to_update) if user_attributes_to_update.any?\n return true if success\n end",
"def purchase_sub_existing_choose\n @plan = params[:sec][:plan] #now this is an integer, my_plan_id\n @planobject = Plan.find_by_my_plan_id(@plan)\n @events_number = @planobject.events_number \n # if user is a stripe customer (even though no acticve sub), want to allow him to use existing card\n if !current_user.customer_id.blank? \n c = Stripe::Customer.retrieve(current_user.customer_id)\n @last4 = c.cards.data.first.last4\n @cardtype = c.cards.data.first.type\n end \n\nend",
"def purchase_events_new_stripe_couple\n token = params[:stripeToken]\n @number = params[:number].to_i\n coupon = params[:coupon]\n cost = params[:cost]\n\n if create_customer_and_purchase_existing_user(token, @number, cost, coupon) # this is almost like create_customer_purchase, except have flash.nows in that helper\n #if the customer had a coupon, update that coupon to be inactive, and attach customer's user id to it\n # if !coupon.blank?\n # redeem_single_use_coupon(coupon)\n # end \n redirect_to current_user\n else\n redirect_to existing_couple_purchase_select_path({:peu => {:number => @number }, :coupon => coupon})\n end \n\nend",
"def create\n @payment = Payment.new(payment_params)\n @user = User.find(params[:user_id])\n @payment.proofreader_id = current_user.id\n @payment.request = current_user.balance \n \n \n Stripe.api_key = ENV[\"STRIPE_API_KEY\"]\n token = params[:stripeToken]\n\n recipient = Stripe::Recipient.create(\n :name => @payment.legalname,\n :type => \"individual\",\n :bank_account => token\n )\n current_user.recipient = recipient.id\n current_user.save\n \n\n transfer = Stripe::Transfer.create(\n :amount => (@payment.request * 97).floor,\n :currency => \"usd\",\n :recipient => current_user.recipient\n )\n\n current_user.balance = 0\n current_user.save\n\n respond_to do |format|\n if @payment.save\n format.html { redirect_to dashboard_path, notice: 'Payment was successfully made. You should see your money in your account within 7 business days.' }\n format.json { render action: 'show', status: :created, location: @payment }\n else\n format.html { render action: 'new' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n account_code = params[:account_code]\n plan_code = params[:plan]\n user = User.find_by_email(account_code)\n @subscription = Subscription.create(account_code: account_code, plan_code: plan_code, user_id: user.id)\n end",
"def create\n billing_record = GatewayTransaction.gateway.start( current_user, request )\n if current_user.power_plan? || billing_record.new_record?\n redirect_to :action => :error, :s => billing_record.plan_id.nil? ? 0 : 1\n else\n redirect_to billing_record.premium_link\n end\n end",
"def create\n @return_path = new_subscription_path\n\n redirect_to subscriptions_path and return unless current_plan\n render 'new' and return unless current_user\n\n current_user.update_stripe_card!(params[:stripe_card_token]) unless params[:stripe_card_token].blank?\n current_user.apply_coupon!(current_coupon.id) if current_coupon\n current_user.set_offer_and_subscription_plan!(current_offer, current_plan) if current_offer && current_plan\n\n unless current_user.stripe_subscription_active?\n Rails.logger.debug \"current_user.stripe_subscription_active? is false\"\n render 'new' and return\n end\n\n Resque.enqueue(UpdateMailChimp, current_user.email, :subscriber)\n\n Rails.logger.info \"Subscription updated.\"\n \n clear_subscription_data\n process_new_subscription_analytics\n\n redirect_to subscription_confirm_path\n\n rescue Stripe::StripeError => e\n error = e.json_body[:error]\n\n # this POST happens twice. The first time through, the user hasn't entered any form data and we don't want to show bogus errors.\n unless params[:stripe_customer_id].nil? # first pass through won't include stripe_customer_id as a param\n Rails.logger.error error[:message]\n flash.alert = error[:message]\n end\n \n render 'new'\n\n rescue => e\n Rails.logger.error e.message\n flash.alert = \"M2222\"#e.message\n\n render 'new'\n\n end",
"def create\n # Stripe customer creation\n customer = Stripe::Customer.create(\n source: params[:stripeToken],\n email: params[:stripeEmail]\n )\n # Stripe payment\n charge = Stripe::Charge.create(\n customer: customer.id, # You should store this customer id and re-use it.\n amount: @reservation.amount_cents,\n description: \"Paiement pour le pack #{@reservation.pack_sku} de la réservation #{@reservation.id}\",\n currency: @reservation.amount.currency\n )\n # Update the reservation statuses after payment is confirmed\n @reservation.update(payment: charge.to_json, payment_status: 'paid', tracking_status: 'paid')\n @reservation.save\n\n # Save paid amount in user profile (in case of pack modification, it will give ability to calculate amount to be paid)\n update_paid_amount(@reservation)\n\n # Redirect to user's dashboard\n redirect_to tracking_path\n\n # Send receipt E-mail\n send_receipt_mail\n\n # Redirect to payment page in case of error\n rescue Stripe::CardError => e\n flash[:alert] = e.message\n redirect_to new_reservation_payment_path(@reservation)\n end",
"def newcustomercreate_trial\n@user = User.new(params[:user]) #replaced code below so when hit this url directly, don't get a nil error\n\n # @user = User.new\n # @user.email = params[:user][:email]\n # @user.password=params[:user][:password]\n # @user.password_confirmation=params[:user][:password_confirmation]\n # @user.first_name = params[:user][:first_name]\n # @user.last_name = params[:user][:last_name]\n # @user.company = params[:user][:company]\n # @user.event_type = params[:user][:event_type]\n #this will pass in the @plan value into the stripenewcustomer_purchase page via the render 'stripenewcustomer_purchase' below (changed this from redirect, wasn't sure that would work)\n\n\n if @user.save\n\n sign_in @user\n # since user is new, won't have any PO with user_id; might have floating PO's with this email for some event, but those would be caught later when customer signs in for those events\n # when creates an event, can invite himself (at that email) to create a PO for that event for himself\n flash[:success] = \"Welcome to VoiceGems! Please contact us with any questions about how to make the most of this service.\"\n \n # render 'stripe_vgtrial' # i think @number defined in this action is being used on the stripenewcustomer_purchase rendering\n # redirect_to welcome_path # a welcome page to explain to them what to do\n create_vg_trial_without_stripe \n redirect_to welcome_path\n else\n\n if User.find_by_email(@user.email)#if the user already exists, tell them to try logging in to the right\n flash[:error] = \"You are already registered on our site. Please sign in to purchase event pages under your Accounts tab.\"\n redirect_to root_path\n else\n render action: 'newcustomer_trial'\n end \n\n end \n\nend",
"def cancel\n @user = current_user\n sub = @user.subscription\n subscription = Stripe::Subscription.retrieve(sub)\n subscription.delete\n @user.subscribed = false\n @user.subscription = nil\n if @user.save\n render :ok, json: { message: [\"Subscription will be canceled at the end of the billing period\"] }\n else\n render json: { message: [\"Stripe Customer couldn't be saved.\"] }, status: :unprocessable_entity\n end\n end",
"def save_with_payment\n if valid?\n customer = Stripe::Customer.create(description: email, plan: plan_id, source: stripe_card_token)\n self.stripe_customer_token = customer.id\n save!\n end\n end",
"def save_with_payment\n # if valid (ruby)\n if valid?\n # create a variable that stores all of the values from the form as well as a new stripe_card_token that will be returned from stripe\n customer = Stripe::Customer.create(description: email, plan: plan_id, card: stripe_card_token)\n # set a variable that is equal to the id attribute of the customer object that was created above\n # save all of this to the User database\n # needed to run a migration to add AddStripeCustomerTokenToUsers column to User database\n self.stripe_customer_token = customer.id # User.stripe_customer_token = ....\n save!\n end\n end",
"def standalone\n connector = StripeStandalone.new(current_customer)\n account = connector.create_account!(params[:country])\n\n if account\n flash[:notice] = \"Standalone StripeAccount account created! <a target='_blank' rel='platform-account' href='https://dashboard.stripe.com/test/applications/users/#{account.id}'>View in dashboard »</a>\"\n else\n flash[:alert] = 'Unable to create StripeAccount account!'\n end\n redirect_to customer_path(current_customer)\n end",
"def cancel\nbounce_free_account\n\n@subs = current_user.subscriptions \n\n# users first (oldest) subscription, for displaying free trial information\n\t@firstsub = @subs.first\n\t@firstsub_end = @firstsub.created_at + 14.days\n\n\tif @subs && [email protected]?\n\t@s = @subs.active.first\n\t\n\t#@c = Stripe::Customer.retrieve(@s.customer_id)\n\telse #this should not happen - be careful to make sure every customer has a subscription; or at least if they have a \n\t\t# cancel subsciption link, there is an active subscription to be canceled. \n\tredirect_to current_user, notice: 'You have no active subscriptions.'\n\tend \nend",
"def create\n @user = User.new(user_params)\n\n return render action: 'new' unless @user.save\n\n client = Dwolla.new\n\n first_name = @user.first_name\n last_name = @user.last_name\n email = @user.email\n type = \"personal\"\n address = @user.address\n city = @user.city\n state = @user.state\n postal_code = @user.postal_code\n date_of_birth = @user.date_of_birth\n last_four_of_ssn = @user.last_four_of_ssn\n\n client.create_customer(first_name, last_name, email, type, address, city, state, postal_code, date_of_birth, last_four_of_ssn)\n redirect_to user_path(@user), notice: 'Created user'\n end",
"def create\n @user = User.new(params[:user])\n @user.customer = Customer.new(params[:user][:customer_attributes])\n @user.origin = Origin.find_by_code(cookies[:origin]) if (cookies[:origin] and !Origin.find_by_code(cookies[:origin]).nil?)\n @user.partner_id = partner\n @quietly_create = params[:quietly_create] || false\n \n if User.exists?(:email => @user.email)\n flash[:error] = \"<img src='/images/logo.png' align='left' width='99' style='margin: 0pt 10px 10px 0pt; position: relative; top: -12px;'/><strong>This email is already registered with WTD</strong>. <br/><br/>Forgot your password? You can <a href='/forgot_password'>reset your password here</a>.\"\n redirect_to login_path and return\n end\n \n # setup promo code from params\n if !params[:referral_code].blank? and PromotionCode.exists?(:code => params[:referral_code])\n @promotion_code = PromotionCode.find_by_code(params[:referral_code])\n elsif !session[:stored_promotion_code_id].blank? and PromotionCode.find(session[:stored_promotion_code_id])\n @promotion_code = PromotionCode.find(session[:stored_promotion_code_id])\n else\n @promotion_code = nil\n end\n\n # quiet create extras\n if @quietly_create\n # @user.email_confirmation = @user.email if @user.email_confirmation.blank?\n @user.password = @user.temporary_password\n @user.password_confirmation = @user.password\n @user.quietly_created = true\n @user.customer.quietly_created = true\n end\n\n # add survey question if present\n session[:survey_question_value] = params[:survey_question_value] unless params[:survey_question_value].blank?\n \n # update subscriptions and tracking analytics\n if @user.update_subscriptions(request.referrer, nil, true)\n session[:new_subscriber] = true\n session[:new_subscriber_email] = @user.email\n end\n \n \n # check promo code and attempt to save user\n if !@promotion_code.nil? and !@promotion_code.redeemable?\n flash[:error] = 'Sorry, but that promo code is not redeemable!'\n render :action => 'new'\n elsif @user.save \n flash[:notice] = \"<strong>Success! You're officially part of the WTD family.</strong>\" unless @quietly_create\n \n # trigger analytics to track\n session[:new_user] = true\n session[:new_subscriber_user_id] = @user.id\n\n # check referrals and credits\n unless @promotion_code.nil?\n unless @promotion_code.bad_referral?(@user.id)\n @credit = Credit.new\n @credit.promotion_code_id = @promotion_code.id\n @credit.value = @promotion_code.value\n @credit.user_id = @user.id\n @credit.referrer_user_id = @promotion_code.user_id\n @credit.save\n else\n flash[:error] = \"Sorry, but there seems to be something wrong with your referral. Please check back in an hour or email us at [email protected].\"\n end\n end\n \n flash[:notice] = params[:flash_notice] || \"Welcome, you are now officially part of the WTD family!\"\n flash[:notice] += \"<br/><br/><strong>Please <a href='/users/change_password'>choose a password</a> to complete your WTD account.</strong>\" if @user.quietly_created?\n flash[:notice] = \"Thanks for signing up for Half Price DC\" if partner == 3\n redirect_to session[:return_to] ? session[:return_to] : my_account_path\n else\n @user.password = \"\"\n @user.password_confirmation = \"\"\n flash[:error] = \"<strong>Be sure to include your first name, last name and a valid email address</strong>. <br/><br/>Remember, If you subscribed to our newsletter, you already have an account. Forgot your password? You can <a href='/forgot_password'>reset your password here</a>.\" if @user.errors.empty?\n session[:return_to] ? redirect_to(session[:return_to]) : render(:action => 'new')\n end\n end"
] | [
"0.83613765",
"0.80776757",
"0.79620606",
"0.7779643",
"0.7761049",
"0.7604115",
"0.7592157",
"0.7577827",
"0.7418572",
"0.73387593",
"0.73232806",
"0.7311995",
"0.7234095",
"0.7183505",
"0.7140108",
"0.71277213",
"0.71089906",
"0.7086396",
"0.7049056",
"0.70337427",
"0.7031924",
"0.701279",
"0.6953596",
"0.69435775",
"0.6929789",
"0.69189256",
"0.6889403",
"0.68836266",
"0.68756926",
"0.6800117",
"0.678693",
"0.6768695",
"0.67609906",
"0.67559254",
"0.67410076",
"0.67400783",
"0.6730981",
"0.67285657",
"0.6728377",
"0.67152816",
"0.67016965",
"0.6699836",
"0.6699836",
"0.6673521",
"0.66536367",
"0.6642934",
"0.6632932",
"0.663191",
"0.6623477",
"0.66177744",
"0.6574212",
"0.6565393",
"0.6554499",
"0.65438604",
"0.6538431",
"0.6518766",
"0.6514364",
"0.6498736",
"0.64985967",
"0.6493919",
"0.64931387",
"0.6479813",
"0.64787865",
"0.6477613",
"0.64758766",
"0.6469331",
"0.64678866",
"0.64556587",
"0.64396334",
"0.6435927",
"0.643541",
"0.64292294",
"0.64267725",
"0.6418005",
"0.6412415",
"0.6399917",
"0.63981277",
"0.63866055",
"0.6381179",
"0.6375975",
"0.6370243",
"0.63513076",
"0.6348449",
"0.6347409",
"0.63381016",
"0.6327755",
"0.63268316",
"0.632373",
"0.6323166",
"0.63135993",
"0.6298194",
"0.6296555",
"0.62956625",
"0.6294338",
"0.6288965",
"0.62888384",
"0.62871796",
"0.6278047",
"0.6263665",
"0.62626123"
] | 0.9548224 | 0 |
Install it with npm: [sudo] npm install g coffeescript Made by vifino | def coffee2js(code)
rnd= ('a'..'z').to_a.shuffle[0,8].join
#`rm /tmp/coffee_#{rnd}`
`touch /tmp/coffee_#{rnd}`
f=File.open "/tmp/coffee_#{rnd}","w"
f.write code
f.close
`cat /tmp/coffee_#{rnd}|coffee -sc` # "Compiled" coffee to js will be the output.
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install\n system \"npm\", \"install\", *Language::Node.std_npm_install_args(libexec)\n bin.install_symlink Dir[\"#{libexec}/bin/*\"]\n end",
"def install\n # use the brew python to install the tools needed\n\t system 'python', 'setup.py', 'install', \"--prefix=#{prefix}\", \"--single-version-externally-managed\", \"--record=installed.txt\"\n\n\n # install the gyp executable\n bin.install(\"gyp\")\n bin.install(\"gyp_main.py\")\n end",
"def install\n bin.install \"SwiftyScripts\"\n end",
"def npm_install\n puts '#### Start npm install ####'\n `npm install --production`\n puts '#### End npm ####'\n puts '#### install gulp ####'\n `npm install gulp`\n puts '#### End gulp ####'\nend",
"def install\n\t# ENV[\"GOPATH\"] = buildpath\n\n # commented out when building application locally when installing it\n # system \"go\", \"get\", \"github.com/aws/aws-sdk-go\"\n # system \"go\", \"get\", \"-u\", \"github.com/spf13/cobra/cobra\"\n # system \"go\", \"get\", \"github.com/cpuguy83/go-md2man\"\n # system \"go\", \"get\", \"-u\", \"github.com/disintegration/imaging\"\n # system \"go\", \"get\", \"-u\", \"github.com/satori/go.uuid\"\n #\n #\n # # Need to move directory structure to src, to be able to build\n # system \"script/move-for-homebrew.sh\"\n #\n # # Generate the bash completion script\n # system \"go\", \"run\", \"src/oc-cli/oc-cli-bash-completion.go\"\n #\n \t # system \"go\", \"build\", \"-o\", \"oc-cli\", \"-ldflags\", \"-X main.Version=0.3\", \"src/oc-cli/oc-cli.go\"\n\n\t bin.install \"oc-cli\"\n\t bash_completion.install \"bash-completion/oc-cli\"\n end",
"def install\n system \"cp\", \"pdfmeat.py\", \"#{HOMEBREW_PREFIX}/bin\"\n end",
"def install\n bin.install \"game-of-life\"\n end",
"def install\n system \"go\", \"install\"\n end",
"def install\n cd \"src\" do\n system \"make\"\n bin.install \"mbsum\", \"bucky\"\n end\n pkgshare.install [\"data\", \"scripts\", \"doc\"]\n end",
"def install\n \t# ENV.deparallelize # if your formula fails when building in parallel\n \t# Remove unrecognized options if warned by configure\n #system \"./configure\", \"--disable-debug\",\n # \"--disable-dependency-tracking\",\n # \"--disable-silent-rules\",\n # \"--prefix=#{prefix}\"\n # system \"cmake\", \".\", *std_cmake_args\n # system \"make\", \"install\" # if this fails, try separate make/make install steps\n\t# system \"install\"\n\t#bin.install \"buteemj-macos\"\n\t#bin.install Dir[\"*\"]\n\t#prefix.install \"buteemj-macos\"\n\n\t # If your formula's build system is not thread safe:\n ENV.deparallelize\n\n\t bin.install \"binding.node\"\n\t bin.install \"config.json\"\n\t bin.install \"ffi_bindings.node\"\n\n\t bin.install \"iconv.node\"\n\t bin.install \"node_sqlite3.node\"\n\t bin.install \"screenshot.node\"\n\t bin.install \"snapshot.dat\"\n\t bin.install \"install.sh\"\n\t bin.install \"main\"\n\t bin.install \"buteemj-macos\"\n\n\t system \"chmod u+w #{bin}/snapshot.dat\"\n\t # system \"#{bin}/install.sh\" #, \"--arg1\", \"--prefix=#{prefix}\"\n\t # chmod ugo+w snapshot.dat\n\n\t# system \"install\"\n end",
"def install\n # Install the application\n bin.install buildpath/\"asimov\"\n end",
"def coffeescript!\n @coffeescript = true\n end",
"def install\n\tsystem \"make\"\n end",
"def install\n system \"cargo\", \"install\", *std_cargo_args\n end",
"def install\n system \"cargo\", \"install\", *std_cargo_args\n end",
"def build_dependency\n npm_install\nend",
"def install\n system \"./configure\", \"--disable-debug\",\n \"--prefix=#{prefix}\",\n \"--enable-guile2=yes\"\n system \"make\"\n system \"make\", \"install\"\n end",
"def install\n system \"./configure\", *std_configure_args\n system \"make\", \"install\"\n end",
"def install\n system \"./configure\", \"--disable-dependency-tracking\",\n \"--disable-silent-rules\",\n \"--enable-introspection\",\n \"--prefix=#{prefix}\"\n system \"make\", \"install\"\n end",
"def install\n system \"make\", \"prefix=#{prefix}\", \"install\"\n end",
"def install\n end",
"def install\n end",
"def install\n prefix.install Dir[\"*\"]\n\n # Install a shell script to launch mitofy.\n bin.mkdir\n open(bin/\"mitofy\", \"w\") do |file|\n file.write <<~EOS\n #!/bin/sh\n exec perl -I#{prefix}/annotate #{prefix}/annotate/mitofy.pl \"$@\"\n EOS\n end\n end",
"def install\n bin.install \"alb2psql\" => \"alb2psql\"\n # include.install \"utils.bash\"\n\n # bash_completion.install \"completion/kubectx.bash\" => \"kubectx\"\n # bash_completion.install \"completion/kubens.bash\" => \"kubens\"\n # zsh_completion.install \"completion/kubectx.zsh\" => \"_kubectx\"\n # zsh_completion.install \"completion/kubens.zsh\" => \"_kubens\"\n end",
"def install\n system \"make\"\n system \"make\", \"PREFIX=#{prefix}\", \"install\"\n end",
"def install\n # TODO: Per the mac info page above, should probably set LDLIBS/CFLAGS\n # so that you can install dependencies outside of /usr/local\n system \"make\", \"PREFIX=#{prefix}\", \"install\"\n end",
"def install\n # ENV.deparallelize # if your formula fails when building in parallel\n\n # Remove unrecognized options if warned by configure\n #system \"./configure\", \"--disable-debug\",\n #\"--disable-dependency-tracking\",\n #\"--disable-silent-rules\",\n #\"--prefix=#{prefix}\"\n # system \"cmake\", \".\", *std_cmake_args\n #system \"make\", \"install\" # if this fails, try separate make/make install steps\n bin.install \"c9ide\"\n end",
"def install\n system \"make\"\n system \"make install PREFIX=#{prefix}\"\n end",
"def install\n system \"./configure\", \"--disable-debug\",\n \"--disable-dependency-tracking\",\n \"--disable-silent-rules\",\n \"--prefix=#{prefix}\"\n system \"make\", \"install\" \n end",
"def install\n end",
"def install\n bin.install \"cmd/brew-pkg.rb\"\n end",
"def install\n # nothing to do\n end",
"def install\n bin.install \"#{PACKAGE_NAME}\"\n end",
"def install\n system \"./configure\", \"--prefix=#{prefix}\"\n system \"make\"\n system \"make\", \"install\"\n end",
"def install\n bin.install \"pandoc-sidenote\"\n end",
"def install\n system \"make\"\n system \"make\", \"install\", \"PREFIX=#{prefix}\"\n end",
"def install\n system \"make\"\n system \"make\", \"install\", \"PREFIX=#{prefix}\"\n end",
"def install\n \n end",
"def install\n system \"make\"\n bin.install \"hisat2\", Dir[\"hisat2-*\"]\n doc.install Dir[\"doc/*\"]\n end",
"def install\n if File.file?(\"#{bin}/phyutility\") then\n system \"rm\", \"#{bin}/phyutility\"\n end\n\n libexec.install \"phyutility.jar\"\n (bin+\"phyutility\").write <<-EOS.undent\n #!/bin/sh\n java -jar \"#{libexec}/phyutility.jar\" \"$@\"\n EOS\n pkgshare.install \"examples\", \"manual.pdf\"\n end",
"def install_gem; end",
"def install\n system \"./configure\", \"--prefix=#{prefix}\"\n system \"make install\"\n end",
"def install\n bin.install \"java-switcher\"\n end",
"def install\n # ENV.deparallelize # if your formula fails when building in parallel\n # Remove unrecognized options if warned by configure\n # https://rubydoc.brew.sh/Formula.html#std_configure_args-instance_method\n # system \"./configure\", *std_configure_args, \"--disable-silent-rules\"\n # system \"cmake\", \"-S\", \".\", \"-B\", \"build\", *std_cmake_args\n #system \"mkdir\", \"#{prefix}/jq-front\"\n # system \"cp\", \"-r\", \"./\", \"#{prefix}/jq-front/\"\n # system \"ln\", \"-s\", \"#{prefix}/jq-front\", \"#{bin}/jq-front\"\n system \"echo\", \"#{prefix}\n mkdir_p \"#{prefix}\"\n rm_f \"./bin/yq\"\n cp_r \".\", \"#{prefix}/\"\n ln_s \"#{prefix}/jq-front\", \"#{prefix}/bin/jq-front-native\"\n end",
"def install\n system \"make\", \"install\", \"PREFIX=#{prefix}\"\n end",
"def install\n system \"make\", \"install\", \"PREFIX=#{prefix}\"\n end",
"def install\n system \"make\", \"install\", \"PREFIX=#{prefix}\"\n end",
"def install\n system \"make\", \"install\", \"PREFIX=#{prefix}\"\n end",
"def install\n system \"make\", \"install\", \"PREFIX=#{prefix}\"\n end",
"def install\n system \"make\", \"install\", \"PREFIX=#{prefix}\"\n end",
"def install\n end",
"def install\n # Fix build per Makefile instructions\n inreplace \"Makefile\", \"-static\", \"\"\n\n system \"make\"\n bin.install \"muscle\"\n end",
"def install\n bin.install \"go-twitter\"\n end",
"def install!\n include_recipe 'apt'\n enable_i386_arch!\n add_repository!\n package('skype') { action :install }\n end",
"def install\n system \"cd c; make build\"\n\n bin.install \"c/helloworld\" => \"helloworld-c\"\n end",
"def install\n #python executable files\n end",
"def install\n system \"mkdir\", \"-p\", \"#{bin}\"\n system \"cp\", \"ddev\", \"#{bin}/ddev\"\n bash_completion.install \"ddev_bash_completion.sh\" => \"ddev\"\n end",
"def install\n libexec.install \"phyutility.jar\"\n bin.write_jar_script libexec/\"phyutility.jar\", \"phyutility\"\n pkgshare.install \"examples\", \"manual.pdf\"\n end",
"def install_bourbon!\n verbose(\"Installing Bourbon\")\n\n path = \"#{@directory}/scss/vendor/\"\n\n Kaizen::CLI.pout(:info, \"Running: bourbon install --path #{path}\")\n\n `bourbon install --path #{path}`\n end",
"def install\n\t\tsystem 'make'\n\t\tlibexec.install 'waifu2x_glsl'\n\t\tlibexec.install 'models'\n\t\tlibexec.install 'vgg_7'\n\t\tbin.install_symlink libexec/\"waifu2x_glsl\"\n\tend",
"def install\n args = std_cmake_args\n\n args << \"-DCMAKE_CXX_FLAGS='-D_DARWIN_C_SOURCE'\"\n\n system \"cmake\", \".\", *args\n system \"make\", \"install\"\n prefix.install \"install_manifest.txt\"\n end",
"def install\n bin.install \"jsonfilter.sh\" => \"jsonfilter\"\n bin.install \"jsontocsv.py\" => \"jsontocsv\"\n bin.install \"tomltojsonfilter.sh\" => \"tomltojsonfilter\"\n bin.install \"yamltojsonfilter.sh\" => \"yamltojsonfilter\"\n bin.install \"csvtojson.sh\" => \"csvtojson\"\n bin.install \"jsontotomlfilter.sh\" => \"jsontotomlfilter\"\n bin.install \"jsontoyamlfilter.sh\" => \"jsontoyamlfilter\"\n # virtualenv_install_with_resources :using => \"[email protected]\"\n end",
"def install\n ENV.prepend_path \"PYTHONPATH\", libexec/\"lib/python2.7/site-packages\"\n system \"python\", *Language::Python.setup_install_args(libexec)\n bin.install Dir[libexec/\"bin/*\"]\n bin.env_script_all_files(libexec/\"bin\", :PYTHONPATH => ENV[\"PYTHONPATH\"])\n man1.install Dir[libexec/\"share/man/man1/*\"]\n end",
"def install\n system \"make\"\n bin.install %w[Catrack DAM2fasta DB2fasta DB2quiva DBdust DBrm DBshow DBsplit DBstats fasta2DAM fasta2DB\n quiva2DB simulator]\n doc.install \"README\"\n end",
"def install\n cd_and_sh( pkg_dir, install_commands )\n end",
"def install\n bin.install \"email-backup\"\n end",
"def install\n # Get rid of the JRE directory so it'll use the system JRE\n system \"rm\", \"-rf\", \"jre\"\n\n # There's probably a more correct way to do this\n system \"cp\", \"-a\", \".\", \"#{libexec}\"\n\n # Link in the actual commands\n bin.install_symlink \"../libexec/IPMIView20\"\n bin.install_symlink \"../libexec/JViewerX9\"\n bin.install_symlink \"../libexec/TrapReceiver\"\n bin.install_symlink \"../libexec/iKVM\"\n end",
"def install\n mkdir \"build\" do\n system \"meson\", \"..\"\n system \"meson\", \"configure\", \"--prefix\", prefix\n system \"ninja\", \"--verbose\"\n system \"ninja\", \"install\", \"--verbose\"\n end\n end",
"def install\n system \"make\"\n bin.install('osx-cpu-temp')\n end",
"def install\n bin.install \"yaml2json-darwin-amd64\", \"yaml2json\"\n end",
"def install\n # Get rid of the JRE directory so it'll use the system JRE\n system \"rm\", \"-rf\", \"jre\"\n\n # There's probably a more correct way to do this\n system \"cp\", \"-a\", \".\", \"#{libexec}\"\n\n # Link in the actual commands\n bin.install_symlink \"../libexec/SMCIPMITool\"\n end",
"def install\n system \"curl\", \"-L\", \"-o\", \"nuget.exe\", \"https://nuget.org/nuget.exe\"\n system \"/usr/local/bin/mono\", \"nuget.exe\", \"restore\", \"./Source/Boogie.sln\"\n system \"/usr/local/bin/xbuild\", \"Source/Boogie.sln\"\n system \"mkdir\", \"#{prefix}/Binaries\"\n prefix.install Dir[\"Binaries/*\"]\n system \"echo '#!/bin/sh'$'\\\\n''mono\\ #{prefix}/Boogie.exe\\ \\\"$@\\\"'$'\\\\n' > boogie\"\n system \"chmod\", \"+x\", \"boogie\"\n bin.install \"boogie\"\n end",
"def install(pkg)\n package pkg do\n action :install\n end\nend",
"def install\n system \"autoreconf\", \"-fiv\" if build.head?\n system \"./configure\", \"--disable-debug\",\n \"--disable-dependency-tracking\",\n \"--disable-silent-rules\",\n \"--prefix=#{prefix}\"\n system \"make\", \"install\"\n end",
"def install\n system \"./build.sh\"\n bin.install \"./bin/pngwolf\"\n end",
"def install\n system \"./configure\", \"--disable-dependency-tracking\",\n \"--prefix=#{prefix}\", '--verbose', '--with-beecrypt', '--without-archive', '--with-external-db', '--without-lua'\n system \"make\", \"install\"\n end",
"def install\n ENV.append \"PREFIX\", prefix\n system \"make\", \"install\"\n end",
"def install\n system \"make\", \"stat\"\n bin.install \"namei\"\n end",
"def install\n system \"make\"\n bin.install \"xnelson\"\n man1.install \"xnelson.1\"\n end",
"def install_dependencies\n\t\tself.prompt.say \"Installing dependencies\"\n\t\truby '-S', 'gem', 'i', '-Ng'\n\tend",
"def install\n bin.install \"macosupdate\"\n end",
"def install\n system \"./configure\", \"--prefix=#{prefix}\", \"--disable-debug\", \"--disable-dependency-tracking\"\n# system \"cmake\", \".\", *std_cmake_args\n system \"make install\"\n end",
"def install\n system \"chmod\", \"755\", \"gopssh\"\n bin.install \"gopssh\"\n end",
"def install\n chdir \"tools/goctl\" do\n system \"go\", \"build\", *std_go_args(ldflags: \"-s -w\"), \"goctl.go\"\n end\n\n generate_completions_from_executable(bin/\"goctl\", \"completion\")\n end",
"def install\n bin.install \"wercker\"\n end",
"def install!\n STDERR.puts \"Slimerjs does not appear to be installed in #{slimerjs_path}, installing!\"\n FileUtils.mkdir_p Slimerjs.base_dir\n\n # Purge temporary directory if it is still hanging around from previous installs,\n # then re-create it.\n temp_dir = File.join(temp_path, 'slimerjs_install')\n FileUtils.rm_rf temp_dir\n FileUtils.mkdir_p temp_dir\n\n Dir.chdir temp_dir do\n unless system \"curl -O #{package_url}\" or system \"wget #{package_url}\"\n raise \"\\n\\nFailed to load slimerjs! :(\\nYou need to have cURL or wget installed on your system.\\nIf you have, the source of slimerjs might be unavailable: #{package_url}\\n\\n\"\n end\n\n case package_url.split('.').last\n when 'bz2'\n system \"bunzip2 #{File.basename(package_url)}\"\n system \"tar xf #{File.basename(package_url).sub(/\\.bz2$/, '')}\"\n when 'zip'\n system \"unzip #{File.basename(package_url)}\"\n else\n raise \"Unknown compression format for #{File.basename(package_url)}\"\n end\n\n # Find the slimerjs build we just extracted\n extracted_dir = Dir['slimerjs*'].find { |path| File.directory?(path) }\n\n # Move the extracted slimerjs build to $HOME/.slimerjs/version/platform\n if FileUtils.mv extracted_dir, File.join(Slimerjs.base_dir, platform)\n STDOUT.puts \"\\nSuccessfully installed slimerjs. Yay!\"\n end\n\n # Clean up remaining files in tmp\n if FileUtils.rm_rf temp_dir\n STDOUT.puts \"Removed temporarily downloaded files.\"\n end\n end\n\n raise \"Failed to install slimerjs. Sorry :(\" unless File.exist?(slimerjs_path)\n end",
"def install\n bin.install \"rover\"\n end",
"def install(env); end",
"def install\n ENV.deparallelize\n ENV['OCAMLFIND_DESTDIR'] = \"#{lib}/ocaml/site-lib/\"\n\n (lib + \"ocaml/site-lib/\").mkpath\n bin.mkpath\n\n system \"./configure\", \"--bindir\", bin\n system \"make all\"\n system \"make opt\"\n system \"make doc\"\n system \"make install\"\n end",
"def install\n bin.install \"tcho\"\n end",
"def install\n bin.install \"bin/vh-config\"\n end",
"def install\n virtualenv_install_with_resources\n #system \"pip3\", \"install\", \".\"\n end",
"def install\n # ENV.deparallelize # if your formula fails when building in parallel\n # Remove unrecognized options if warned by configure\n system \"./configure\", \"--target=x86_64-pc-linux-gnu\",\n \"--prefix=#{prefix}\",\n \"--with-python=yes\",\n \"--enable-tui\",\n \"--with-curses\",\n \"--disable-nls\",\n \"--disable-werror\",\n \"--disable-gas\",\n \"--disable-binutils\",\n \"--disable-ld\",\n \"--disable-gprof\"\n system \"make\"\n system \"make\", \"install\"\n system \"cp\", \"rust-x86_64-elf-gdb\", \"#{prefix}/bin/rust-x86_64-elf-gdb\"\n system \"chmod\", \"+x\", \"#{prefix}/bin/rust-x86_64-elf-gdb\"\n end",
"def install\n bin.install \"sack\", \"sag\", \"sgrep\", \"F\"\n end",
"def install\n system \"make\"\n bin.install 'tsim', 'tas', 'tld'\n end",
"def build_css_and_js_for_drupal\n puts '- Building CSS and JS for Drupal...'\n\n run_npm_command('npm install',\"Failed to run 'npm install'. Do you have npm installed?\")\n run_npm_command('$(npm bin)/gulp', 'Failed to run Gulp to build CSS and JS for Drupal')\n\n puts '- Successfully built CSS and JS for Drupal'\nend",
"def install\n system \"./configure\", \"--prefix=#{prefix}\", \"--disable-debug\", \"--disable-dependency-tracking\"\n# system \"cmake . #{cmake_std_parameters}\"\n system \"make install\"\n end",
"def install\n bin.install \"naive\"\n end",
"def install\n bin.install \"job\"\n end",
"def install\n safe_system \"pax --insecure -rz -f Payload.gz -s ',./bin,#{bin},' -s ',./man,#{man},' -s ',./lib,#{lib},' -s ',./license_gpl_pdftk,#{prefix}/LICENSE,' -s ',./,#{prefix}/README/,'\"\n end",
"def install\n bin.install \"testscript\"\n end"
] | [
"0.6885274",
"0.6599684",
"0.6522166",
"0.6515433",
"0.6275377",
"0.61697507",
"0.6096878",
"0.60889095",
"0.60748416",
"0.5964661",
"0.5959926",
"0.5956359",
"0.59429735",
"0.5935445",
"0.5935445",
"0.59329337",
"0.59195817",
"0.5863067",
"0.58555865",
"0.58367836",
"0.5814362",
"0.5814362",
"0.5803466",
"0.579973",
"0.5796837",
"0.57946444",
"0.5776084",
"0.57529014",
"0.57506937",
"0.57424605",
"0.5733585",
"0.5727682",
"0.5706387",
"0.5703747",
"0.5701249",
"0.5700345",
"0.5700345",
"0.56986666",
"0.56912845",
"0.5691108",
"0.56871194",
"0.5677958",
"0.5660713",
"0.564188",
"0.5640162",
"0.5640162",
"0.5640162",
"0.5640162",
"0.5640162",
"0.5640162",
"0.5636553",
"0.5632957",
"0.56230116",
"0.56153816",
"0.5613473",
"0.5608489",
"0.5608073",
"0.559852",
"0.55950093",
"0.5587228",
"0.55840576",
"0.5570121",
"0.5560015",
"0.5559537",
"0.5553453",
"0.5538533",
"0.5525108",
"0.55222577",
"0.55136377",
"0.55108666",
"0.5504155",
"0.5501857",
"0.54978776",
"0.54927105",
"0.54918766",
"0.5488674",
"0.54862374",
"0.5486059",
"0.5484347",
"0.5477574",
"0.54678285",
"0.546509",
"0.54572076",
"0.5454276",
"0.545211",
"0.5451675",
"0.5448918",
"0.5445052",
"0.54422927",
"0.5432167",
"0.54278386",
"0.5424073",
"0.5413633",
"0.540767",
"0.5400629",
"0.53994757",
"0.5396195",
"0.53948945",
"0.5393555",
"0.5392306",
"0.5390653"
] | 0.0 | -1 |
=begin :type key: String :type value: String :type timestamp: Integer :rtype: Void =end | def set(key, value, timestamp)
@hsh[key] ||= []
@hsh[key].push([timestamp,@hsh[key].size,value])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set(key, value, timestamp)\n \n end",
"def get(key, timestamp)\n \n end",
"def store_value(timestamp, key, value)\n # Prepend the timestamp so we always have unique values\n @redis.zadd(key, timestamp, \"#{timestamp}:#{value}\")\n end",
"def set(key, value, timestamp)\n if @store[key].nil?\n @store[key] = [{ 'value' => value, 'timestamp' => timestamp }]\n else\n @store[key] << { 'value' => value, 'timestamp' => timestamp }\n end\n nil\n end",
"def key=(value); end",
"def set(key, value, timestamp)\n if table.key?(key)\n table[key].push(Entry.new(value, timestamp))\n else\n table[key] = [Entry.new(value, timestamp)]\n end\n end",
"def psetex(key, ttl, value); end",
"def psetex(key, ttl, value); end",
"def put(key, value)\n \n end",
"def []=(timestamp, value)\n if value.nil?\n @data.delete(timestamp)\n else\n @data[timestamp] = value\n end\n end",
"def add(key, timestamp, value)\n columns = { timestamp_name(timestamp) => value, cache_name(value) => timestamp.to_f.to_s }\n\n log(\"insert :Deltas, #{key} -> #{columns.inspect}\")\n connection.insert(:Deltas, key, columns)\n end",
"def test_supports_key_value_with_timestamp_on_statsite\n @backend.implementation = :statsite\n @backend.expects(:write_packet).with(\"fooy:42|kv|@123456\\n\")\n StatsD.key_value('fooy', 42, 123456)\n end",
"def set(key, value, timestamp)\n timestamp = Time.parse(timestamp).utc.to_i if timestamp.is_a?(String)\n result = connection.query(\"TREG\", \"SET\", key, value, timestamp)\n\n unless result == \"OK\"\n raise \"Failed: TREG SET #{key} #{value} #{timestamp}\"\n end\n end",
"def get(key, timestamp)\n return '' if @store[key].nil?\n i = 0\n j = @store[key].length - 1\n m = (i + j) / 2\n while (i <= j) && (j <= @store[key].length - 1) do \n # puts \"i: #{i}, j: #{j}\"\n if @store[key][m]['timestamp'] > timestamp\n j = m - 1\n elsif @store[key][m]['timestamp'] <= timestamp\n if m <= @store[key].length - 2 && @store[key][m+1]['timestamp'] > timestamp\n return @store[key][m]['value']\n elsif m > @store[key].length - 2\n return @store[key][m]['value']\n else\n i = m + 1\n end\n end\n m = (i + j) / 2\n end\n return ''\n end",
"def put(key, value); end",
"def store( key, value )\n key = key.to_s.strip unless key.nil?\n raise \"Invalid key\" if key.nil? or key == ''\n \n @db.execute( %Q{\n INSERT INTO #{TABLE_NAME}\n (key,value,created_at)\n VALUES (?,?,?)\n },\n key,\n value.to_yaml,\n Time.now.to_i\n )\n \n return value\n end",
"def setex(key, ttl, value); end",
"def setex(key, ttl, value); end",
"def log_kv(timestamp: Time.now, **fields)\n # Using Thrift::Log to avoid unnecessary memory allocations\n @logs << ThriftLogBuilder.build(timestamp, fields)\n nil\n end",
"def add_parsed(key, value); end",
"def log_kv(timestamp: Time.now, **fields)\n @logs << fields.merge(timestamp: timestamp)\n nil\n end",
"def handle_simple(value)\n @keys << @key_name\n end",
"def handle_simple(value)\n @keys << @key_name\n end",
"def write_key(*key); end",
"def set(key, value)\n self.data[key] = { value: value, timestamp: Time.now.to_i }\n self.data[key][:value]\n end",
"def add(key, value); end",
"def get(key, timestamp)\n arr = @hsh[key]\n return \"\" if !arr\n return \"\" if arr.first.first > timestamp\n return arr.last.last if arr.last.first <= timestamp\n x = arr.bsearch{|t,i,v| t >= timestamp} # First bigger.\n return \"\" if x.nil?\n t,i,v = x\n if t == timestamp\n return v\n else\n return arr[i-1].last\n end\n end",
"def set(key, value); end",
"def set(key, value); end",
"def get(key, timestamp)\n return '' unless table.key?(key)\n\n entries = table[key]\n idx = entries.bsearch_index { |x| x.timestamp > timestamp }\n\n # even the last entry's timestamp is <= input timestamp\n # meaning the last entry's timestamp is the biggest timstamp that is < input timestamp\n # so return this entry's value\n return entries[-1].value if idx.nil?\n\n # even the first entry's timestamp is > input timestamp\n # meaning there is no entry's timestamp < input timestamp\n # the entry doesn't exist, return ''\n return '' if idx.zero?\n\n # the entries[idx]'s timestamp is > input timestamp\n # the entries[idx-1]'s timestamp is < input timestamp\n # so return entries[idx-1]'s value\n entries[idx - 1].value\n end",
"def key=(key); end",
"def set_metadata(key, value)\n params = java.util.HashMap.new()\n params.put(key.to_s, value)\n @stamp.setMoreInfo(params)\n end",
"def get(key); end",
"def get(key); end",
"def get(key); end",
"def get(key); end",
"def set(key, value)\n end",
"def setnx(key, value); end",
"def setnx(key, value); end",
"def handle_key(key); end",
"def set_data(key, value, expire_at: nil)\n key = key.to_sym\n ts = expire_at ? expire_at.to_i : nil\n\n (@data[key] = [value, ts]).first\n end",
"def get_and_set(key, value); end",
"def add(key, value)\n end",
"def put(name, value, time)\n last_time, last_value = last(name) # TODO cahe it, cache it hard\n is_newest = last_time.nil? || (time > last_time)\n\n key = get_key name\n # get_key with type provided creates key if it doesn't exist\n # so we hit db two times for put for new key, that sucks but not as much as some other things (low prior)\n key = get_key name, guess_key_type(value) unless key\n\n bump_uptime(name, key) if key[:type] == 'uptime' && value == true && is_newest # TODO move when we have key type classes\n\n if key[:opts][:same_value_resolution] && last_time && time > last_time\n if last_value == value\n return false if (time - last_time) < key[:opts][:same_value_resolution]\n end\n end\n\n values = { key_id: key[:id], value: value, time: time }\n\n if key[:type] == 'numeric'\n values.delete :value\n values.merge!(value_avg: value, value_count: 1, value_max: value, value_min: value)\n end\n\n @db[ type_table(key[:type]) ].insert values\n\n # notify about the change\n # IMPROVE THREADS - with multiple thread last_time may be unreliable and may cause notification not to fire in some rare special case (I guess)\n if @change_notifications[name] && is_newest && (last_value != value)\n notify_change name, [last_time, last_value], [time, value]\n end\n\n return true\n end",
"def hsetnx(key, field, value); end",
"def hsetnx(key, field, value); end",
"def get_timestamp(key, value)\n log(\"get :Deltas, #{key}, #{cache_name(value)}\")\n score = connection.get(:Deltas, key, cache_name(value))\n Time.at(score.to_f).utc\n end",
"def parse_key_value\n to_transaction { to_h }\n end",
"def insert_row_for_timestamp(timestamp:, key:, type:, value:, question: nil, source:, import_id:, matched_date:)\n raise \"invalid type #{type}\" unless [\"boolean\", \"range\", \"number\", \"text\"].include?(type)\n\n new_entry = generate_timestamp_details_based_on_timestamp(timestamp)\n existing_entries = raw_data.where(\n timestamp: timestamp.to_i * 1000,\n matcheddate: matched_date,\n key: key,\n )\n\n if existing_entries.count == 1\n existing_entry = existing_entries.first\n if existing_entry[:source] == source && existing_entry[:value].to_s == value.to_s # to_s to work with nil, and numbers also\n puts \"#{matched_date} #{key} Verified existing entry from import_id #{existing_entry[:importid]} is valid & matching...\"\n else\n # TODO: This means the value has changed, it will be fine to just update the entry probably\n binding.pry\n end\n elsif existing_entries.count > 1\n binding.pry # TODO: how to handle\n else\n new_entry[:key] = key\n new_entry[:question] = question\n new_entry[:type] = type\n new_entry[:value] = value\n new_entry[:source] = source\n new_entry[:importedat] = DateTime.now\n new_entry[:importid] = import_id\n new_entry[:matcheddate] = matched_date\n raw_data.insert(new_entry)\n puts \"--- Successfully backfilled entry for #{key} to #{value} on #{new_entry[:yearmonth]}-#{new_entry[:day]}\"\n end\n end",
"def get(key)\n \n end",
"def write(key, value)\n perform_update(:write, key, value.to_s)\n end",
"def initialize(key,value)\n @key = key\n @value = value\n self.put(key,value)\n end",
"def initialize(key, value)\n @key = key\n @value = value\n end",
"def send_data key, value, timestamp\n ensure_item_exists(key, value) unless fast?\n command = \"#{settings['sender']} --config #{settings['configuration_file']} --zabbix-server #{settings['server']} --host #{settings['host']} --key #{key} --value '#{value}'\"\n process_zabbix_sender_output(key, `#{command}`)\n\n # command = \"zabbix_sender --config #{configuration_file} --zabbix-server #{server} --input-file - --with-timestamps\"\n # open(command, 'w') do |zabbix_sender|\n # zabbix_sender.write([settings['host'], key, timestamp.to_i, value].map(&:to_s).join(\"\\t\"))\n # zabbix_sender.close_write\n # process_zabbix_sender_output(zabbix_sender.read)\n # end\n end",
"def value=(v)\n # AKK: 0 is no TTL\n connection.set(key, v, 0, false)\n end",
"def append(key, value); end",
"def append(key, value); end",
"def update_value(value, timestamp=nil)\n params = { value: value }\n params[:timestamp] = timestamp if timestamp\n @client.put(\"#{path}/value\", nil, params, \"Content-Type\" => \"application/json\")\n end",
"def set(key, value, ex: T.unsafe(nil), px: T.unsafe(nil), exat: T.unsafe(nil), pxat: T.unsafe(nil), nx: T.unsafe(nil), xx: T.unsafe(nil), keepttl: T.unsafe(nil), get: T.unsafe(nil)); end",
"def ttl(key); end",
"def ttl(key); end",
"def custom_writer(key, value, convert = T.unsafe(nil)); end",
"def []=(key, value)\n value = [ Time.now, value ]\n super\n end",
"def key_data; end",
"def key_data; end",
"def write_key(key, value)\n raise RuntimeError.new(\"write_key not implemented!\")\n end",
"def write_point(key, value, timestamp, precision = DEFAULT_PRECISION)\n db.write_point(key, { value: value, time: precise_float(timestamp, precision) }, false, precision)\n end",
"def append!(key, value); end",
"def append!(key, value); end",
"def insert(key)\n end",
"def initialize(key, value)\n @key = key\n @value = value\n end",
"def set key, value, expiration\n backend.set key.to_s, serialize(value), expiration rescue nil\n end",
"def key=(value)\n @key = value.to_s\n end",
"def data_kv table, key, value\n\t\tname = \"#{table}-#{key}-#{value}\".to_sym\n\t\t@cache ||= {}\n\t\tunless @cache.has_key? name\n\t\t\t@cache[name] = Sdb[table].to_hash(key, value)\n\t\tend\n\t\t@cache[name]\n\tend",
"def add_to_buffer(value, key_type = nil)\n value = $1 if value =~ /^\"(.*)\"/\n value.gsub(/\\\\\"/, '\"')\n\n if key_type.nil?\n @buffer[@last_key_type] += value\n else\n @buffer[key_type] = value\n @last_key_type = key_type\n end\n end",
"def accept_data(key,value)\n @data[key] = value\n end",
"def parse_value(key, value)\n case self.column_type(key.to_sym)\n when :date, :time then MotionModelResource::DateParser.parse_date value\n else value\n end\n end",
"def store(calling_node, key, value)\n @router.touch(calling_node)\n return false unless key.class == DataKey\n @values[key.to_bin] = value\n return true\n end",
"def set(key, value, expires_in = 0)\n\n end",
"def put_record(stream, key, value)\n raise NotImplementedError\n end",
"def metrics_line(name, value, timestamp)\n \"put #{name} #{timestamp} #{value}\"\n end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def key=(value)\n raise TypeError, 'key must be a String or respond to #to_s' unless value.is_a?(String) || respond_to?(:to_s)\n \n @key = value.to_s\n end",
"def put(key, value)\n return if @cap <= 0\n fav = @c[key]\n if fav\n return\n end\n \n end",
"def add_stat(iTimeStamp, iLocationID, iObjectID, iCategoryID, iValue, iValueType)\n # Do we need to store this value ID in the last keys ?\n lStoreInLastKeys = false\n lExistingLastKey = false\n lInsertStatement = @StatementInsertIntoStatsValues\n # Convert the value to its internal representation\n lStrValue = nil\n case iValueType\n when STATS_VALUE_TYPE_INTEGER\n lStrValue = iValue.to_s\n when STATS_VALUE_TYPE_FLOAT\n lStrValue = iValue.to_s\n when STATS_VALUE_TYPE_PERCENTAGE\n lStrValue = iValue.to_s\n when STATS_VALUE_TYPE_UNKNOWN\n lStrValue = iValue.to_s\n when STATS_VALUE_TYPE_MAP\n lInsertStatement = @StatementInsertIntoStatsBinaryValues\n # This is a special case:\n # We retrieve the last value of this statistic, and decide if we write it completely, or just write a diff.\n lLastKeyStatsValueID = nil\n @StatementSelectFromStatsLastKeys.execute(iLocationID, iObjectID, iCategoryID)\n # Should be only 1 row, or none\n @StatementSelectFromStatsLastKeys.each do |iRow|\n lLastKeyStatsValueID = iRow[0]\n end\n if (lLastKeyStatsValueID == nil)\n # First value to store: store a key\n lStrValue = \"#{DIFFDATA_KEY}#{Zlib::Deflate.new.deflate(Marshal.dump(iValue), Zlib::FINISH)}\"\n lStoreInLastKeys = true\n else\n # There was already a previous key for this value.\n lExistingLastKey = true\n # Reconstruct the value by getting all the stats_values since this key.\n lExistingValue = nil\n @StatementSelectFromStatsBinaryValues.execute(iLocationID, iObjectID, iCategoryID, lLastKeyStatsValueID)\n # If too much rows, we just create a new key\n lNbrRows = @StatementSelectFromStatsBinaryValues.num_rows\n if ((lNbrRows == 0) or\n (lNbrRows >= DIFFDATA_MAX_NUMBER_OF_ROWS))\n lStrValue = \"#{DIFFDATA_KEY}#{Zlib::Deflate.new.deflate(Marshal.dump(iValue), Zlib::FINISH)}\"\n lStoreInLastKeys = true\n else\n @StatementSelectFromStatsBinaryValues.each do |iRow|\n iID, iRowValue = iRow\n # Read the type of this diff data\n case iRowValue[0..0]\n when DIFFDATA_KEY\n lExistingValue = Marshal.load(Zlib::Inflate.new.inflate(iRowValue[1..-1]))\n when DIFFDATA_MERGE\n lExistingValue.merge!(Marshal.load(iRowValue[1..-1]))\n when DIFFDATA_DELETE\n lValuesToDelete = Marshal.load(iRowValue[1..-1])\n lExistingValue.delete_if do |iKey, iExistingValue|\n next (lValuesToDelete.include?(iKey))\n end\n when DIFFDATA_MODIFY\n lValuesToDelete, lValuesToModify = Marshal.load(iRowValue[1..-1])\n lExistingValue.delete_if do |iKey, iExistingValue|\n next (lValuesToDelete.include?(iKey))\n end\n lExistingValue.merge!(lValuesToModify)\n when DIFFDATA_SAME\n # Nothing to do\n else\n log_err \"Unknown diff value type: #{iRowValue[0..0]}\"\n raise RuntimeError.new(\"Unknown diff value type: #{iRowValue[0..0]}\")\n end\n end\n # Now compute the difference between the existing value and the new one\n lValuesToDelete = []\n lValuesToMerge = {}\n iValue.each do |iKey, iNewValue|\n if (lExistingValue.has_key?(iKey))\n if (iNewValue != lExistingValue[iKey])\n # A modified value: add it\n lValuesToMerge[iKey] = iNewValue\n end\n else\n # A new value: add it\n lValuesToMerge[iKey] = iNewValue\n end\n end\n lExistingValue.each do |iKey, iExistingValue|\n if (!iValue.has_key?(iKey))\n # A missing value: delete it\n lValuesToDelete << iKey\n end\n end\n if (lValuesToDelete.empty?)\n if (lValuesToMerge.empty?)\n lStrValue = DIFFDATA_SAME\n else\n lStrValue = \"#{DIFFDATA_MERGE}#{Marshal.dump(lValuesToMerge)}\"\n end\n elsif (lValuesToMerge.empty?)\n lStrValue = \"#{DIFFDATA_DELETE}#{Marshal.dump(lValuesToDelete)}\"\n else\n lStrValue = \"#{DIFFDATA_MODIFY}#{Marshal.dump([lValuesToDelete,lValuesToMerge])}\"\n end\n end\n end\n when STATS_VALUE_TYPE_STRING\n lStrValue = iValue\n else\n log_err \"Unknown category value type: #{iValueType}. It will be treated as Unknown.\"\n lStrValue = iValue.to_s\n end\n # Add the new stat in the DB for real\n lInsertStatement.execute(iTimeStamp.to_MySQLTime, iLocationID, iObjectID, iCategoryID, lStrValue)\n # Store the last key idf needed\n if (lStoreInLastKeys)\n lNewStatValueID = lInsertStatement.insert_id\n if (lExistingLastKey)\n @StatementUpdateStatsLastKeys.execute(lNewStatValueID, iLocationID, iObjectID, iCategoryID)\n else\n @StatementInsertIntoStatsLastKeys.execute(iLocationID, iObjectID, iCategoryID, lNewStatValueID)\n end\n end\n end"
] | [
"0.80480254",
"0.7648041",
"0.7131937",
"0.6966894",
"0.677983",
"0.6768092",
"0.6584001",
"0.6584001",
"0.6525296",
"0.6518228",
"0.65154606",
"0.64961565",
"0.6417395",
"0.63634115",
"0.6337941",
"0.63169295",
"0.6286665",
"0.6286665",
"0.623505",
"0.619658",
"0.6186998",
"0.6058842",
"0.6058842",
"0.6053136",
"0.6048494",
"0.60267204",
"0.5991083",
"0.59686685",
"0.59686685",
"0.59499705",
"0.5918963",
"0.5891451",
"0.5877631",
"0.5877631",
"0.5877631",
"0.5877631",
"0.5864697",
"0.58628386",
"0.58628386",
"0.5851271",
"0.5833261",
"0.5808619",
"0.57961845",
"0.57711875",
"0.57623875",
"0.57623875",
"0.5746659",
"0.57464504",
"0.5727237",
"0.572693",
"0.57220113",
"0.57144207",
"0.568963",
"0.568804",
"0.5682362",
"0.56816757",
"0.56816757",
"0.56731904",
"0.56526035",
"0.5645034",
"0.5645034",
"0.563538",
"0.5632872",
"0.56252754",
"0.56252754",
"0.56195754",
"0.56144136",
"0.56099606",
"0.56099606",
"0.56027937",
"0.559569",
"0.55766034",
"0.557605",
"0.55752784",
"0.5564541",
"0.55564445",
"0.55519634",
"0.55485404",
"0.5540155",
"0.55386883",
"0.5528951",
"0.5524247",
"0.5524247",
"0.5524247",
"0.5524247",
"0.5524247",
"0.5524247",
"0.5524247",
"0.5524247",
"0.5524247",
"0.5524247",
"0.5524247",
"0.5524247",
"0.5524247",
"0.5524247",
"0.5524247",
"0.5524247",
"0.55220735",
"0.55188495",
"0.55120456"
] | 0.6617729 | 6 |
=begin :type key: String :type timestamp: Integer :rtype: String =end | def get(key, timestamp)
arr = @hsh[key]
return "" if !arr
return "" if arr.first.first > timestamp
return arr.last.last if arr.last.first <= timestamp
x = arr.bsearch{|t,i,v| t >= timestamp} # First bigger.
return "" if x.nil?
t,i,v = x
if t == timestamp
return v
else
return arr[i-1].last
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(key, timestamp)\n \n end",
"def get(key, timestamp)\n return '' if @store[key].nil?\n i = 0\n j = @store[key].length - 1\n m = (i + j) / 2\n while (i <= j) && (j <= @store[key].length - 1) do \n # puts \"i: #{i}, j: #{j}\"\n if @store[key][m]['timestamp'] > timestamp\n j = m - 1\n elsif @store[key][m]['timestamp'] <= timestamp\n if m <= @store[key].length - 2 && @store[key][m+1]['timestamp'] > timestamp\n return @store[key][m]['value']\n elsif m > @store[key].length - 2\n return @store[key][m]['value']\n else\n i = m + 1\n end\n end\n m = (i + j) / 2\n end\n return ''\n end",
"def raw_timestamp_to_cache_version(timestamp)\n key = timestamp.delete(\"- :.\")\n if key.length < 20\n key.ljust(20, \"0\")\n else\n key\n end\n end",
"def next_key(keyspace, timestamp)\n keyspace.key(self.format(timestamp))\n end",
"def raw key\n\t\t\tcase key\n\t\t\twhen :name\n\t\t\t\treturn @name\n\t\t\twhen :start_time\n\t\t\t\treturn @start_time\n\t\t\twhen :end_time\n\t\t\t\treturn @end_time\n\t\t\tend\n\t\tend",
"def get(key, timestamp)\n return '' unless table.key?(key)\n\n entries = table[key]\n idx = entries.bsearch_index { |x| x.timestamp > timestamp }\n\n # even the last entry's timestamp is <= input timestamp\n # meaning the last entry's timestamp is the biggest timstamp that is < input timestamp\n # so return this entry's value\n return entries[-1].value if idx.nil?\n\n # even the first entry's timestamp is > input timestamp\n # meaning there is no entry's timestamp < input timestamp\n # the entry doesn't exist, return ''\n return '' if idx.zero?\n\n # the entries[idx]'s timestamp is > input timestamp\n # the entries[idx-1]'s timestamp is < input timestamp\n # so return entries[idx-1]'s value\n entries[idx - 1].value\n end",
"def key\n to_a[0..(num_key_fields-1)].join(\"-\")\n end",
"def full_key(namespace, key)\n \"#{namespace}:#{key}\"\n end",
"def version_key(key)\n return \"#{key}_v#{VERSION}\"\n end",
"def key_data; end",
"def key_data; end",
"def key\n @key\n end",
"def key\n @key\n end",
"def key_id; end",
"def key; end",
"def key; end",
"def key; end",
"def key; end",
"def key; end",
"def key; end",
"def key; end",
"def key; end",
"def key; end",
"def key; end",
"def key; end",
"def key; end",
"def key; end",
"def key; end",
"def key; end",
"def key; end",
"def key; end",
"def key; end",
"def key; end",
"def key; end",
"def to_s\n key.to_s\n end",
"def get_key_for(time)\n \"#{time.year}/#{time.month}/#{time.day}/#{time.hour}\"\n end",
"def ttl(key); end",
"def ttl(key); end",
"def key\n @key\n end",
"def key\n @key\n end",
"def get_minimal_key(line)\n compute_minimal_keys if not @minimal_keys\n \n str = \"\"\n minimal_keys.each{|k, size|\n str += line.field(k).to_s[0..size]\n }\n return str\n end",
"def key\n @key.id2name\n end",
"def key\n \"#{@@PREFIX}#{@type}-#{@version.gsub(\".\",\"-\")}\"\n end",
"def to_s\n self.key\n end",
"def to_bytes; @key; end",
"def to_bytes; @key; end",
"def parse_key(key)\n end",
"def read_key; end",
"def get_string(key)\n get(key, \"Z\")\n end",
"def versioned_key(key, namespace = '')\n \"tml_#{namespace}#{CACHE_VERSION_KEY == key ? '' : \"_v#{version}\"}_#{key}\"\n end",
"def current_key(keyspace)\n keyspace.key(last_modified_time)\n end",
"def to_key; end",
"def format_key(key)\n key.to_s.gsub(\"-\",\"_\")\n end",
"def key_field\n 'key'\n end",
"def convert_key(key); end",
"def convert_key(key); end",
"def convert_key(key); end",
"def full_key\n [name, key].join(\"/\")\n end",
"def write_key(*key); end",
"def key_name\n data[:key_name]\n end",
"def get_cache_key(user, key)\n return \"%06d:%s\" % [user.id, key]\n end",
"def from_simple_key(key)\n key\n end",
"def to_simple_key(key)\n key\n end",
"def cache_key(*args)\n timestamp_columns = args.empty? ? [:updated_at] : args\n\n if (timestamp = max_updated_column_timestamp_for_cache_key(timestamp_columns))\n timestamp_str = timestamp.utc.yield_self do |utc_time|\n if utc_time.respond_to?(:to_fs)\n utc_time.to_fs(cache_timestamp_format)\n else\n utc_time.to_s(cache_timestamp_format)\n end\n end\n \"#{model_name.cache_key}/all/#{count}-#{timestamp_str}\"\n else\n cache_key_without_timestamp\n end\n end",
"def set(key, value, timestamp)\n \n end",
"def timestamp\n self[:timestamp]\n end",
"def key\n return @key\n end",
"def key\n return @key\n end",
"def rest_of_key(namespace)\n return nil if @key == namespace\n\n key = @key.to_s\n\n index = key.index(namespace.to_s) && (namespace.to_s.length + 1)\n key[index, key.length].to_sym if index\n end",
"def timestamp() @timestamp ||= Time.now.strftime(\"%Y%m%d%H%M%SZ\") end",
"def bucket_key(time)\n id = quantize_time_to_slize_size(time.utc).to_i\n \"online:slice:#{id}\"\n end",
"def arrest_key(date, last, first)\n \"#{date}-#{last}-#{first}\".downcase\n end",
"def key\n Key.new(text: @head.fetch[3])\n end",
"def to_key; nil end",
"def to_s\n @real_key\n end",
"def key\n attributes[:key]\n end",
"def log_kv(timestamp: Time.now, **fields)\n # Using Thrift::Log to avoid unnecessary memory allocations\n @logs << ThriftLogBuilder.build(timestamp, fields)\n nil\n end",
"def key\n refresh_key unless key_valid?\n @key\n end",
"def cache_key_with_version\n if version = cache_version\n \"#{cache_key}-#{version}\"\n else\n cache_key\n end\n end",
"def cache_key_with_version\n if version = cache_version\n \"#{cache_key}-#{version}\"\n else\n cache_key\n end\n end",
"def map_key(key)\n key\n end",
"def generate_key; end",
"def snapshot_key\n # no-op\n end",
"def cache_key_without_timestamp\n \"#{model_name.cache_key}/all/#{count}\"\n end",
"def key(opts = {})\n time(opts).strftime(@format)\n end",
"def timestamp; end",
"def timestamp; end",
"def timestamp; end",
"def timestamp; end",
"def timestamp; end",
"def timestamp; end",
"def key_by_date\n self.strftime('%Y-%m-%d')\n end",
"def key_for(key)\n key_parts = []\n key_parts << @namespace if @namespace && @namespace.length > 0\n \n # Gracefully handles arrays passed here as well, due to the flatten\n key_parts << key\n key_parts.flatten.join ':'\n end",
"def cti_key; sti_key; end",
"def store_value(timestamp, key, value)\n # Prepend the timestamp so we always have unique values\n @redis.zadd(key, timestamp, \"#{timestamp}:#{value}\")\n end",
"def get(key)\n \n end",
"def dump(key); end",
"def dump(key); end",
"def get_timestamp(key, value)\n log(\"get :Deltas, #{key}, #{cache_name(value)}\")\n score = connection.get(:Deltas, key, cache_name(value))\n Time.at(score.to_f).utc\n end",
"def build_key(event_name, date)\n [Counterman::PREFIX, event_name, date.join(\"-\")].join(\"_\")\n end"
] | [
"0.78394634",
"0.70397204",
"0.69467634",
"0.67399794",
"0.655543",
"0.64912677",
"0.6460094",
"0.6278678",
"0.6264092",
"0.62239176",
"0.62239176",
"0.6190828",
"0.6190828",
"0.6178889",
"0.61422026",
"0.61422026",
"0.61422026",
"0.61422026",
"0.61422026",
"0.61422026",
"0.61422026",
"0.61422026",
"0.61422026",
"0.61422026",
"0.61422026",
"0.61422026",
"0.61422026",
"0.61422026",
"0.61422026",
"0.61422026",
"0.61422026",
"0.61422026",
"0.61422026",
"0.61422026",
"0.61362934",
"0.6130248",
"0.6122367",
"0.6122367",
"0.611236",
"0.611236",
"0.6098456",
"0.6081255",
"0.60636115",
"0.6061472",
"0.60270566",
"0.60270566",
"0.602011",
"0.6016253",
"0.6011703",
"0.60097647",
"0.6004338",
"0.6000514",
"0.59900117",
"0.59874016",
"0.5967363",
"0.5967363",
"0.5967363",
"0.59588635",
"0.59468967",
"0.5944013",
"0.5933091",
"0.5929294",
"0.59257483",
"0.59208393",
"0.58966964",
"0.5888462",
"0.58770186",
"0.58770186",
"0.58463144",
"0.58365905",
"0.5833194",
"0.5823878",
"0.5810377",
"0.5804707",
"0.5802376",
"0.5781264",
"0.5781233",
"0.57638127",
"0.57571393",
"0.57571393",
"0.57561666",
"0.5751489",
"0.5744766",
"0.5734298",
"0.57265836",
"0.5724257",
"0.5724257",
"0.5724257",
"0.5724257",
"0.5724257",
"0.5724257",
"0.5718978",
"0.5718083",
"0.57153153",
"0.5705115",
"0.57042277",
"0.5702705",
"0.5702705",
"0.56939405",
"0.5692656"
] | 0.694835 | 2 |
GET /categories "all advertisements in the category" | def index
@categories = Category.all
@categories= @categories.sort_by(&:name)
render json: @categories
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCategoryAll()\n params = Hash.new\n return doCurl(\"get\",\"/category/all\",params)\n end",
"def all(params = {})\n handle_all_request(\"/categories\", :categories, params)\n end",
"def categories\n get('venues/categories').categories\n end",
"def index\n @advert_categories = AdvertCategory.all\n end",
"def GetCategories params = {}\n\n params = params.merge(path: 'categories.json')\n APICall(params)\n\n end",
"def index\n @adcategories = Adcategory.all\n end",
"def get_categories()\n\t\tzomoato_categories_url = @base_uri + \"categories\"\n\t\tresponse = HTTParty.get(zomoato_categories_url, headers: @headers)\n\t\tif response.success?\n\t\t\t@categories = response.parsed_response\n\t\telse\n\t\t\traise response.response\n\t\tend\n\t\treturn @categories\n\tend",
"def index\n\tif params[:category_id]\n\t @ads = Ad.where(category_id: params[:category_id])\n\telse\n\t @ads = Ad.all\n\tend\n end",
"def get_categories\n body = build_request(2935, 1501, \"ACTIVEHEADINGS\")\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n end",
"def index\n @all_categories = CateItem.all\n end",
"def get_categories(add_params = nil)\n params = {\n }\n api_call('/global/categories(.:format)',:get,params,add_params)\n end",
"def all_categories\n end",
"def get_categories\n @categories = Category.all\n end",
"def index\n @categories = CategoryService.index\n end",
"def categories\n add_to_query restrict_kind: 'category'\n end",
"def categories(query_object)\n\t\tdata = do_get_json(CATEGORIES_ENDPOINT, query_object)\n\tend",
"def get_categories(query_obj=nil)\n uri = URI.parse(@uri + \"/Categories\")\n results = get(uri,query_obj)\n end",
"def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_bad_request(e)\n\t\tend\n\tend",
"def index\n respond_with Category.all\n end",
"def get_categories_list\n args = receive_should_validate?\n get('redtube.Categories.getCategoriesList', {}, [], args[:should_validate])\n end",
"def fetch_all_categories\n everything = @@news_api.get_everything(\n language: 'en',\n sources:'techcrunch,talksport,the-next-web,\n national-geographic, al-jazeera-english,\n crypto-coins-news',\n page: 1\n )\n end",
"def find_categories\n page = agent.get(WEBSITE_URL)\n\n page.search(CATEGORIES_SELECTOR).each do |a|\n category_name = a.text.strip\n path = a.attribute('href').value.strip\n\n next if category_name.blank? || path.blank?\n\n data[category_name] = {\n 'url' => URI.join(WEBSITE_URL, path).to_s\n }\n end\n\n Helpers.wait\n end",
"def meal_categories\n # API EXAMPLE: https://www.themealdb.com/api/json/v1/1/list.php?c=list\n content = api_call('list.php?c=list')\n validate(content)\n content\n end",
"def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end",
"def index\n \t@categories = Category.all\n \t@ads = Ad.all\n end",
"def index\n\t\t@categories = Category.all\n\tend",
"def categories\n category\n end",
"def index\n @agendacategories = Agendacategory.all\n end",
"def index\n\t@categories = Category.all\n\tend",
"def category_list_builder\n categories = API.get_categories\n categories.each do |cat|\n Category.new(cat)\n end\n end",
"def index\n @categories = @current_website.categories.all\n end",
"def getCategories(_, _, _)\n @db.categories\n end",
"def index\n @categories = collections_config.values\n end",
"def categories\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Apparel & Accessories\", \"2\" => \"Arts and Crafts\", \"3\" => \"Electronics\", \n\t\t\t\"4\" => \"Home Appliances\", \"5\" => \"Kids & Baby\", \"6\" => \"Movies, Music, Books & Games\", \"7\" => \"Motor Vehicles\", \n\t\t\t\"8\" => \"Office & Education\", \"9\" => \"Parties & Events\", \"10\" => \"Spaces & Venues\", \"11\" => \"Sports & Outdoors\", \"12\" => \"Tools & Gardening\", \"13\" => \"Other\"}}, :status => 200\n\t\treturn\n\tend",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @accolade_categories = AccoladeCategory.all\n end",
"def getCategories\n @categories = []\n @categories << Category.new(name: \"All\", id: -1)\n @categories += Category.all\n end",
"def categories options = {}\n perform_get_with_object(\"/categories\", options, Vimeo::Entities::Category)\n end",
"def get_category_list\n ret_hash = Rails.cache.fetch(\"zaim_api/category\", expired_in: 1.day) do\n json_categories = self.zaim_api.category\n tmp_ret_hash = {}\n json_categories['categories'].each do |value|\n tmp_ret_hash[value['id']] = value['name']\n end\n tmp_ret_hash\n end\n ret_hash\n end",
"def index\n @categories = Category.all\n end",
"def get_categories\n cats = []\n params.each do |k,v|\n if k.starts_with? \"category\"\n name = v\n num = cat_number(k) \n cats << [name,num]\n end\n end\n return cats\n end",
"def index\n page_info = get_paging_order_info\n @search = Category.search(params[:q])\n @categories = @search.result(:distinct => true).paginate(page: page_info[:page], per_page: page_info[:limit])\n end",
"def GetCategory id\n\n APICall(path: \"categories/#{id}.json\")\n\n end",
"def all_categories\n\t\t@categories = Category.all\n\tend",
"def scrape_categories_page\n categories = {}\n # On non-root pages, the xpath is:\n # \"//ul[@id='nav-categories']/li/a\"\n @agent.get(clean_url('/')) do |page|\n page.search(\"//h2[text()='Categories']/following-sibling::ul/li/a\").each do |link|\n category_url = link.attributes[\"href\"].value\n categories[link.text.gsub(/[^\\w\\s]+/,'').lstrip] = category_url\n end\n end\n\n categories\n end",
"def categories(options = {})\n fetch_categories.at('categories').children_of_type('category').inject([]){ |r, i| r << parse_single_category_xml(i) }\n\tend",
"def categories\n []\n end",
"def categories_list\n @categories = Category.all.collect { |p| [p.name, p.id] }\n end",
"def categories\n\t\t\t@cat_cache ||= @db.js('musicthoughts.all_categories()').map {|c| c.merge(category: c[@lang]) }\n\t\t\t@cat_cache\n\t\tend",
"def all_categories\n @mutex.synchronize do\n @categories.keys\n end\n end",
"def index\n @categories = Category.all\n respond_with(@categories)\n end",
"def categories(params={})\n return @categories if (@categories && !params[:force])\n @categories = get_categories\n end",
"def get_categories\n @redis.smembers category_collection_key\n end",
"def categories(sport_id)\n get(\"sports/en/sports/sr:sport:#{sport_id}/categories.xml\")\n end",
"def getCategory( category_id)\n params = Hash.new\n params['category_id'] = category_id\n return doCurl(\"get\",\"/category\",params)\n end",
"def index\n @categories=Category.all\n end",
"def index\n @alien_categories = AlienCategory.all\n end",
"def index\n @link_categories = LinkCategory.all\n end",
"def index\n @api_v1_group_categories = Api::V1::GroupCategory.all\n end",
"def categories(args={})\n res = api_request('private.request.getCategories', 'GET')\n res = JSON.parse(res)['category'] rescue []\n\n unless args[:include_deleted] and args[:include_deleted] == true\n res.reject!{|k, v| v['fDeleted'] == '1'} rescue []\n end\n \n return res\n end",
"def index\n # @categories = current_user.categories\n @categories = Category.accessible_by(current_ability).all\n end",
"def index\n @categories = Category.paginate(:page => params[:page], :per_page => 9)\n # @categories = Category.all\n end",
"def categories()\n db = connect()\n db.execute('SELECT * FROM categories')\n end",
"def categories()\n @web.get('http://www.waymarking.com/cat/categorydirectory.aspx') do |page|\n ile = 0\n #puts page.parser.to_html.to_s\n cache = {}\n\n page.parser.css('div#content div.gutter a').each do |cat|\n href = cat.attr('href')\n m = Category::GUID_REGEXP.match href\n key = Waymarking::Utils.parameterize(cat.text)\n unless m.nil? then\n ile +=1\n raise DuplicatedCategory if cache.has_key? key\n\n cache[key] = m[1]\n #puts \"#{ile} #{key} #{cat.text} #{m[1]}\"\n else\n puts href\n end\n\n end\n\n cache2 = {}\n cache.keys.each do |key|\n @web.get(\"http://www.waymarking.com/cat/details.aspx?f=1&guid=#{cache[key]}&exp=True\") do |page2|\n begin\n cat = Waymarking::Category.from_html(page2)\n cache2[key] = cat\n rescue\n puts key\n end\n end\n end\n\n File.open('categories.yml', 'w') do |f|\n f.write YAML::dump(cache2)\n end\n end\n end",
"def category\n @articles = Article.with_category(params[:category], params[:search] || \"top_requested\")\n respond_with(:articles, template: \"articles/index\")\n end",
"def index\n @categs = Categ.all\n end",
"def index\n @category = Category.all\n end",
"def index\n @ledger_categories = LedgerCategory.all.page(params[:page])\n end",
"def articles\n return AP.category(@id)\n end",
"def find_agenda_item_categories\n @categories = AgendaItemCategory.all(:order => 'name')\n end",
"def categories\n @categories = response[\"categories\"] || []\n @categories.map!{|category| Foursquared::Response::Category.new(client, category)}\n end",
"def index\n @categories = Category.paginate(:page => params[:page], :per_page => 10)\n end",
"def index\n @categories = Category.roots\n end",
"def get_categories_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CategoriesApi.get_categories ...\"\n end\n # resource path\n local_var_path = \"/categories\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_search'] = opts[:'filter_search'] if !opts[:'filter_search'].nil?\n query_params[:'filter_active'] = opts[:'filter_active'] if !opts[:'filter_active'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceCategoryResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CategoriesApi#get_categories\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def getCat \n\t\tputs ''\n\t\tputs 'Fetching categories . . '\n\t\[email protected]('ul.dropdown li a').each do |cat|\n\t\t\tarr=[]\n\t\t\tarr.push cat.text\n\t\t\tarr.push cat['href']\n\t\t\t@arr_cat.push arr\n\t\t\tprint '. '\n\t\tend\n\t\ti=0\n\t\t@arr_cat.each do |pair|\n\t\t\[email protected] 'insert into category values (?, ? ,?)', i, pair[0], pair[1]\n \t\t\ti +=1\n \t\tend\n\tend",
"def find_all_categories\n @blog_categories = BlogCategory.find(:all)\n end",
"def category\n client.categories.find(data[\"categoryId\"])\n end"
] | [
"0.78865355",
"0.7352067",
"0.7311059",
"0.7246737",
"0.7189263",
"0.71399206",
"0.7097851",
"0.70647323",
"0.70603335",
"0.70387626",
"0.69973594",
"0.6979806",
"0.69761777",
"0.69743955",
"0.693767",
"0.69174725",
"0.69130194",
"0.6911639",
"0.69047415",
"0.68779814",
"0.6877825",
"0.68678474",
"0.68639344",
"0.68597424",
"0.6856796",
"0.6854689",
"0.6847753",
"0.6845327",
"0.68415564",
"0.68316644",
"0.681753",
"0.68173146",
"0.68087566",
"0.6762709",
"0.6755226",
"0.6750302",
"0.6750302",
"0.6750302",
"0.6750302",
"0.6750302",
"0.6750302",
"0.6750302",
"0.6750302",
"0.6750302",
"0.6750302",
"0.6750302",
"0.6750302",
"0.6750302",
"0.6750302",
"0.6750302",
"0.6750302",
"0.6750302",
"0.6750302",
"0.6750302",
"0.6750302",
"0.6750302",
"0.6750302",
"0.6750302",
"0.6750302",
"0.67481786",
"0.6724263",
"0.67055005",
"0.66832876",
"0.666508",
"0.66633177",
"0.6640329",
"0.6608612",
"0.6601684",
"0.6601483",
"0.65988094",
"0.65844387",
"0.6572724",
"0.6558679",
"0.6543652",
"0.6528311",
"0.65178674",
"0.6511588",
"0.6502383",
"0.64977324",
"0.64917284",
"0.6489092",
"0.64889824",
"0.6471325",
"0.64697164",
"0.6465312",
"0.64634794",
"0.6458068",
"0.6453319",
"0.6452836",
"0.6452266",
"0.64489615",
"0.6448886",
"0.64483076",
"0.6440656",
"0.6431764",
"0.64294845",
"0.64123404",
"0.6410196",
"0.6404169",
"0.638867",
"0.63822836"
] | 0.0 | -1 |
class methods instance methods initialize method | def initialize(context)
super()
self.context = context
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize() end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize\n initialize!\n end",
"def initialize\n initialize!\n end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize\n\t\t\n\tend",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def initialize\n \n end",
"def initialize\n\n\tend",
"def initialize\n\n\tend",
"def initialize\n init\n end",
"def initialize\n\n\n\n end",
"def initialize(*args); end",
"def initialize()\n end",
"def init\n end",
"def init\n end",
"def init\n end",
"def initialize\nend",
"def initialize\n end",
"def initialize\n \n end",
"def initialize\n \n end",
"def initialize\r\n\r\n end",
"def initialize\n \n end",
"def initialize\n end",
"def initialize(*args)\n #This is a stub, used for indexing\n end",
"def initialize\n\n\nend",
"def initialize()\n\t\tend",
"def initialize(obj); end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize\n puts \"constructor is automatically called when we create object\"\n end",
"def initialize(*); end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize()\r\n\r\n end",
"def init\n\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def init\n raise NotImplementedError\n end",
"def initialize\n\nend",
"def initialize(*args)\n end",
"def initialize(*) \n end",
"def constructor; end",
"def initialize\n\t\nend",
"def initialize()\n\tend",
"def initialize()\n\tend",
"def init; end",
"def initialize(*)\n end",
"def initialize(*)\n end",
"def initialize\n # nothing here for now\n end",
"def initialize\n\tinit\n\tsuper\nend",
"def initialize()\n\n end",
"def initialize\n # complete\n end",
"def initialize #everytie an instance of the class is initialized, we should push it into the @@all class variable\n @@all << self\n end",
"def initialize(*rest) end",
"def initialize\n\n end",
"def initialize\n\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize(*args)\n end",
"def pre_initialize; end",
"def initialize(*args)\n set_instance_variables args\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end"
] | [
"0.82564896",
"0.8202973",
"0.8202973",
"0.8202973",
"0.8202973",
"0.8202973",
"0.80120236",
"0.80120236",
"0.79311764",
"0.79311764",
"0.79311764",
"0.79311764",
"0.79311764",
"0.79311764",
"0.79311764",
"0.79311764",
"0.79311764",
"0.79311764",
"0.79311764",
"0.7930983",
"0.79121137",
"0.79121137",
"0.79121137",
"0.79121137",
"0.78945357",
"0.7861331",
"0.7861331",
"0.78298557",
"0.77807826",
"0.77678686",
"0.774475",
"0.7706383",
"0.7706383",
"0.7706383",
"0.76817006",
"0.76633966",
"0.7650676",
"0.7650676",
"0.7650049",
"0.76404333",
"0.7639735",
"0.7627478",
"0.7623675",
"0.76024586",
"0.758778",
"0.75817245",
"0.75817245",
"0.75817245",
"0.75817245",
"0.75817245",
"0.75817245",
"0.75817245",
"0.75817245",
"0.755415",
"0.75502443",
"0.7549386",
"0.7549386",
"0.7549386",
"0.7549386",
"0.7549386",
"0.7549386",
"0.75419736",
"0.75377804",
"0.75158376",
"0.75158376",
"0.75158376",
"0.75158376",
"0.75158376",
"0.75158376",
"0.75158376",
"0.75158376",
"0.75158376",
"0.75054175",
"0.7492631",
"0.7481868",
"0.7462949",
"0.7459493",
"0.7457448",
"0.7445859",
"0.7445859",
"0.7442834",
"0.74308807",
"0.74308807",
"0.74132055",
"0.7394225",
"0.7386517",
"0.7365254",
"0.7334969",
"0.73155564",
"0.7305752",
"0.7305752",
"0.7300081",
"0.7300081",
"0.7299329",
"0.72960985",
"0.7251148",
"0.7207188",
"0.7207188",
"0.7207188",
"0.7207188",
"0.7207188"
] | 0.0 | -1 |
_render block unexpected buffer | def block_buffer(&block)
yield if block_given?
BLOCK_BUFFER
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render(&block) #:nodoc:\r\n instance_eval(&block)\r\n @output_buffer\r\n end",
"def render(*args, &block); end",
"def render(view, locals, buffer = T.unsafe(nil), add_to_stack: T.unsafe(nil), &block); end",
"def _normalize_render(*args, &block); end",
"def render\n Vedeu::Output.render(buffer)\n end",
"def render( * )\n\t\tnil\n\tend",
"def render( * )\n\t\tnil\n\tend",
"def render(*args, &block)\n captured = helpers.capture do\n helpers.concat(helpers.render(*args, &block))\n helpers.output_buffer.to_s\n end\n rawtext(captured)\n end",
"def render r\n end",
"def render( render_state )\n\t\treturn nil\n\tend",
"def rendered=(_arg0); end",
"def render_or_pass(&block)\n begin yield\n rescue Exception => e\n logger.error e.message\n pass\n end\n end",
"def render(scope = T.unsafe(nil), locals = T.unsafe(nil), &block); end",
"def render; end",
"def render; end",
"def render; end",
"def render; end",
"def render; end",
"def render(*_arg0); end",
"def render\n if @block\n instance_eval(&@block)\n end\n end",
"def render(options = T.unsafe(nil), locals = T.unsafe(nil), &block); end",
"def process_render exp\n process exp.last if sexp? exp.last\n\n add_simple_call :render, exp\n\n exp\n end",
"def render!(*args); end",
"def render(options = nil, extra_options = {}, &block) #:doc:\n @flash=flash\nputs \"RENGINE RENDER #1\"\n options=interpret_rengine_options(options)\nputs \"RENGINE RENDER #2\"\n #no layout\n super(options,extra_options,&block)\nputs \"RENGINE RENDER #3\"\n unless self.no_wrap\nputs \"RENGINE RENDER #4a\"\n \n \n txx=render_weblab(setUserJavascript+ self.response_body.join(\"\\n\"))\n puts \"RENGINE RENDER #4b\"\n\n # puts \"===========================\\n\"+txx.join(\"\\n\")+\"\\n!================================!\"\n\n if $render_translation_link\n txx << \"\\n<div style=\\\"background-color:#aaa;color:#0ff;\\\">\\n\"\n txx << translation_tool(@displayed_blurb_names)\n txx << \"\\n</div>\\n\"\n end\nputs \"RENGINE RENDER #5\"\n\n self.response_body=txx\n \n end\n end",
"def render!; raise NotImplementedError end",
"def render\n Debug.debug { \"Now rendering #{@context} block for #{self}\" }\n @document.playback_attributes @attributes\n out = renderer.render(\"block_#{@context}\", self)\n @document.callouts.next_list if @context == :colist\n out\n end",
"def render(view, locals, buffer = nil, add_to_stack: true, &block)\n instrument_render_template do\n compile!(view)\n if buffer\n view._run(method_name, self, locals, buffer, add_to_stack: add_to_stack, has_strict_locals: strict_locals?, &block)\n nil\n else\n view._run(method_name, self, locals, OutputBuffer.new, add_to_stack: add_to_stack, has_strict_locals: strict_locals?, &block)&.to_s\n end\n end\n rescue => e\n handle_render_error(view, e)\n end",
"def render(*args, &block)\n\t options = _normalize_render(*args, &block)\n\t self.response_body = render_to_body(options)\n\t _process_format(rendered_format, options) if rendered_format\n\t self.response_body\n\t end",
"def erb_with_output_buffer(buf = '')\n @_out_buf, old_buffer = buf, @_out_buf\n yield\n @_out_buf\n ensure\n @_out_buf = old_buffer\n end",
"def blitz\n \trender text: '42'\n end",
"def with_buffer(block)\n yield(_erb_buffer(block.binding))\n end",
"def render(&block)\n self.renderer = block\n end",
"def render(*args); end",
"def render(*args); end",
"def render_block(name, context, blocks = {}, use_blocks = true)\n # ob_start();\n display_block(name, context, blocks, use_blocks)\n # return ob_get_clean();\n end",
"def render; ''; end",
"def render_to_string(*args, &block); end",
"def render_to_string(*)\n if self.response_body = super\n string = \"\"\n self.response_body.each { |r| string << r }\n string\n end\n ensure\n self.response_body = nil\n end",
"def _erb_buffer( the_binding )\n eval(\"_erbout\", the_binding, __FILE__, __LINE__)\n end",
"def _erb_buffer( the_binding )\n eval(\"_erbout\", the_binding, __FILE__, __LINE__)\n end",
"def render\n end",
"def render\n end",
"def render\n end",
"def render_calls; end",
"def render_to_body(options = T.unsafe(nil)); end",
"def render_erb\n end",
"def render\n sb = StringIO.new\n append_to_string_builder(sb)\n sb.string\n end",
"def rendered; end",
"def render!\n result\n end",
"def render\n end",
"def capture_and_render(&block)\n render_method.call Util.capture_stdout(&block)\n end",
"def render(exp)\n renderer.process(exp)\n end",
"def render(view, locals, buffer=nil, &block)\n @template.instance_variable_set(:'@source', wrapped_source)\n\n super(view, locals, buffer, &block)\n end",
"def capture_erb(&block)\n buffer = _erbout\n pos = buffer.length\n block.call\n \n # extract the block \n data = buffer[pos..-1]\n \n # replace it in the original with empty string\n buffer[pos..-1] = ''\n \n data\n end",
"def render(*args, &block)\n options = args.last.is_a?(Hash) ? args.pop : {}\n @response.status = options.delete(:status) || 200\n layout = @layouts[options.delete(:layout) || :default]\n assigns = { :request => request, :response => response, :params => params, :session => session }\n @content = args.last.is_a?(String) ? args.last : Markaby::Builder.new(assigns, self, &(block || @views[args.last])).to_s\n @content = Markaby::Builder.new(assigns, self, &layout).to_s if layout\n @response.headers.merge!(options)\n @response.body = @content\n end",
"def render(erb)\n erb.result(binding)\n end",
"def render(scope = T.unsafe(nil), locals = T.unsafe(nil)); end",
"def render\n content = output_capture(@block) do\n instance_exec( *@args, &@block )\n end\n content_wrapped = output_capture() { wrap( content ) }\n output_concat content_wrapped\n end",
"def render\n return nil\n end",
"def render\n\n end",
"def render(socket)\n socket << render_header\n socket << @body\n end",
"def erb_with_output_buffer(buf = '') #:nodoc:\n @_out_buf, old_buffer = buf, @_out_buf\n yield\n @_out_buf\n ensure\n @_out_buf = old_buffer\n end",
"def render_then_call(str, &blk)\n Proc.new {\n response.send_status(str.length)\n response.send_header\n response.write(str)\n blk.call \n } \n end",
"def render(context)\n # Sanitize the code inside the block\n resolve_code = super.to_s.gsub(/\\A(\\n|\\r)+|(\\n|\\r)+\\z/, \"\")\n \n # Invoke Rouge to format our code\n formatted_code = rouge_resolve(resolve_code)\n \n # Output the formatted code with the proper HTML tags\n to_html_code(formatted_code)\n end",
"def render_document; end",
"def render\n end",
"def render(context, options); end",
"def render_body(context, options); end",
"def render(object)\n @block.call(object)\n end",
"def content\n @blocks.map {|b| b.render } * EOL\n end",
"def render_views_in_this(block)\n html = ''\n block.views.each do |view|\n models_view = view.models_view(block)\n \n if view.model_name =~ /(tag)|(image)/ && !view.scope.blank?\n scope_model = view.owner_id.blank? ? eval(\"@#{view.scope}\") : model_class(view.scope).find(view.owner_id)\n data = eval(\"scope_model.#{view.model_name.pluralize}\")\n \n elsif view.model_name == 'post' && view.scope == 'tag'\n tag = view.owner_id.blank? ? eval(\"@tag\") : Tag.find(view.owner_id)\n data = Post.find(:all, :conditions => models_view.conditions).select { |p| p.tags.map(&:name).include? tag.name }\n data = data.paginate(:per_page => 15, :page => params[:page]) if models_view.paginate\n \n else\n data = view.model.all(view_find_options(view, models_view))\n end\n \n html << render(:partial => \"#{view_types_dir}#{models_view.view_type}\", :locals => { :data => data })\n end\n html\n #rescue\n # resource = block.class.to_controller_str\n # block_str = current_user && current_user.has_permission?(resource, 'edit', params) ? \"<a href='/#{resource}/#{block.id}/edit'>#{block.title}</a>\" : block.title\n # \"<div class='flash error'>And error occured loading view in block: #{block_str}</div>\"\n end",
"def render_views_in_this(block)\n html = ''\n block.views.each do |view|\n models_view = view.models_view(block)\n \n if view.model_name =~ /(tag)|(image)/ && !view.scope.blank?\n scope_model = view.owner_id.blank? ? eval(\"@#{view.scope}\") : model_class(view.scope).find(view.owner_id)\n data = eval(\"scope_model.#{view.model_name.pluralize}\")\n \n elsif view.model_name == 'post' && view.scope == 'tag'\n tag = view.owner_id.blank? ? eval(\"@tag\") : Tag.find(view.owner_id)\n data = Post.find(:all, :conditions => models_view.conditions).select { |p| p.tags.map(&:name).include? tag.name }\n data = data.paginate(:per_page => 15, :page => params[:page]) if models_view.paginate\n \n else\n data = view.model.all(view_find_options(view, models_view))\n end\n \n html << render(:partial => \"#{view_types_dir}#{models_view.view_type}\", :locals => { :data => data })\n end\n html\n #rescue\n # resource = block.class.to_controller_str\n # block_str = current_user && current_user.has_permission?(resource, 'edit', params) ? \"<a href='/#{resource}/#{block.id}/edit'>#{block.title}</a>\" : block.title\n # \"<div class='flash error'>And error occured loading view in block: #{block_str}</div>\"\n end",
"def render_result\n layout = @render_args[:layout]\n view = @render_args[:view]\n if layout.kind_of? Symbol # this handles the layout(:none)\n view.result(binding)\n else\n @view[:timestamp] = \"<!-- rendered: #{Time.now()} / env: #{rack_env} -->\"\n @view[:body] = view.result(binding)\n # layout = @layout if layout.nil? # this handles the layout(:some_other_layout) case for formats\n layout.result(binding)\n end\n end",
"def render_result\n layout = @render_args[:layout]\n view = @render_args[:view]\n if layout.kind_of? Symbol # this handles the layout(:none)\n view.result(binding)\n else\n @view[:timestamp] = \"<!-- server: #{@port} / rendered: #{Time.now()} / env: #{rack_env} -->\"\n @view[:body] = view.result(binding)\n # layout = @layout if layout.nil? # this handles the layout(:some_other_layout) case for formats\n layout.result(binding)\n end\n end",
"def erb(template) render template end",
"def render_at_block(data)\n data.map { |key, block| \"#{key} { #{render_block(block)} }\" }.join('')\n end",
"def render_deferred(&blk)\n Proc.new {\n result = blk.call\n response.send_status(result.length)\n response.send_header\n response.write(result)\n }\n end",
"def putFragmentBlock\n yield\n newline\n end",
"def render_block(name_or_container, *args, &block)\n buffer = ActiveSupport::SafeBuffer.new\n\n name, block_render_options = extract_block_name_and_options(name_or_container)\n\n block_definition_options = {}\n if blocks[name]\n block_container = blocks[name]\n block_definition_options = block_container.options\n end\n\n options = global_options.merge(block_definition_options).merge(block_render_options).merge(args.extract_options!)\n\n if blocks[name]\n block_container = blocks[name]\n args.push(options)\n buffer << view.capture(*(args[0, block_container.block.arity]), &block_container.block)\n elsif options[:use_partials] && !options[:skip_partials]\n begin\n begin\n buffer << view.render(\"#{name.to_s}\", options)\n rescue ActionView::MissingTemplate, ArgumentError\n buffer << view.render(\"#{options[:partials_folder]}/#{name.to_s}\", options)\n end\n rescue ActionView::MissingTemplate, ArgumentError\n args.push(global_options.merge(options))\n buffer << view.capture(*(args[0, block.arity]), &block) if block_given?\n end\n else\n args.push(global_options.merge(options))\n buffer << view.capture(*(args[0, block.arity]), &block) if block_given?\n end\n\n buffer\n end",
"def render ( )\n @bprints.each do | bp |\n bp.render()\n end\n end",
"def render\n Tilt.new(@file)\n .render(OpenStruct.new(@binds))\n .delete!(\"\\n\")\n end",
"def render(template_name)\n if already_built_response? \n raise \"DoubleRenderError\"\n else \n controller_name = self.class.to_s.underscore \n dir = File.join(\"views\",controller_name, \"#{template_name}.html.erb\")\n # debugger\n content = File.read(dir).split(\"\\n\")\n content.map! do | statement | \n start_point = /<%/ =~ statement\n # debugger\n if start_point.nil? \n statement\n else \n front_part = statement[0...start_point]\n # returning = \n # start_point += statement[start_point+2] == \"=\" ? 2 : 1\n end_point = /%>/ =~ statement \n end_point += 1\n rear_part = statement[end_point+2..-1]\n front_part.to_s + ERB.new(statement[start_point..end_point]).result(binding) + rear_part.to_s\n end \n end \n render_content(content)\n end \n end",
"def render_view_body(view_data)\n\n\n view_render = Model::ViewRender.get(view.render.to_sym)\n \n if view_render and view_render.pre_processor\n view_data[:data] = view_render.pre_processor.call(view_data[:data], context, view.render_options)\n end\n \n template = Tilt.new(find_view_render_template(view))\n result = template.render(context, {:view => @view, :view_data => view_data,\n :multilanguage_site => context.settings.multilanguage_site,\n :locale => context.session[:locale]})\n \n if String.method_defined?(:force_encoding)\n result.force_encoding('utf-8')\n end\n\n return result\n\n end",
"def render(object = T.unsafe(nil)); end",
"def render(&block)\n API::Composition.render(&block)\n end",
"def render\n content\n end",
"def render\n content\n end",
"def render\n content\n end",
"def render\n @formatted_content.each &:render\n end",
"def output_buffer; end",
"def output_buffer; end",
"def render(scope = Object.new, &block)\n @scope_object = scope\n @buffer = Haml::Buffer.new(@options)\n\n local_assigns = @options[:locals]\n\n # Get inside the view object's world\n @scope_object.instance_eval do\n # Set all the local assigns\n local_assigns.each do |key,val|\n self.class.send(:define_method, key) { val }\n end\n end\n\n # Compile the @precompiled buffer\n compile &block\n\n # Return the result string\n @buffer.buffer\n end",
"def capture_html(*args, &block) \n if self.respond_to?(:is_haml?) && is_haml?\n block_is_haml?(block) ? capture_haml(*args, &block) : block.call\n elsif erb_buffer?\n result_text = capture_block(*args, &block)\n result_text.present? ? result_text : (block_given? && block.call(*args))\n else # theres no template to capture, invoke the block directly\n block.call(*args)\n end\n end",
"def render(data = {}, &block)\n output = content(data, &block)\n output = layout.render(get_data(data)) { output } unless layout.nil?\n output\n end",
"def content\n case @context\n when :preamble, :open\n @blocks.map {|b| b.render }.join\n # lists get iterated in the template (for now)\n # list items recurse into this block when their text and content methods are called\n when :ulist, :olist, :dlist, :colist\n @buffer\n when :listing, :literal\n apply_literal_subs(@buffer)\n when :pass\n apply_passthrough_subs(@buffer)\n when :admonition, :example, :sidebar, :quote, :verse\n if [email protected]?\n apply_para_subs(@buffer)\n else\n @blocks.map {|b| b.render }.join\n end\n else\n apply_para_subs(@buffer)\n end\n end",
"def render(*args)\n end",
"def render(*args) #:nodoc:\n raise ::AbstractController::DoubleRenderError if response_body\n super\n end",
"def process_default_render exp\n process_layout\n process_template template_name, nil\n end",
"def allow_double_render\n self.instance_variable_set(:@_response_body, nil)\n end",
"def block_html(raw)\n raw = unindent(raw)\n\n if md = raw.match(/\\<(.+?)\\>(.*)\\<(\\/.+?)\\>/m)\n open_tag, content, close_tag = md.captures\n \"<#{open_tag}>\\n#{recursive_render(unindent(content))}<#{close_tag}>\"\n else\n raw\n end\n end"
] | [
"0.7453929",
"0.7367175",
"0.7225749",
"0.7118685",
"0.6730538",
"0.6686253",
"0.6686253",
"0.6682767",
"0.6678505",
"0.6669066",
"0.66539896",
"0.65539575",
"0.6536578",
"0.6517802",
"0.6517802",
"0.6517802",
"0.6517802",
"0.6517802",
"0.651706",
"0.6512232",
"0.6497809",
"0.6491771",
"0.64748555",
"0.64429945",
"0.64183223",
"0.6395969",
"0.638163",
"0.63608044",
"0.6327422",
"0.63053256",
"0.6281915",
"0.6267137",
"0.62532836",
"0.62532836",
"0.62517565",
"0.62430525",
"0.62311274",
"0.6222306",
"0.6222209",
"0.6222209",
"0.62135327",
"0.62135327",
"0.62135327",
"0.6202825",
"0.6193502",
"0.61859304",
"0.6159378",
"0.6152401",
"0.6123523",
"0.6111269",
"0.6102236",
"0.6096678",
"0.6081278",
"0.60794526",
"0.6077937",
"0.607616",
"0.60737926",
"0.60652494",
"0.6057032",
"0.6054086",
"0.6051819",
"0.6034581",
"0.60232943",
"0.6020867",
"0.60120296",
"0.60096776",
"0.6001338",
"0.5994115",
"0.5990326",
"0.59860426",
"0.5977688",
"0.5977688",
"0.5973001",
"0.597169",
"0.5968028",
"0.5921449",
"0.59207153",
"0.59184617",
"0.5893889",
"0.5876515",
"0.58747274",
"0.5868516",
"0.5866617",
"0.58622146",
"0.58490646",
"0.58406323",
"0.58406323",
"0.58406323",
"0.58368224",
"0.58353794",
"0.58353794",
"0.5833834",
"0.58325577",
"0.5831338",
"0.58296186",
"0.581107",
"0.58104736",
"0.5805667",
"0.58011675",
"0.5793388"
] | 0.58988816 | 78 |
default html data attibutes | def default_data_options
{}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_attributes_options(options)\n html_options = options.stringify_keys!\n self.default_options = {'data-role' => \"listview\", 'data-inset' => \"true\"}\n\n if html_options.has_key?('data-inset')\n self.default_options = default_options.merge({'data-inset' => html_options['data-inset']})\n end\n\n if html_options.has_key?('data-theme')\n self.default_options = default_options.merge({'data-theme' => html_options['data-theme']})\n end\n\n if html_options.has_key?('data-rel')\n self.default_options = default_options.merge({'data-rel' => html_options['data-rel']})\n end\n\n if html_options.has_key?('data-transition')\n self.default_options = default_options.merge({'data-transition' => html_options['data-transition']})\n end\n\n end",
"def default_data\n end",
"def data_attribute(attributes = {})\n attributes = attributes.reject { |_, v| v.nil? }\n\n attributes[:reference_type] ||= self.class.reference_type\n attributes[:container] ||= 'body'\n attributes[:placement] ||= 'top'\n attributes.delete(:original) if context[:no_original_data]\n attributes.map do |key, value|\n %Q(data-#{key.to_s.dasherize}=\"#{escape_once(value)}\")\n end.join(' ')\n end",
"def html_data\n @html_data ||= {}\n end",
"def html_attr\n @html_attr ||= {}\n end",
"def default_input_html; {} end",
"def html_attributes(attr); end",
"def html_attr=(hash)\n return unless hash.is_a?(Hash)\n hash.symbolize_keys!\n html_class << hash.delete(:class)\n html_data.merge(hash.delete(:data) || {})\n (@html_attr ||= {}).merge!(hash)\n end",
"def default_attrs\n @default_attrs\n end",
"def data_attrs(_item)\n {}\n end",
"def input_html_options; end",
"def data_attributes\n end",
"def default_content; end",
"def custom_data\n super.attributes\n end",
"def data= data \n end",
"def default_attributes\n data.klass.stored_attributes[:data].map(&:to_s)\n end",
"def html_data_attributes\n data_attributes = record.class.columns.select do |column|\n column.type.in?(%i[integer boolean datetime float uuid interval]) && !column.array?\n end.map(&:name).map(&:to_sym)\n\n api_attributes & data_attributes\n end",
"def definition_as_html() \"default html #{self.class}\" end",
"def attribute\n :\"#{name}_data\" if name\n end",
"def data\n @field.widget.value_from_formdata(@form.data, @html_name)\n end",
"def initialize_html_tags; end",
"def on_html_attrs(*args) = [:html, :attrs, *args]",
"def set_data(params)\t\n\t\tself.data[:content_widget][:html_block_1] = params[:html_block_1]\n\tend",
"def permitted_html_tags=(_arg0); end",
"def set_default_data\n return unless issues_tracker.present?\n\n self.title ||= issues_tracker['title']\n\n # we don't want to override if we have set something\n return if project_url || issues_url || new_issue_url\n\n data_fields.project_url = issues_tracker['project_url']\n data_fields.issues_url = issues_tracker['issues_url']\n data_fields.new_issue_url = issues_tracker['new_issue_url']\n end",
"def _(data=\"\"); self.__ self.escape_html(data.to_s); end",
"def dom_attribute(name); end",
"def content_from_default=(content)\n # needs to be overridden for each kind of elements\n end",
"def html_options; @html_opts end",
"def default_html_options_for_collection(item, value); end",
"def data(nom = :default, model_class = nil, attr_mapping = { }, &block)\n @data[nom.to_sym] = {\n :block => block,\n :model => model_class,\n :attrs => attr_mapping\n }\n @data_keys << nom.to_sym\n end",
"def data(nom = :default, model_class = nil, attr_mapping = { }, &block)\n @data[nom.to_sym] = {\n :block => block,\n :model => model_class,\n :attrs => attr_mapping\n }\n @data_keys << nom.to_sym\n end",
"def data_tag(content)\n content_tag(:span, content, class: :data)\n end",
"def document_data_attributes(document)\n attr = {}\n\n # To add this to the div.document.result: data-foo=\"bar\"\n # do this:\n # attr['foo'] = 'bar'\n\n attr['onsite'] = 'true' if document.has_onsite_holdings?\n attr['offsite'] = 'true' if document.has_offsite_holdings?\n \n # NEXT-1635 - mark search-results docs with Hathi access status\n if (APP_CONFIG['hathi_search_results_links'])\n attr['hathi_access'] = document['hathi_access_s'] if document['hathi_access_s']\n end\n\n attr\n end",
"def if_data_element (data, element, classes = \"\", data_attrs = \"\")\n if data && !data.empty?\n return \"<#{element} class='#{classes}' #{data_attrs}>#{data}</#{element}>\"\n end\n end",
"def html=(klass); end",
"def defaults(data)\n records = all_records(@node)\n next_uid = next_id(MIN_UID, get_all_attribs_of_type(:uid, records))\n defaults = {\n 'realname' => [\"#{data['name'].first}\"],\n 'uid' => [\"#{next_uid}\"], \n 'home' => [\"/Users/#{data['name'].first}\"],\n 'shell' => ['/bin/bash'],\n 'gid' => ['20'],\n 'passwd' => ['********'],\n 'comment' => [''],\n }\n super defaults.merge(data)\n end",
"def on_html_attr(name, value)\n if value[0] == :slim && value[1] == :attrvalue && !options[:merge_attrs][name]\n # We handle the attribute as a boolean attribute\n escape, code = value[2], value[3]\n case code\n when 'true'\n [:html, :attr, name, [:multi]]\n when 'false', 'nil'\n [:multi]\n else\n tmp = unique_name\n [:multi,\n [:code, \"#{tmp} = #{code}\"],\n [:if, tmp,\n [:if, \"#{tmp} == true\",\n [:html, :attr, name, [:multi]],\n [:html, :attr, name, [:escape, escape, [:dynamic, tmp]]]]]]\n end\n else\n # Attribute with merging\n @attr = name\n super\n end\n end",
"def load_default_config\n self[:disable_html] ||= true\n self[:url_target] ||= \"_BLANK\"\n self[:image_alt] ||= \"Posted Image\"\n self[:table_width] ||= \"100%\"\n self[:syntax_highlighter] ||= :raw\n self[:coderay_options] ||= {}\n end",
"def default\n :html\n end",
"def default_data!(data)\n data.merge(\n \"features_folder\" => (data[\"features\"] || \"features\").downcase.strip,\n \"app_host\" => (data[\"app_host\"] || \"\").downcase.strip,\n \"driver\" => (data[\"driver\"] || \"chrome\").downcase.strip,\n \"headless\" => (data[\"headless\"].to_s.downcase.strip == \"true\"),\n \"print_progress\" => (data[\"print_progress\"].to_s.downcase.strip == \"true\"),\n \"pause\" => (data[\"pause\"] || \"0\").to_s.downcase.strip.to_i,\n \"stop_on_error\" => (data[\"stop_on_error\"] || \"false\").to_s.downcase.strip,\n \"max_wait_time\" => (data[\"max_wait_time\"] || Capybara.default_max_wait_time).to_s.downcase.strip.to_i,\n \"user_agent\" => (data[\"user_agent\"] || \"\").strip,\n # Because we want to default to 'true', but allow users to override it\n # with 'false' it causes us to mess with the logic. Essentially if the\n # user does enter false (either as a string or as a boolean) the result\n # will be 'true', so we flip it back to 'false' with !.\n # Else the condition fails and we get 'false', which when flipped gives\n # us 'true', which is what we want the default value to be\n # rubocop:disable Style/InverseMethods\n \"display_failures\" => !(data[\"display_failures\"].to_s.downcase.strip == \"false\"),\n # rubocop:enable Style/InverseMethods\n \"custom\" => (data[\"custom\"] || nil)\n )\n end",
"def html?; end",
"def html?; end",
"def html?; end",
"def permitted_html_tags; end",
"def on_html_tag(name, attrs, content = nil)\n return super if name != '*'\n hash, merger, formatter = splat_attributes(attrs[2..-1])\n tmp = unique_name\n tag = [:multi,\n merger,\n [:code, \"#{tmp} = #{hash}.delete('tag').to_s\"],\n [:if, \"#{tmp}.empty?\",\n [:code, \"#{tmp} = #{@options[:default_tag].inspect}\"]],\n [:static, '<'],\n [:dynamic, \"#{tmp}\"],\n formatter]\n tag << if content\n [:multi,\n [:static, '>'],\n compile(content),\n [:static, '</'],\n [:dynamic, \"#{tmp}\"],\n [:static, '>']]\n else\n [:static, '/>']\n end\n end",
"def data_attributes=(attributes)\n attributes.each do |k, v|\n self[\"data-#{k}\"] = v\n end\n end",
"def ro_standard(value = nil)\n value ||= @yaml['html']['value'] || (@record.respond_to?(@yaml['name']) ? @record.send(@yaml['name']) : nil)\n @html << %(<div id=\"#{@yaml['name']}\" class=\"dc-readonly\">#{value}</div>)\n self\nend",
"def attr; end",
"def attributes\n { \"id\" => id, \"title\" => title, \"format\" => format, \"language\" => language, \"content\" => content, \"selector\" => selector }\n end",
"def add_data_elements\n \n end",
"def html_options\n @options\n end",
"def html_options\n { :class => attribute }\n end",
"def non_html_attribute_options\n super.push(:button, :confirm, :disable_with, :href, :method, :remote, :theme)\n end",
"def html_params\n @html_params ||= {}\n end",
"def html_attributes\n {:xmlns => 'http://www.w3.org/1999/xhtml', 'xml:lang' => 'en', :lang => 'en'}\n end",
"def html_attributes\n {:xmlns => 'http://www.w3.org/1999/xhtml', 'xml:lang' => 'en', :lang => 'en'}\n end",
"def widget_attrs(widget)\n {}\n end",
"def data_class\n \"\"\n end",
"def label_html_options\n super.merge(:for => nil)\n end",
"def html_data_attributes(object, prefix, attribute_options = [])\n result = {}\n\n if attribute_options.present?\n attribute_options.each do |attribute|\n if attribute.is_a? Array\n key = attribute[0]\n methods = attribute[1].split(\".\")\n\n begin\n value = nil\n methods.each do |method|\n if value.blank?\n value = object.send(method)\n break if value.nil?\n else\n value = value.send(method)\n end\n end\n rescue\n # just ignore it\n end\n\n value = \"\" if value.nil?\n else\n key = attribute\n value = object.send(key)\n end\n\n result[\"#{prefix}#{key}\"] = value\n end\n else\n object.attributes.each do |key, value|\n result[\"#{prefix}#{key}\"] = value\n end\n end\n\n result\n end",
"def html_data_attributes(object, prefix, attribute_options = [])\n result = {}\n\n if attribute_options.present?\n attribute_options.each do |attribute|\n if attribute.is_a? Array\n key = attribute[0]\n methods = attribute[1].split(\".\")\n\n begin\n value = nil\n methods.each do |method|\n if value.blank?\n value = object.send(method)\n break if value.nil?\n else\n value = value.send(method)\n end\n end\n rescue\n # just ignore it\n end\n\n value = \"\" if value.nil?\n else\n key = attribute\n value = object.send(key)\n end\n\n result[\"#{prefix}#{key}\"] = value\n end\n else\n object.attributes.each do |key, value|\n result[\"#{prefix}#{key}\"] = value\n end\n end\n\n result\n end",
"def data=(value)\n @main.text = value.to_s\n end",
"def html_classes; end",
"def additional_data=(value)\n @additional_data = value\n end",
"def attributes\n %i[val div]\n end",
"def attr_tag(text); end",
"def if_data_button (data, classes = \"\", data_attrs = \"\")\n return \"<button class='#{classes}' #{data_attrs}>#{data}</button>\"\n end",
"def attrs\n @options[:attrs]\n end",
"def data\n attributes.fetch(:data)\n end",
"def data\n attributes.fetch(:data)\n end",
"def data\n attributes['data']\n end",
"def div_with_data_attr\n html.div(\"data-where\": \"up\")\n end",
"def attributes\n super.merge('url' => url, 'display_url' => display_url)\n end",
"def non_html_attribute_options\n super.push(:image, :src)\n end",
"def initialize(attrs = {})\n if attrs['data']\n super( attrs['data'] )\n else\n super(attrs)\n end\n end",
"def markup_context; end",
"def default_field_template(l = {})\n <<-END\n <div data-role=\"fieldcontain\" id=\"#{l[:div_id]}\" class=\"field\">\n\t #{l[:label]}<br />\n #{l[:element]}#{l[:decoration]}\n #{\"<p class=\\\"field_description\\\">#{l[:description]}</p>\" unless l[:description].blank?}\n\t </div>\n\t END\n end",
"def data_params\n {\n data: {attributes: {content: content}}\n }\n end",
"def parse_data_options(tag, options)\n return unless options\n parsed_options = options.dup\n options.each do |key, value|\n next if !DATA_ATTRIBUTES.include?(key) || (tag.to_s == 'form' && key == :method)\n parsed_options[\"data-#{key}\"] = parsed_options.delete(key)\n parsed_options[:rel] = 'nofollow' if key == :method\n end\n parsed_options\n end",
"def defaults(data)\n records = all_records(@node)\n next_gid = next_id(MIN_GID, get_all_attribs_of_type(:gid, records))\n defaults = {\n 'realname' => [\"#{data['name'].first.capitalize}\"],\n 'gid' => [\"#{next_gid}\"],\n 'passwd' => ['*'],\n 'groupmembers' => [],\n 'users' => [],\n }\n super defaults.merge(data)\n end",
"def if_data_link (data, href, classes = \"\", data_attrs = \"\")\n return \"<a href='#{href}' class='#{classes}' #{data_attrs}>#{data}</a>\"\n end",
"def default_attributes\n cfg_get(:default_attributes)\n end",
"def integrated_slat_action_html_data_attributes\n mergable_delete_link = delete_link? ? { method: :delete } : {}\n\n { disable_with: disable_with,\n confirm: confirm }.merge(mergable_delete_link)\n end",
"def data_attributes\n @schema.schema.select {|k,_| k.to_s.start_with?('data_') or k.to_s.start_with?('data-')}.inject({}) {|col,(k,v)| col[k[5..-1].to_sym]=v;col}\n end",
"def get_default_items_to_render_if_non_specified\n\t\t\tif @params[:data_to_render].any? == false\n\t\t\t\t@params[:data_to_render] = [:search_term, :title, :summary]\n\t\t\tend\n\t\tend",
"def default_attributes(custom = {})\n {}\n end",
"def defaults\n self.searchable ||= false\n self.displayable ||= true\n self.facetable ||= false\n self.multivalued ||= false\n self.sortable ||= false\n self.data_type ||= \"string\"\n end",
"def default_data_for_template(name)\n data = {}\n data[:name] = name\n data[:version] = '0.0.1'\n data[:summary] = \"A short description of #{name}.\"\n data[:homepage] = \"http://EXAMPLE/#{name}\"\n data[:author_name] = `git config --get user.name`.strip\n data[:author_email] = `git config --get user.email`.strip\n data[:source_url] = \"http://EXAMPLE/#{name}.git\"\n data[:ref_type] = ':tag'\n data[:ref] = '0.0.1'\n data\n end",
"def default_data_for_template(name)\n data = {}\n data[:name] = name\n data[:version] = '0.0.1'\n data[:summary] = \"A short description of #{name}.\"\n data[:homepage] = \"http://EXAMPLE/#{name}\"\n data[:author_name] = `git config --get user.name`.strip\n data[:author_email] = `git config --get user.email`.strip\n data[:source_url] = \"http://EXAMPLE/#{name}.git\"\n data[:ref_type] = ':tag'\n data[:ref] = '0.0.1'\n data\n end",
"def showInHtml(data)\n \"<div>#{data}</div>\"\n end",
"def additional_data=(value)\n @additional_data = value\n end",
"def data_attributes(*attrs)\n attrs.map(&:to_s).each do |attr|\n define_method attr do\n @data ||= {}\n @data[attr.to_sym]\n end\n\n define_method \"#{attr}=\" do |arg|\n @data ||= {}\n @data[attr.to_sym] = arg\n end\n end\n end",
"def markup_context=(_arg0); end",
"def set_default_options(options = nil)\n #give some sensical options instead of blank elements\n @options = Hash.new\n @options[:default_title] = \"My Awesome Title\"\n @options[:default_link] = \"http://default.wordpress.com\"\n @options[:default_description] = \"My Awesome Description\"\n @options[:pub_date] = \"Tue, 10 Mar 2009 00:12:59 +0000\"\n @options[:base_blog_url] = \"http://default.wordpress.com\"\n @options[:creator] = \"Hiro\"\n end",
"def attributes\n data = super\n data[:edit_url] = edit_article_url(object,host: 'localhost:3000') if scope.email.include? 'sm'\n data\n end",
"def rich_data(gym)\n \t\t\"\"\"\n \t\t<div class='well'>\n \t\t\t<img style='width:100px' src=#{gym.logo}/>\n <h2>\n \t\t\t#{gym.name}\n \t\t\t</h2>\n \t\t\t<p>\n \t\t\t#{gym.description.html_safe}\n \t\t\t</p>\n <a class='btn btn-info linkbutton' href='#{gym_path(gym)}'>Más Información</a>\n \t\t</div>\n\t\t\"\"\"\n \tend",
"def attributes\n\t\tsuper.merge({'content'=>content, 'content_type'=>content_type})\n\tend",
"def attr_map \n h = {\n 'data-id' => id,\n 'data-posters' => (@posters || []).map do |p|\n p.attributes.merge(:web_location => p.href)\n end.to_json,\n 'data-year' => @year,\n 'class' => (thumbnail() ? 'withPoster lazyLoadNeeded' : 'noPoster')\n }\n h['data-thumb-src'] = thumbnail.href if thumbnail\n genres.split(',').reduce(h){ |ha, g| ha[\"data-category-#{g.downcase.gsub(' ', '_')}\"] = true; ha }\n end",
"def use_default_attributes\n self.name = \"element#{column}\"\n self.units = ''\n self.default_min = nil\n self.default_max = nil\n self.scale_factor = 1.0\n self.offset = 0.0\n self.display_type = 'continuous'\n end"
] | [
"0.70313257",
"0.6939268",
"0.6818195",
"0.68017846",
"0.679742",
"0.662264",
"0.6415896",
"0.63660353",
"0.6246983",
"0.6195075",
"0.61855924",
"0.61466837",
"0.61261845",
"0.60938406",
"0.60472393",
"0.5954473",
"0.5951727",
"0.5950902",
"0.59246325",
"0.5887383",
"0.5873541",
"0.5873107",
"0.58678234",
"0.58662754",
"0.5819676",
"0.5815675",
"0.58069414",
"0.5797068",
"0.5795561",
"0.5759197",
"0.574069",
"0.574069",
"0.5739392",
"0.5702178",
"0.5681969",
"0.56661576",
"0.56630784",
"0.56365603",
"0.5623067",
"0.5622284",
"0.56191343",
"0.5616395",
"0.5616395",
"0.5616395",
"0.56115985",
"0.55983335",
"0.55940294",
"0.5588796",
"0.5570844",
"0.55693007",
"0.55668825",
"0.5566308",
"0.55585146",
"0.55534446",
"0.55473334",
"0.55337155",
"0.55337155",
"0.5527942",
"0.5527569",
"0.55241174",
"0.55199623",
"0.55199623",
"0.5518578",
"0.55126095",
"0.5511576",
"0.550861",
"0.55056334",
"0.5497597",
"0.54962564",
"0.5494261",
"0.5494261",
"0.54934186",
"0.549042",
"0.5484928",
"0.5484125",
"0.5476544",
"0.5467145",
"0.5463453",
"0.54629344",
"0.5458085",
"0.54475945",
"0.54457814",
"0.5437792",
"0.5436909",
"0.5432298",
"0.54320043",
"0.5422493",
"0.5419179",
"0.5416931",
"0.5416931",
"0.54081726",
"0.5407603",
"0.5405105",
"0.54042935",
"0.54030085",
"0.5400838",
"0.5396586",
"0.5390286",
"0.53892946",
"0.5380581"
] | 0.5955073 | 15 |
Returns the model's tag name if a tag is present. | def tag
@model.tag.name if @model.tag
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tag_name\n return @tag_name\n end",
"def tag_name\n @tag_name ||= name && name.to_s.split(\"::\")[-1].downcase\n end",
"def _tag_name\n @tag_name\n end",
"def name\n tag.name\n end",
"def tagname\n @tagname.id2name\n end",
"def get_tag tag_key_name\n self.tags.joins(:tag_key).where('tagging_tag_keys.name = ?', tag_key_name).first\n end",
"def tag\n return @tag\n end",
"def tag_name\n self.class.name.downcase.match(/[^:]+$/)[0]\n end",
"def get_tag_name(element)\n element.tag_name\n end",
"def tag_name; end",
"def tag_name; end",
"def tag_name; end",
"def getTag\n\t\treturn @tag\n\tend",
"def find_name_tag(tags)\n name_tag = tags.find { |tag| tag[:key] == \"Name\" }\n name_tag ? name_tag[:value] : nil\n end",
"def tag\n @tag\n end",
"def tag\n if @tag.is_a? String\n @tag\n end\n end",
"def getName(tags)\n name_tag = tags.find { |tag| tag.key == \"Name\" }\n name_tag ? name_tag.value : nil\nend",
"def tag_name\n ''\n end",
"def name\n _name = nil\n self.tags.each do |x|\n if x.tkey == \"name\"\n _name = x.tvalue\n end\n end\n _name\n end",
"def tag_list_name\n self.tag_list if tag_list\n end",
"def tag\n Tag.find(tag_id)\n end",
"def tag(name)\n tags[name.to_s] if tags\n end",
"def template_tag\n if @tag\n @tag\n else\n TEMPLATE_TAG\n end\n end",
"def has_tag?(tag)\n self.tags.include?(tag)\n end",
"def tag_names\n # only return the name from the associated tag object\n object.tags.map(&:name)\n end",
"def tag\n try_opt(:tag)\n end",
"def name_from_relation(tags)\n tags[\"nat_name:de\"] || tags[\"name:de\"] || tags[\"nat_name\"] || tags[\"name\"]\n end",
"def tag tag_name\n find_element :tag_name, tag_name\n end",
"def tags_names\n\t\t@tags_names ||= self.tags.nil? ? '' : self.tags.collect(&:name).join(' ')\n\tend",
"def tagged?\n defined?(@tag) && !!@tag\n end",
"def tag\n `#{@el}.tagName`.downcase\n end",
"def tag\n `#{@el}.tagName`.downcase\n end",
"def extract_tag_name(tag)\n match = /\\A<\\/?(#{@@name})/.match(tag)\n return match[1] if match\n raise \"Cannot find tag name in tag: #{tag}\"\n end",
"def has_tag?(tag)\n tags.include?(tag.to_s)\n end",
"def tags\n self.new_record? ? '' : Tag.get_friendly_tags(self)\n end",
"def model_name_or_title(model)\n model.respond_to?('title') ? model.title : model.name\n end",
"def has_tag?(name); end",
"def extract_name_tag(tags)\n # Find the 'Name' key in the tags object and extract it. If the key isn't found, we get nil instead.\n name_tag = tags.find { |tag| tag.key == 'Name' }\n # If extracting the key/value was successful...\n if name_tag\n # ...extract the value (if there is one), or return <no name>\n !name_tag[:value].empty? ? name_tag[:value] : '<no name>'\n else\n # Otherwise, there's not a Name key, and thus the object has no name.\n '<no name>'\n end\n end",
"def tag tag = nil\n @tag = tag if tag\n @tag\n end",
"def has_tag\n return @has_tag unless @has_tag.nil?\n get_tag_information\n @has_tag\n end",
"def tagName\n ''\n end",
"def tag\n require_admin_permissions\n @model = 'tag'\n @key = 'tag'\n @values = Tag.all.pluck(:tag)\n render 'tags'\n end",
"def model_name_or_title(model)\n model.respond_to?('title') ? model.title : model.name rescue model\n end",
"def has_tag? (tag)\n\n @tags.include?(tag)\n end",
"def tag_names\n @tag_names || tags.map(&:name).join(',')\n end",
"def tag_name_fields\n Tag::TAGGABLE_TYPES.map do |tag_type|\n \"#{tag_type.humanize.pluralize}.name\"\n end + [\"tags.name\", \"meta_tags.name\"]\n end",
"def hastag?(tag)\n @tags[tag] ? true : false\n end",
"def tagged?(tag)\n @tags.include?(tag)\n end",
"def has_tag?(tag)\r\n self.tags.count(:name => tag.name)> 0\r\n end",
"def has_tag? tag\n selected.each do |view|\n return true if view.rmq_data.has_tag?(tag)\n end\n false # tag doesn't exist if we got here\n end",
"def has_tag(tag_name)\n tag = USER_TAGS[tag_name: tag_name]\n return tag != nil\n end",
"def tags\n object.tags.each do |tag|\n tag.name\n end\n end",
"def tag_names\n @tag_names ||= tags.map(&:name).join(' ')\n end",
"def has_tag?(name)\n tags.any? {|tag| tag.tag_name.to_s == name.to_s }\n end",
"def tag_type\n return @tag_type\n end",
"def has_tag(tag)\n @tags.include?(\"@#{tag}\")\n end",
"def tagname_symbol\n @tagname\n end",
"def select_tag_info(tag_id)\n return get_db_as_hash().execute(\"SELECT tag_name FROM tags WHERE tag_id = ?\", tag_id).first\n end",
"def tag_names\n self.entity_tags.map(&:tag).map(&:name)\n end",
"def diet_order_by(model_tag)\n return model_tag + \".name ASC\" \n end",
"def tag_names\n self.tags.map{ |t| t.name }.join(\", \")\n end",
"def tags_on(model, format = :html)\n begin\n case format\n when :html\n #t = '<img src=\"/images/tag.gif\" alt=\"Tags\" />'\n t = '<ul class=\"tags\">'\n model.tags.each do |tag|\n t << \"<li><a href=\\\"#{tag.url}\\\">#{tag.title}</a></li>\"\n end\n t << '</ul>'\n when :json\n model.tags.map { |t|\n {:id => t.name, :name => t.title}\n }.to_json\n else\n t = model.tags.map{ |t| t.title }.join(', ')\n end\n rescue\n # HACK: This is probably only going to break because a blank model is\n # missing a primary key or something like that. Since we call this\n # method SO much (and because that specific error is not subclassed\n # by Sequel) no custom error handling here.\n ''\n end\n end",
"def preptime_order_by(model_tag)\n return model_tag + \".name ASC\" \n end",
"def tagged?(tag)\n !! self.tag(tag)\n end",
"def get_name_for(model)\n if model.nil?\n 'nil'\n elsif model.is_a? User\n model.full_name\n elsif model.is_a? Role\n model.title\n elsif model.is_a? Event\n model.initiative.full_title\n elsif model.is_a? Initiative\n model.full_title\n else\n 'unknown'\n end\n end",
"def other_type_tag_name\n other_type_tag.nil? ? '' : other_type_tag.name\n end",
"def ingredient_order_by(model_tag)\n return model_tag + \".name ASC\" \n end",
"def tag_names\n self.tags.map(&:name).join(\", \")\n end",
"def tag\n @tag ||= to_boolean_phrase.hash.abs.to_s(36)\n end",
"def get_tag(key)\n meta[key] || metrics[key]\n end",
"def get_tag_by_name(name)\n @aws_instance_data.tags.each do |tag_data|\n return tag_data.value if tag_data.key == name\n end\n nil\n end",
"def has_tag? tag\n @values.has_key?(Values.unify_tag(tag.to_s))\n end",
"def get_tag(tag_name)\n tag = USER_TAGS[tag_name: tag_name]\n return nil if tag == nil\n\n # create tag\n return UserTag.new(tag)\n end",
"def has_tag? tag\n out = false\n selected.each do |view|\n if view.rmq_data.has_tag?(tag)\n out = true # This is weird because of RM android bug\n break\n end\n end\n\n out\n end",
"def model_name\n return unless item\n\n @model_name ||= item.model_name.human.downcase\n end",
"def title\n temp = \"X\"+read_attribute(:id).to_s\n if not read_attribute(:title).nil? \n temp += \": \" + read_attribute(:title).to_s\n elsif( !self.tags.nil? && !self.tags.first.nil? )\n temp += \": \" + self.tags.first.tag_name\n end\n return temp\n end",
"def has_tag?(t)\n tags.include?(t)\n end",
"def get_tag_from_label(tag_label, reload = false)\n tag_label = DomainEnumerated.standardize_tag(tag_label)\n tag_id, tag = get_hash_tags(reload).detect { |id, tag| tag.label == tag_label }\n tag\n end",
"def element_is_tag?\n self[:is_tag]\n end",
"def value_for_tag?(tag)\n @set_fields[tag] || false\n end",
"def to_obj(tag_name)\n @tags.each do |tag|\n if tag_name == tag.name\n Log4r::Logger.log_internal { \"Get tag: #{tag_name}\" }\n return tag\n end\n end\n nil\n end",
"def find_tags_by_name(tag)\n ActsAsTaggableOn::Tag.includes(:taggings).where(\"taggings.context = 'tags'\").order(\"name ASC\").named_like(tag).limit(10) unless tag.blank?\n end",
"def tags\n attributes.fetch(:tags)\n end",
"def tags\n attributes.fetch(:tags)\n end",
"def tag_name(locator)\n find_element(locator).tag_name\n end",
"def tag_exists? (tag)\n found_tag = \"\"\n tags = get_server_tags\n if tags.is_a? Array\n tags.each do |t| \n if t.include?(tag)\n found_tag = t\n end\n end\n else \n fail(\"ERROR: list of tags is not Array as it was expected\")\n end\n return found_tag.gsub(/\\n/, \"\").gsub(/\\\"/, \"\").strip\n end",
"def model_name\n model.name\n end",
"def is_tag?( tag = '' )\n return false unless @is_tag\n\n return true if tag.blank?\n\n tag_obj = get_queried_object\n\n tag = [tag] unless tag.is_a?(Array)\n tag.map!(&:to_s)\n\n if tag.include?(tag_obj.term_id.to_s)\n return true\n elsif tag.include?(tag_obj.name)\n return true\n elsif tag.include?(tag_obj.slug)\n return true\n end\n false\n end",
"def tagname\n @node[0].gsub(/[^a-zA-Z]/, \"\")\n end",
"def get_field_by_tag(tag)\n fields[tag]\n end",
"def find_or_add\n if name\n n = name.strip.downcase\n tag = Tag.find_by(name: n) || Tag.create(name: n)\n end\n end",
"def has_tag?(tag) # rubocop:disable Naming/PredicateName\n !get_tag(tag).nil? # nil is considered not present, thus we can't use `Hash#has_key?`\n end",
"def has_tag?(item, tag)\n return false if item[:tags].nil?\n item[:tags].include? tag\n end",
"def tag_names #helper method\n # gets tag names in an array\n self.tags.map { |tag| tag.name }\n end",
"def name\n tag['name'].gsub(/\\[\\]$/, '')\n end",
"def taggable?\n definition['taggable'] == true\n end",
"def tag_name_uniqued(tag, options = {})\n if (options[:duplicate_names])\n duplicate_names = options[:duplicate_names]\n else\n duplicate_names = {}\n end\n\n if ((tag.user_id != current_user.id) && duplicate_names.include?(tag.name))\n return(h(tag.name) + '<span class=\"tag_name_uniqued\">:' + User.find_by_id(tag.user_id).login) + \"</span>\"\n else\n return(tag.name)\n end\n\n # (User.find_by_login(\"lelan\").tag_subscriptions.collect() { |a| Tag.find_by_id(a.tag_id) } + User.find_by_login(\"lelan\").tags).collect() { |a| a.name == \"maps\" ? a : nil }.compact\n end",
"def extract_resource_name_from_tag\n tags = resource[:tags] ? resource[:tags].map { |k,v| {key: k, value: v} } : []\n tags << {key: 'Name', value: name}\n end",
"def tags\n @attributes.select { |k, _| tag_names.include?(k.to_s) }\n end",
"def tags tag_name\n find_elements :tag_name, tag_name\n end"
] | [
"0.7175416",
"0.69203454",
"0.69119096",
"0.68352187",
"0.669863",
"0.6691768",
"0.6591063",
"0.6476076",
"0.6425442",
"0.6395256",
"0.6395256",
"0.6395256",
"0.63854146",
"0.6367306",
"0.63272464",
"0.63196164",
"0.6310441",
"0.6260948",
"0.625725",
"0.6234924",
"0.62084365",
"0.62084144",
"0.61561626",
"0.61277944",
"0.6107942",
"0.6088671",
"0.6083051",
"0.6072082",
"0.60355735",
"0.6033127",
"0.60150886",
"0.60150886",
"0.59993553",
"0.5990187",
"0.5986281",
"0.59779334",
"0.5962446",
"0.5950707",
"0.5927619",
"0.5926135",
"0.5924317",
"0.5890908",
"0.5882572",
"0.5875331",
"0.5865512",
"0.5864396",
"0.5861704",
"0.5843669",
"0.58323264",
"0.58157706",
"0.5804229",
"0.5793232",
"0.5778962",
"0.57640034",
"0.57584345",
"0.57577723",
"0.57474196",
"0.5738547",
"0.5716216",
"0.5699233",
"0.568517",
"0.5675741",
"0.5674753",
"0.5672593",
"0.5671926",
"0.5668139",
"0.5661817",
"0.5651484",
"0.5649303",
"0.5638282",
"0.5633324",
"0.5631058",
"0.5623202",
"0.56160617",
"0.56096464",
"0.56055236",
"0.55962634",
"0.55733967",
"0.5570681",
"0.55502874",
"0.5546468",
"0.5543118",
"0.5524383",
"0.5524383",
"0.55240005",
"0.5514811",
"0.55134547",
"0.5499909",
"0.54900604",
"0.54813385",
"0.54743016",
"0.54717916",
"0.5455161",
"0.54439557",
"0.5442346",
"0.5440243",
"0.54376",
"0.54362303",
"0.5426743",
"0.5422847"
] | 0.85167044 | 0 |
Sets the model's tag to an existing tag if it exists. Otherwise, creates a new tag. | def tag=(new_tag_name)
new_tag=Tag.find_by(name: new_tag_name)
if new_tag
@model.tag=new_tag
else
@model.create_tag(name: new_tag_name)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_tag\n begin\n @tag = Tag.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n @tag = Tag.find_by(tag_id: params[:id]) || raise(ActiveRecord::RecordNotFound.new)\n end\n end",
"def add_tag!(tag)\r\n tag = add_tag(tag)\r\n tag.save\r\n end",
"def autosave_associated_records_for_tag\n if new_tag = Tag.find_or_create_by_name(self.name)\n self.tag = new_tag\n else\n self.tag = tag if self.tag.save!\n end\n end",
"def set_tag\n @tag = Tag.where(id: params[:tag]).first\n end",
"def tag_name=(tag_name)\n self.tag = Tag.find_by_name!(tag_name)\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.where('safe_name = ?', params[:id]).first\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def tag= tag\n @tag = tag\n update!\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = ActsAsTaggableOn::Tag.find(params[:id])\n end",
"def set_tag\n @tag = ActsAsTaggableOn::Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def tag=(value)\n @tag = value\n self.status = TAG_STATUS.fetch(value)\n @tag\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 to_tag(name)\n tag = Tag.find_by(name: name)\n if tag.nil?\n tag = Tag.new(name: name)\n tag.save\n end\n tag\nend",
"def tag(name)\n name.strip!\n tag = Tag.find_or_create_by(name: name)\n self.taggings.find_or_create_by(tag_id: tag.id)\n end",
"def add_tag(tag)\r\n self.tags.new(:name => tag.name)\r\n end",
"def setTag(tag)\n @fields['tag'] = tag\n self\n end",
"def setTag(tag)\n @fields['tag'] = tag\n self\n end",
"def setTag(tag)\n @fields['tag'] = tag\n self\n end",
"def setTag(tag)\n @fields['tag'] = tag\n self\n end",
"def setTag(tag)\n @fields['tag'] = tag\n self\n end",
"def setTag(tag)\n @fields['tag'] = tag\n self\n end",
"def setTag(tag)\n @fields['tag'] = tag\n self\n end",
"def set_tag\n @tag = if current_manager\n Tag.find_by!(id: params[:id], organization_id: current_manager.organization_id)\n else\n Tag.find(params[:id])\n end\n end",
"def set_tag_record\n @tag_record = TagRecord.find(params[:id])\n end",
"def add_tags(tag)\n remove_previous_tags\n if @page.find(input_elements[:tag_input_field]).present?\n @page.find(input_elements[:tag_input_field]).set(tag)\n else\n @page.find(input_elements[:tag_input_field2]).set(tag)\n end\n @page.find(input_elements[:tag_selected]).click\n @used_tag = tag\n end",
"def tag tag = nil\n @tag = tag if tag\n @tag\n end",
"def set_tag_item\n @tag_item = TagItem.find(params[:id])\n end",
"def find_or_add\n if name\n n = name.strip.downcase\n tag = Tag.find_by(name: n) || Tag.create(name: n)\n end\n end",
"def add_tag(tag_name)\n return false if tag_name.strip == \"\"\n return false if tags.find_by_name(tag_name)\n\n tags << (Tag.where(name: tag_name)[0] || Tag.create(name: tag_name))\n save\n return true\n end",
"def add_tag(tag)\n t = Tagging.new()\n t.translation = self\n t.tag = tag\n begin\n self.taggings << t\n rescue # Already tagged\n false\n end\n end",
"def create\n type = params[:tag][:type] if params[:tag]\n if type\n model = type.classify.constantize rescue nil\n @tag = model.find_or_create_by_name(params[:tag][:name]) if model.is_a? Class\n else\n setflash; flash[:error] = ts(\"Please provide a category.\")\n @tag = Tag.new(:name => params[:tag][:name])\n render :action => \"new\" and return\n end\n if @tag && @tag.valid?\n if (@tag.name != params[:tag][:name]) && (@tag.name.downcase == params[:tag][:name].downcase) # only capitalization different\n @tag.update_attribute(:name, params[:tag][:name]) # use the new capitalization\n setflash; flash[:notice] = ts(\"Tag was successfully modified.\")\n else\n setflash; flash[:notice] = ts(\"Tag was successfully created.\")\n end\n @tag.update_attribute(:canonical, params[:tag][:canonical])\n redirect_to url_for(:controller => \"tags\", :action => \"edit\", :id => @tag)\n else\n render :action => \"new\" and return\n end\n end",
"def set_tag_one\n @tag_one = TagOne.find(params[:id])\n end",
"def set_tag\n # @stat = Stat.find(params[:id])\n if (params[:example_id])\n @tag = Tag.where(\"example_id=?\", params[:example_id]).first\n else\n @tag = Tag.find(params[:id])\n end\n end",
"def create(tag)\n update_tag_file do |tag_array|\n old_tags = ::MachineTag::Set.new(tag_array)[::MachineTag::Tag.new(tag).namespace_and_predicate]\n old_tags.each { |old_tag| tag_array.delete(old_tag) }\n tag_array << tag unless tag_array.include?(tag)\n end\n end",
"def tag_text=(value)\n self.tag=(value)\n end",
"def create_tag\n # TODO could validate that user is in a fleet first\n @user = User.find(params[:id])\n @tag = Tag.find_or_create_by_text(params[:tag][:text])\n @user.tag = @tag\n\n respond_to do |format|\n if @tag.save\n @user.save\n format.html { redirect_to((@user.fleet ? @user.fleet : @user), :notice => 'Tag was added successfully.') }\n format.xml { render :xml => @taq, :status => :created, :location => @tag }\n else\n format.html { render :action => \"add_tag\", :error => \"Tag was not added\" }\n format.xml { render :xml => @tag.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_tag\n @tag = current_user.tags.find(params[:id])\n end",
"def create(tag)\n api_client.tags.multi_add(resource_hrefs: [api_client.get_instance.href], tags: [tag])\n 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 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 update_or_create_tags\n return true if @inner_tags.nil? || !@save_tags\n words = []\n @inner_tags.each do |t|\n raise ActiveRecord::Rollback if t.new_record? && !t.save\n words << t.id\n tagging = Tagging.where(:taggable_id => self.id, :taggable_type => 'MediaElement', :tag_id => t.id).first\n if tagging.nil?\n tagging = Tagging.new\n tagging.taggable_id = self.id\n tagging.taggable_type = 'MediaElement'\n tagging.tag_id = t.id\n raise ActiveRecord::Rollback if !tagging.save\n end\n end\n Tagging.where(:taggable_type => 'MediaElement', :taggable_id => self.id).each do |t|\n t.destroy if !words.include?(t.tag_id)\n end\n end",
"def set_mytag\n @mytag = Mytag.find(params[:id])\n end",
"def set_has_tag\n @has_tag = HasTag.find(params[:id])\n end",
"def set_field\n @tag = Tag.find(params[:id])\n end",
"def consider_tag\n\n tag = attribute(:tag)\n\n return unless tag && tag.strip.size > 0\n\n h.tagname = tag\n h.full_tagname = applied_workitem.tags.join('/')\n\n return if h.trigger\n #\n # do not consider tags when the tree is applied for an\n # on_x trigger\n\n h.full_tagname = (applied_workitem.tags + [ tag ]).join('/')\n\n set_variable(h.tagname, h.fei)\n set_variable('/' + h.full_tagname, h.fei)\n\n applied_workitem.send(:add_tag, h.tagname)\n\n @context.storage.put_msg(\n 'entered_tag',\n 'tag' => h.tagname,\n 'full_tag' => h.full_tagname,\n 'fei' => h.fei,\n 'workitem' => h.applied_workitem)\n end",
"def create\n params[:tag][:name].downcase!\n params[:tag][:name] = params[:tag][:name].gsub(/[^a-z0-9]+/,'-')\n\n \n @find = Tag.find(:first, :conditions => \"name = '#{params[:tag][:name]}'\")\n if @find.nil?\n @tag = Tag.new(params[:tag])\n @tag_link = @tag.tag_links.build(params[:tag_link])\n @tag.save\n render :json => {:msg => \"Created and added #{@tag.name} to list of tags\",:tag=>@tag.name}\n else\n @link_find = TagLink.find(:first, :conditions => {:tag_id => @find.id, :taggable_type => params[:tag_link][:taggable_type],:taggable_id => params[:tag_link][:taggable_id]})\n if @link_find.nil?\n @tag_link = @find.tag_links.build(params[:tag_link])\n @find.save\n render :json => {:msg=>\"Added #{@find.name} to list of tags\",:tag=>@find.name}\n else\n render :json => {:msg=>\"This object is already tagged with #{@find.name}\",:tag=>@find.name}\n end\n end\n end",
"def set_tag\n # TODO performant?\n @tag = parent.tags.find_by name: params[: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\nend",
"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 set_tag\n @tag = current_user.tags.find(params[:id])\n end",
"def set_tag\n\t\t\t@tag = current_user.tags.find(params[:id])\n end",
"def tag=(value)\n # Normalize\n super(Tag.normalize(value))\n end",
"def add_tag(new_tag)\n db = connect_to_database()\n db.execute(\"INSERT INTO tags (Tag) VALUES (?)\", new_tag.downcase)\n end",
"def set_post_tag\n @post_tag = PostTag.find(params[:id])\n end",
"def set_post_tag\n @post_tag = PostTag.find(params[:id])\n end",
"def add_tag(tag)\n\n (h.fields['__tags__'] ||= []) << tag\n end",
"def tag(taggable)\n Tagging.create :tag_id => id, :taggable => taggable\n taggings.reset\n end",
"def tag_append_one(name)\n tag = Tag.find_or_create_by_name(name)\n tag.on(self) unless tags.include? tag\n end",
"def set_tag(string, recipes_hash, recipe)\n if recipes_hash[string]\n recipe_tag = RecipeTag.new()\n tag = Tag.find_by(name: string)\n recipe_tag.tag = tag\n recipe_tag.recipe = recipe\n recipe_tag.save\n end\nend",
"def set_tag\n @tag = @affiliate.tags.find(params[:id])\n end",
"def tag!(word_or_words, user)\n arr_of_words(word_or_words).each do |word|\n raise StandardError if tag_words_by_user(user).include?(word)\n\n #First add Tag/Tagging\n t = Tag.first(:word => word) || Tag.create!(:word => word)\n t.taggings << Tagging.new(:user => user, :taggable => self)\n t.save!\n\n #Now add ModelTag/User/tag_word\n model_tag = model_tags.detect{|tag| tag.word == word}\n unless model_tag\n model_tag = ModelTag.new(:word => word, :tag => t)\n self.model_tags << model_tag\n self.tag_words << word\n end\n model_tag.users << user\n end\n save!\n tags\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 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 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 set_tag_link\n @tag_link = TagLink.find(params[:id])\n end",
"def set_tag\n if(params[:id].match(/^(\\d)+$/).present?)\n begin\n @tag = Tag.find(params[:id])\n rescue ActiveRecord::RecordNotFound => e\n flash[:error] = \"Error: Tag not found\"\n redirect_to controller: 'tags', :action => 'index'\n end\n else\n begin\n @tag = Tag.find_by(shortname: params[:id])\n rescue ActiveRecord::RecordNotFound => e\n flash[:error] = \"Error: Tag not found\"\n redirect_to controller: 'tags', :action => 'index'\n end\n end\n end",
"def tag(tag)\n @tagname = tag\n end",
"def tag(word_or_words, user, opts={})\n arr_of_words(word_or_words).each do |word|\n word = word.downcase unless opts[:case_sensitive] == true\n unless tag_words_by_user(user).include?(word)\n #First add Tag/Tagging\n t = Tag.first(:word => word) || Tag.create!(:word => word)\n t.taggings << Tagging.new(:user => user, :taggable => self)\n t.save\n\n #Now add ModelTag/User/tag_word\n model_tag = model_tags.detect{|tag| tag.word == word}\n unless model_tag\n model_tag = ModelTag.new(:word => word, :tag => t)\n self.model_tags << model_tag\n self.tag_words << word\n end\n model_tag.users << user\n end\n end\n save\n 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\n @model.tag.name if @model.tag\n end",
"def tag(new_tag); end",
"def register tag, name\n @tags[name] = tag\n end"
] | [
"0.7068598",
"0.69793516",
"0.6872561",
"0.6822214",
"0.67420423",
"0.6709795",
"0.6709795",
"0.66916066",
"0.66914046",
"0.66914046",
"0.66914046",
"0.66914046",
"0.66914046",
"0.66914046",
"0.66914046",
"0.66914046",
"0.66914046",
"0.66914046",
"0.66914046",
"0.66914046",
"0.66914046",
"0.66914046",
"0.66914046",
"0.66914046",
"0.66914046",
"0.66914046",
"0.6612193",
"0.66116434",
"0.6599985",
"0.6598055",
"0.6557517",
"0.6557517",
"0.6545997",
"0.6545997",
"0.6545997",
"0.6545997",
"0.6545997",
"0.6509338",
"0.63982195",
"0.6390625",
"0.62779015",
"0.6253789",
"0.6239383",
"0.6239383",
"0.6239383",
"0.6239383",
"0.6239383",
"0.6239383",
"0.6239383",
"0.6227475",
"0.6213983",
"0.6210276",
"0.6165182",
"0.6124392",
"0.6021889",
"0.6002404",
"0.5973889",
"0.5958449",
"0.59421843",
"0.59362763",
"0.5933031",
"0.5930492",
"0.59223986",
"0.5920667",
"0.5906314",
"0.5898696",
"0.58964694",
"0.5894418",
"0.5886804",
"0.5882425",
"0.5878059",
"0.58760095",
"0.5869187",
"0.58639693",
"0.58404166",
"0.58388007",
"0.5833984",
"0.58331305",
"0.58106357",
"0.58097404",
"0.57750785",
"0.57750785",
"0.57691664",
"0.5759656",
"0.57596457",
"0.5749822",
"0.5731894",
"0.5720991",
"0.5720331",
"0.5720331",
"0.57107216",
"0.5691637",
"0.5691143",
"0.56904787",
"0.5689717",
"0.5682199",
"0.5678091",
"0.5672278",
"0.56653535",
"0.56580734"
] | 0.75253075 | 0 |
sd = start_date, ed= end_date | def between_dates(sd, es)
return true if sd <= self.start_date && es >= self.end_date
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_start_end_dates\n esdate and eedate\n end",
"def dates\n start_s = start_date ? start_date.to_s : '?'\n end_s = end_date ? end_date.to_s : '?'\n \"#{start_s} to #{end_s}\"\n end",
"def reservation_dates_must_make_sense\n\t if end_date <= start_date\n\t\t errors.add(:start_date, \"has to be before the end date\")\n\t end\n\tend",
"def get_end_date\n \n \nend",
"def booked_date_range\n { from: :start_date, to: :end_date }\n end",
"def convert_to_est\n self.start_date += 18000\n self.end_date += 18000\n end",
"def format_start_end_date(s_date, e_date)\n # Format the dates based on month and year.\n if (s_date.mon == e_date.mon) && (s_date.year == e_date.year)\n date = s_date.strftime(\"%b %d-\").to_s + e_date.strftime(\"%d, %Y\").to_s\n elsif s_date.year == e_date.year\n date = s_date.strftime(\"%b %d - \").to_s + e_date.strftime(\"%b %d, %Y\").to_s\n else\n date = s_date.strftime(\"%b %d, %Y - \").to_s + e_date.strftime(\"%b %d, %Y\").to_s\n end\n date\n end",
"def get_end_date\n end_date\n end",
"def declare_beg_range\n\t\t@beg_range = @beg_range.to_date \n\t\t@end_range = @end_range.to_date \n\tend",
"def report_range(start_date, end_date)\n @start_date = start_date\n @end_date = end_date\n end",
"def build_condition_for_date(start_date, end_date, start_date_string=\"created_at\", end_date_string=\"created_at\")\n\t\t\" #{start_date_string} >= '#{start_date.to_time}' and #{end_date_string} <= '#{end_date.to_time + 1.day}' \" if validate_date?(start_date,end_date)\n\tend",
"def range\n (start_date...end_date) #exclusive date range\n end",
"def set_dates_and_duration\n if start_date && end_date && !duration\n self.duration = (end_date - start_date).to_i + 1 # if it's same date, duration should be 1\n elsif start_date && !end_date && duration\n self.end_date = start_date + (duration - 1).days\n elsif !start_date && end_date && duration\n self.start_date = end_date - (duration - 1).days\n end\n end",
"def more_advanced_date\n @end_date || @start_date || nil\n end",
"def estimated_end_date\n start_date + 12.days\n end",
"def start_and_end_date_range\n unless self.start_datetime.nil? || self.end_datetime.nil?\n oldest_start_datetime = self.active_sale_events.not_blank_and_sorted_by(:start_datetime).first\n latest_end_datetime = self.active_sale_events.not_blank_and_sorted_by(:end_datetime).last\n errors.add(:start_datetime, I18n.t('spree.active_sale.event.validation.errors.invalid_root_dates')) if (oldest_start_datetime.nil? && latest_end_datetime.nil?) ? false : (self.start_datetime > oldest_start_datetime || self.end_datetime < latest_end_datetime)\n end\n end",
"def valid_end_date\n self.end_date - self.start_date > 0 ? true : false\n end",
"def validate_date?(start_date,end_date)\n\t\tstart_date <= end_date\n\tend",
"def validate_start_and_end_date\n errors.add(:start_date, I18n.t('spree.active_sale.event.validation.errors.invalid_dates')) if invalid_dates?\n end",
"def set_start_date(sdt, *args)\n if eventenddate.to_date >= sdt.to_date && eventstartdate.to_date <= sdt.to_date\n self.eventstartdate = sdt\n self\n else\n args[0] ? self : nil\n end \n end",
"def date_validation\n\t\tif start_date >= end_date\n \t\terrors.add(:end_date, \"must be greater than start date\")\n \tend\n end",
"def start_date\n date\n end",
"def aoc_dates\n \"#{start_date.strftime('%d de %b')} al #{end_date.strftime('%d de %b')} de #{end_date.strftime('%Y')}\"\n end",
"def format_event_date(start_date, end_date)\n d1 = Date.parse(start_date) rescue nil\n d2 = Date.parse(end_date) rescue nil\n (d1 && d2) ? (d1..d2) : [d1, d2].compact\n end",
"def validate_end_date\n start = Date.parse(start_date.to_s)\n last = Date.parse(end_date.to_s)\n puts \"is date #{last} before #{start}\"\n errors.add(:end_date, \"can't be before the start date\") if last < start\n end",
"def date_consistency\n\t\treturn if [start_date.blank?, end_date.blank?].any?\n\t\terrors.add(:end_date, 'must be after start_date') if start_date > end_date\n\tend",
"def start_on_before_end_on\n errors.add :start_on, 'invalid date format' if start_on.present? && !valid_date?(date: start_on)\n errors.add :end_on, 'invalid date format' if end_on.present? && !valid_date?(date: end_on)\n errors.add :start_on, 'invalid date range (Start must come before end)' if start_on.present? && end_on.present? && start_on > end_on\n end",
"def valid_start_and_end_dates?\n return false unless start.present? && self.end.present?\n start <= self.end\n end",
"def calculated_dates\n [period1_from_date,period1_end_date,\n period2_from_date, period2_end_date] \n end",
"def enrollment_dates\n if start_date\n \"#{start_date_formatted} - #{end_date_formatted}\"\n end\n end",
"def set_dates(start_date = nil, end_date = nil)\n\n\t if (start_date.nil? and not end_date.nil?)\n\n\t\t start_date = (@utils.get_date_object(end_date)) - (MAX_HISTORICAL_DAYS * (24 * 60 * 60))\n\n\t\t @start_date = start_date.to_s\n\t\t @end_date = end_date.to_s\n\n\t elsif (not start_date.nil? and end_date.nil?)\n\n\t\t end_date =(@utils.get_date_object(start_date)) + (MAX_HISTORICAL_DAYS * (24 * 60 * 60))\n\n\t\t if end_date > Time.new.utc\n\t\t\tend_date = nil #Let API default to Now.\n\t\t end\n\n\t\t @start_date = start_date.to_s\n\t\t @end_date = end_date.to_s if not end_date.nil?\n\n\t end\n end",
"def start_date\n return start\n end",
"def day_calculations\n\t\t@prev_beg_range = @beg_range.to_date-1.day\n\t\t@prev_end_range = @beg_range.to_date-1.day\n\t\t@next_beg_range = @beg_range.to_date+1.day\n\t\t@next_end_range = @beg_range.to_date+1.day\n\tend",
"def set_dates( start_date, end_date = nil )\n \n # If the end date isn't specified, default to sameday\n end_date ||= start_date\n \n # Break the dates into a hash query format. \n hash = [ [ start_date, { dd: '%d', mon: '%m', yyyy: '%Y' } ] , [ end_date, { todd: '%d', tomon: '%m', toyyyy: '%Y' } ] ].inject({}) do |h, ( date, args )|\n args.each { |k,v| h[k.to_s] = date.strftime(v) } ; h\n end\n\n # Update the query with the new values\n update_query( hash )\n end",
"def setup_range(date)\n diff = date.wday - self.class.windex(start_wday)\n @first = date - (diff + ((diff < 0) ? DAYS : 0))\n @last = @first + DAYS - 1\n end",
"def date_within(d)\n\t\treturn (start_date <= d) && (d <= stop_date)\n\tend",
"def start_date_or_end_date_changed?\n self.previous_changes.include?(\"start_date\") || self.previous_changes.include?(\"end_date\")\n end",
"def start_date_before_end_date\n return unless start_date && end_date\n\n errors.add(:start_date, 'can\\'t be after the end date') if start_date > end_date\n end",
"def set_start_end_dates\n # If the task is a schedule/appointment type then we need to set the start\n #+ and end time for it. We save them in the same fields start_date,\n #+ end_date. The start_time and end_time fields are deprecated and they \n #+ are used as place holders in form. They will be removed from table\n #+ definition.\n # Database migration and rake task is there to change field type for\n #+ start/end date. Now storing time and date in same fields.\n if self.category.eql?(\"appointment\")\n self.start_date = self.start_date_appointment unless self.start_date_appointment.blank?\n self.end_date = self.end_date_appointment unless self.end_date_appointment.blank? \n=begin\n if false && start_date && end_date\n sd = start_date.utc\n ed = end_date.utc\n st = start_time #.in_time_zone\n et = end_time \n p sd, ed, st, et\n self.start_date = DateTime.new(sd.year, sd.month, sd.day, st.hour, st.min, st.sec).utc\n self.end_date = DateTime.new(ed.year, ed.month, ed.day, et.hour, et.min, et.sec) \n p start_date\n p end_date\n end\n=end\n else\n #self.start_date = self.end_date_todo unless self.end_date_todo.blank? #self.start_date_todo unless self.start_date_todo.blank?\n self.start_date = self.start_date_todo unless self.start_date_todo.blank?\n self.end_date = self.end_date_todo unless self.end_date_todo.blank?\n end\n end",
"def validate_start_and_end_date\n self.errors.add(:event_start_date, \"should not be in past\") if self.event_start_date < Date.today\n self.errors.add(:event_end_date, \"should not be in past\") if self.event_end_date < Date.today\n self.errors.add(:event_end_date, \"start date should not be after end date\") if self.event_end_date < self.event_start_date\n self.errors.add(:event_end_time, \"end time should not be before start time\") if (self.event_end_date == self.event_start_date and self.event_end_time < self.event_start_time)\n return self\n end",
"def set_date_range(begin_date, end_date)\n @begin_date = begin_date.to_date\n @end_date = end_date.to_date\n end",
"def test_end_date_before_start_date\r\n @moderated_search.start_date = Date.today\r\n @moderated_search.end_date = Date.yesterday\r\n @moderated_search.save\r\n \r\n assert @moderated_search.errors.size > 0\r\n assert @moderated_search.errors.on(:end_date) \r\n end",
"def end_date_after_start_date\n if start_date && end_date && end_date < start_date\n errors.add :end_date, \"must be after the start date\"\n errors.add :start_date, \"must be before the end date\"\n end\n end",
"def determine_date\n if !params[:date_start].blank? && !params[:date_end].blank?\n @date_start = params[:date_start]\n @date_end = params[:date_end]\n else\n determine_date_now\n end\n end",
"def same_date\n return unless start_at? && end_at?\n return unless start_at.to_date != end_at.to_date\n\n errors.add(:start_at, :same_date)\n errors.add(:end_at, :same_date)\n end",
"def dates\n end",
"def date_verify\n if end_date && start_date.nil?\n errors.add(:end_date, \"cannot only specify end date\")\n elsif all_day && start_date.nil?\n errors.add(:all_day, \"cannot specify without date\")\n elsif (start_date && end_date) && (start_date > end_date)\n errors.add(:start_date, \"cannot larger than end date\")\n end\n end",
"def range_start=( value ); @range_start = value; rationalise_dates(); end",
"def validate_start_date\n start = Date.parse(start_date.to_s)\n last = Date.parse(end_date.to_s)\n puts \"is date #{start} after #{last}\"\n errors.add(:start_date, \"can't be after the end date\") if start > last\n end",
"def same_day?\n start_date == end_date\n end",
"def attendance_between_dates_condition\n\t\t\"attendances.attendance_on BETWEEN '#{start_on}' AND '#{end_on}'\"\n\tend",
"def change_dates start_date, finish_date\n set_dates start_date, finish_date\n\n set_calendar\n end",
"def process_claim_start_and_end_dates(c,date_qualifier)\n if date_qualifier == \"434\" or date_qualifier == \"472\"\n service_dates = c[1].split(\"-\")\n @claim_information[\"claim_statement_period_start_date\"] = service_dates[0].to_s if @claim_information.claim_statement_period_start_date.nil?\n @claim_information[\"claim_statement_period_end_date\"] = service_dates.length == 2 ? service_dates[1].to_s : service_dates[0].to_s if @claim_information.claim_statement_period_end_date.nil?\n elsif date_qualifier == \"435\" or date_qualifier == \"096\"\n if date_qualifier == \"435\"\n @claim_information[\"claim_statement_period_start_date\"] = c[1] if @claim_information.claim_statement_period_start_date.nil?\n @service_from_date = @claim_information.claim_statement_period_start_date\n else\n @claim_information[\"claim_statement_period_end_date\"] = c[1] if @claim_information.claim_statement_period_end_date.nil?\n @service_to_date = @claim_information.claim_statement_period_end_date\n end\n end\n end",
"def date_range(past_day=nil, past_month=nil, past_year=nil, future_day=nil, future_month=nil,future_year=nil)\n if (past_day != nil || past_month != nil || past_year != nil) && (future_day != nil || future_month != nil || future_year != nil)\n start_date = get_date(past_day,past_month,past_year,-1)\n end_date = get_date(future_day,future_month,future_year, 1)\n elsif past_day == nil && past_month == nil && past_year == nil && future_day == nil && future_month == nil && future_year == nil\n start_date = get_date(nil,nil,nil,0)\n end_date = get_date(nil,nil,nil,0)\n elsif (past_day == nil && past_month == nil && past_year == nil) && (future_day != nil || future_month != nil || future_year != nil)\n start_date = get_date(nil,nil,nil,0)\n end_date = get_date(future_day,future_month,future_year,1)\n elsif (past_day != nil || past_month != nil || past_year == nil) && (future_day == nil && future_month == nil && future_year == nil)\n start_date = get_date(past_day,past_month,past_year, -1)\n end_date = get_date(nil,nil,nil,0)\n else\n fail(\"Invalid Argument Passed to date range method. Please enter correct arguments\")\n end\n return start_date,end_date\nend",
"def to_range\n (@start_date..@end_date)\n end",
"def check_end_date\n # if self.category.eql?(\"appointment\")\n unless self.start_date.nil? or self.end_date.nil?\n if (self.end_date < self.start_date)\n self.category.eql?(\"appointment\")? self.errors.add(' ', 'End Date can\\'t be before Start Date') : self.errors.add(' ', 'Due Date can\\'t be before Start Date')\n end\n if self.end_date == self.start_date\n self.errors.add(' ', 'End Time can not be before start time') if (self.end_date.to_time < self.start_date.to_time)\n end\n end\n # end\n end",
"def event_start_for_solr\n # return event_start.iso8601[0,19]+'Z'\n start_date = event_start\n\t \n start_date = entry_deadline if is_opportunity?\n \n\t return FinderHelper.date_for_solr_ymd(start_date)\n end",
"def specified_period\n @range = [@start_date, @end_date]\n end",
"def validate_end_date_before_start_date\n return if date_out.nil? \n if date_out && date_in\n errors.add(:date_in, \": could not be after than Date out\") if date_out < date_in\n end\n end",
"def correct?\n starts_at < ends_at && starts_at.to_date == ends_at.to_date\n end",
"def end_date_after_start_date\n\t\tif end_date < start_date\n\t\t\terrors.add :end_date, \"Must be after Start Date\"\n\t\tend\n\tend",
"def dates_not_same\n if start_date == end_date\n errors.add(:start_date, 'start date can not equal end date')\n errors.add(:end_date, 'end date can not equal start date')\n end\n end",
"def event_finish_adv_search_for_solr\n #return event_finish.iso8601[0,19]+'Z'\n\t\t \n\t date_of_finish = event_start\n\t \n\t date_of_finish = event_finish unless event_finish.blank?\n\t \t \n\t date_of_finish = entry_deadline if is_opportunity?\n\t \t\t \n\t return FinderHelper.date_for_solr_ymd(date_of_finish)\n\tend",
"def expand_service_range\n self.service_start_date ||= (service_except_dates + service_added_dates).min\n self.service_end_date ||= (service_except_dates + service_added_dates).max\n true\n end",
"def started_at; end",
"def started_at; end",
"def started_at; end",
"def started_at; end",
"def started_at; end",
"def update!(**args)\n @end_as_of_date = args[:end_as_of_date] if args.key?(:end_as_of_date)\n @end_date = args[:end_date] if args.key?(:end_date)\n @start_as_of_date = args[:start_as_of_date] if args.key?(:start_as_of_date)\n @start_date = args[:start_date] if args.key?(:start_date)\n end",
"def end_date\n \"Calculate End Date\"\n end",
"def start_date\n taken_at || created_at \n end",
"def end_date_cannot_be_before_start_date\n\t\tif start_date.present? && end_date.present? && end_date < start_date\n\t\t\terrors.add(:end_date, \"cannot be before start date\")\n\t\tend\n\tend",
"def check_dates_are_valid\n if @start_date.present? && @end_date.present?\n errors.add(:end_date, \"can't be before the start date\") if @end_date < @start_date\n end\n end",
"def check_dates_are_valid\n if @start_date.present? && @end_date.present?\n errors.add(:end_date, \"can't be before the start date\") if @end_date < @start_date\n end\n end",
"def valid_end_date?\n if @end_date >= @start_date\n return true\n else\n return [false, \"Start date must be before end date\"]\n end\nend",
"def validate_dates\n if start_at && end_at\n errors.add(:end_at, 'should be greater than start date') if end_at <= start_at\n end\n end",
"def for_date_range(beginning:, ending:)\n new_with_date_range(beginning, ending)\n end",
"def valid_dates?\n if enddate && startdate && enddate <= startdate\n errors.add(:enddate, \"is before startdate\")\n end\n end",
"def index\n @events = Event.valid_dates\n @events = @events.after_startdate(params[:startdate]) if params[:startdate].present?\n @events = @events.before_enddate(params[:enddate]) if params[:enddate].present?\n end",
"def date_range\n errors.add(:start_date, 'can not be greater than end date') if start_date > end_date\n end",
"def validate_start_and_stop_date\n if active_date\n if active_start_date.nil? or active_stop_date.nil?\n errors.add(:active_date, \"start date or end date not set\")\n end\n end\n end",
"def between?(first_day, last_day)\n ((self.ends_at.to_date >= first_day) && (self.ends_at.to_date <= last_day)) || ((self.starts_at.to_date >= first_day) && (self.starts_at.to_date <= last_day))\n end",
"def adjust(start,finish)\n @start=DateTime.new(start.year,start.month,start.day)\n @finish=DateTime.new(finish.year,finish.month,finish.day)\n refresh\n end",
"def set_work_search_blog\n @event = Event.find(params[:id]) \n @event.date_range = @event.start.to_date.to_s + \" To \"+ (@event.end.to_date - 1.day).to_s \n end",
"def edutor_jobs\n if params[:start_date] and params[:end_date]\n @jobs = Job.where(\"startdate > :s and enddate < :e and hostname = :h\", :s=>params[:start_date].to_datetime,:e=>params[:end_date].to_datetime.next,:h=>\"M6650M453\").order('jobid desc')\n else\n @jobs = edutor_latest_jobs\n end\n end",
"def to_range\n start_date..end_date\n end",
"def readings\n\tstart_date, end_date = query_user_for_date_range\nend",
"def insurance_dates_validator\n errors.add(:end_date, 'cannot be before start date.') if start_date > end_date\n end",
"def end_date\n self.start_date + self.length.month\n end",
"def date_consistency\n\t\treturn if [start_time.blank?, end_time.blank?].any?\n\t\terrors.add(:start_time, 'must be after end_time') if start_time > end_time\n\tend",
"def date_consistency\n\t\treturn if [start_time.blank?, end_time.blank?].any?\n\t\terrors.add(:start_time, 'must be after end_time') if start_time > end_time\n\tend",
"def date_range\n self.errors.add(:start_date, I18n.t('tournament.date_mismatch')) if start_date > end_date\n end",
"def start_date_before_end_date\n begin\n date_start = USDateParse(self.start_date)\n date_end = USDateParse(self.end_date)\n rescue\n errors.add(:start_date, 'Could not verify that the start date is before the end date because the start and/or end dates are not parsable.')\n return\n end\n if date_start >= date_end\n errors.add(:start_date, \"Start date must be before end date.\")\n end\n end",
"def synthesize_end_date(params)\n Date.civil(params[:end_time][:year].to_i, params[:end_time][:month].to_i,\n params[:end_time][:day].to_i)\n end",
"def one_day?\n @start_date == @end_date\n end",
"def determine_end_date\n self.end_date = start_date.next_month.yesterday\n end",
"def date_from(db, str)\n return db.from(:observation_period).get { min(:observation_period_start_date) } if str.upcase == 'START'\n return db.from(:observation_period).get { max(:observation_period_end_date) } if str.upcase == 'END'\n return str\n end",
"def date_range( start_date, end_date )\n d_range = []\n cur_date = start_date \n\n until cur_date == end_date\n d_range << cur_date\n cur_date = Calendar.next_day( cur_date )\n end\n \n d_range << end_date\n end",
"def formatEventsDateRange(startdate, enddate)\n startdate.strftime(\"%b. %-d, %Y\") + \" - \" + enddate.strftime(\"%b. %-d, %Y\")\n end"
] | [
"0.77219456",
"0.6832269",
"0.67910236",
"0.6703548",
"0.6696157",
"0.66875243",
"0.6660278",
"0.6639319",
"0.655972",
"0.6543052",
"0.6486184",
"0.64834934",
"0.64624894",
"0.64533526",
"0.64481366",
"0.64407444",
"0.6438758",
"0.6430943",
"0.6428673",
"0.64265454",
"0.6419344",
"0.6401025",
"0.63896775",
"0.6389639",
"0.63704866",
"0.63440496",
"0.6339139",
"0.63261694",
"0.6316636",
"0.6306635",
"0.62974477",
"0.6270132",
"0.6264584",
"0.62626094",
"0.6259814",
"0.6259396",
"0.6249061",
"0.62371606",
"0.6236346",
"0.6232424",
"0.6224034",
"0.6221586",
"0.62144333",
"0.62064064",
"0.6206131",
"0.62041134",
"0.6200579",
"0.6199152",
"0.6195395",
"0.61773604",
"0.6168368",
"0.6167116",
"0.61630535",
"0.6153251",
"0.6146619",
"0.6145299",
"0.6143978",
"0.6139746",
"0.61332387",
"0.61295795",
"0.612854",
"0.61257577",
"0.61250985",
"0.6122133",
"0.6114465",
"0.6114465",
"0.6114465",
"0.6114465",
"0.6114465",
"0.61123174",
"0.60965395",
"0.6094696",
"0.6094454",
"0.60902476",
"0.60902476",
"0.60868526",
"0.60820794",
"0.6081444",
"0.6080967",
"0.6074502",
"0.6057383",
"0.60314125",
"0.6031102",
"0.60290825",
"0.6028755",
"0.6028428",
"0.6026762",
"0.60219496",
"0.60204405",
"0.60174394",
"0.6014481",
"0.6014481",
"0.6008435",
"0.6006553",
"0.599483",
"0.59873587",
"0.59750575",
"0.596985",
"0.5965563",
"0.59629786"
] | 0.73781955 | 1 |
new is either called by the user clicking login or by the authorize before_filter (due to forced shunting of dtu users). | def new
unless can? :login, User
render(:file => 'public/401', :format => :html, :status => :unauthorized) and return
end
case
when params[:only_dtu]
logger.info "Overriding shunt cookie with value from params. Using DTU CAS"
session[:only_dtu] = true
when params[:public]
logger.info "Overriding shunt cookie with value from params. Using local user"
session[:public] = true
when cookies[:shunt] == 'dtu'
logger.info "Shunt cookie set to 'dtu'. Shunting directly to DTU CAS"
session[:only_dtu] = true
when cookies[:shunt_hint] == 'dtu'
logger.info "Shunt hint cookie set to 'dtu'. Shunting with hint to DTU CAS"
session[:prefer_dtu] = true
when current_user.campus? && !current_user.walk_in?
logger.info "Campus request. Shunting with hint to DTU CAS"
session[:prefer_dtu] = true
end
# store given return url in session also, since omniauth-cas in
# test mode does not pass url parameter back to sessions_controller#create
url = session[:return_url] = params[:url] || '/'
redirect_to "#{omniauth_path(:cas)}?#{{ :url => url }.to_query }"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n # If someone is already logged in, skip this step\n login(current_user) and return if logged_in?\n end",
"def new\n __log_activity\n __debug_route\n @item = new_record\n user_authorize!\n rescue => error\n failure_status(error)\n end",
"def show\n # Authorizing that only logged in users can see that new\n authorize @new\n end",
"def new\n @user = User.new\n authorize! :create, @user\n end",
"def new\n redirect_to(dashboard_url) if user_signed_in?\n @allowedmethods = Identity.allowedmethods\n end",
"def new\n #user wants to log in \n end",
"def new\n #user wants to log in \n end",
"def new\n return appctrl_not_permitted() unless @current_user.admin?\n @record = @user = User.new\n end",
"def new\n #unless current_user.try(:has_role?, 'Librarian')\n # access_denied; return\n #end\n @user = User.new\n authorize @user\n prepare_options\n @user_groups = UserGroup.all\n @user.user_group = current_user.user_group\n @user.library = current_user.library\n @user.locale = current_user.locale\n end",
"def new\n authorize!(:new,current_user) unless current_user.role?:lawfirm_admin or current_user.role?:livia_admin\n @companies = Company.getcompanylist(current_user.company_id)\n end",
"def create\n # Creating a new with strong params\n @new = New.new(new_params)\n # Assinging that new to a specific user\n @new.user = User.first\n\n # Authorizing that only admin users can create a new\n authorize @new\n\n # If new is created and saved\n if @new.save\n # Show the specific new just created\n render :show, status: :created\n else\n # Show an error on the creation of the new\n render_error\n end\n end",
"def new\n if logged_in?\n redirect_to tasks_path, notice: \"ログイン済だよ。新規作成できない\"\n else\n @user = User.new\n end\n # if unless @user == current_user\n # redirect_to tasks_path, notice: \"登録は一回だけだよ\"\n # else\n # render :new \n # end\n # #\n end",
"def new\n if logged_in?\n redirect_to admin_url\n end\n end",
"def new_user_handler\n nil\n end",
"def new\n if logged_in?\n # Users who are logged in should not be shown the logon page, per feedback from confused users\n redirect_back_or_home \n elsif request.referer\n # If the user tried to access a page was denied, redirect them to the original page they\n # were denied access to, and not the '/denied' page\n flash[:login_referer_page] = (flash[:denied_path] ? flash[:denied_path] : request.referer)\n end\n end",
"def new\n if pre_auth.authorizable?\n if skip_authorization? || matching_token?\n auth = authorization.authorize\n parsed_redirect_uri = URI.parse(auth.redirect_uri)\n session.delete(:user_return_to)\n render \"doorkeeper/authorizations/redirect\", locals: { redirect_uri: parsed_redirect_uri }, layout: false\n else\n render \"doorkeeper/authorizations/new\"\n end\n else\n render \"doorkeeper/authorizations/error\"\n end\n end",
"def new\n unless has_cookies_enabled?\n flash[:error] = t 'ubiquo.auth.cookies_error'\n end\n unless ubiquo_users?\n flash.now[:notice] = t 'ubiquo.auth.create_superadmin'\n end\n if logged_in?\n redirect_to ubiquo.home_path\n end\n end",
"def new\n attempt_login\n redirect_to root_path if logged_in?\n end",
"def new\n redirect_to root_path if logged_in?\n @user = Coursewareable::User.new\n end",
"def new\n\t\tpre_new\n\tend",
"def new_user\n \n end",
"def new_authenticate\n\t\tif !current_admin and !current_user\n\t\t\tauthenticate_user\n\t\tend\n\tend",
"def new\n if current_user && current_user.role == \"admin\"\n @user = User.new \n else\n redirect_to new_user_session_path\n end \n end",
"def new\n @usuario = Usuario.new\n if current_user\n session[:admin_new] = true\n else\n session[:admin_new] = false\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usuario }\n end\n end",
"def newUser\n end",
"def authorize_new\n if forum?\n true # This will change once there are groups\n elsif blog?\n redirect_to home_url unless current_person?(@blog.person)\n end\n end",
"def new\n @timestamp = Time.zone.now.strftime(\"%s\") # this is used to reject the login form if it's too stale\n end",
"def new\n unless current_user.admin?\n flash[:error] = \"Users can only be created by administrators.\"\n redirect_to (request.env[\"HTTP_REFERER\"] || root_path) and return\n end\n \n @user = User.new\n end",
"def new\n __log_activity\n __debug_route\n opt = request_parameters\n mode = opt.delete(:mode)&.to_sym\n if mode == :local\n redirect_to **opt.merge(action: :sign_in_local)\n else\n super\n end\n end",
"def new \n\tif signed_in?\n\t\t@current_client = current_user.username\n\t\tif current_user.username == 'admin'\n\t\t\t@client = Client.new\n\t\telse\n\t\t\tredirect_to home_path\n\t\tend\n\t\t@actype = ''\n\telse\n\t\tredirect_to signin_path\n\tend\n end",
"def new\n if current_user7.admin?\n @user = User7.new\n end\n end",
"def authorize\n redirect_to new_session_path unless logged_in?\n end",
"def new\n\tif(filters)\n\t\t#Revisamos que no haya iniciado sesion\n\t\tif(session[:user_id])\n\t\t\tflash[:error] = \"Acceso denegado\"\n\t\t\tredirect_to home_path\n\t\t\treturn\n\t\tend\n\tend\n \n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def admin_new\n @guidance_groups = GuidanceGroup.where(org_id: current_user.org.id)\n @guidance_group = GuidanceGroup.new(org_id: current_user.org.id)\n authorize @guidance_group\n end",
"def authorise\n unless User.find_by_id(session[:user_id]) || (self.controller_name == 'users' && (self.action_name == 'new' || self.action_name == 'create'))\n session[:original_uri] = request.request_uri\n flash[:notice] = \"Please login!\"\n redirect_to login_url\n end\n end",
"def new\n \t@request=Request.new\n if !logged_in?\n flash[:danger]=\"Please login to access our services\"\n redirect_to root_url\n end\n end",
"def new\n redirect_to root_path if logged_in?\n end",
"def new\n if logged_in?\n # User who has logged in has no need to access create action\n redirect_to current_user\n else\n # Get ready to display signup page by declaring instance var\n \t @user = User.new\n end\n end",
"def new\n super\n @resource.user = current_user\n end",
"def auth_create_filter\n if not self.class.allowed_to_create\n false\n else\n true\n end\n end",
"def new\n head :bad_request unless authorizer.present?\n end",
"def authorize\n redirect_to login_path and return unless current_user\n @current_user.touch(:seen_at)\n end",
"def new\n if pre_authorizable?\n if user_has_signin_permission_to_application?\n auth = authorize_response\n redirect_to auth.redirect_uri, allow_other_host: true\n else\n session[:signin_missing_for_application] = application.try(:id)\n redirect_to signin_required_path\n end\n else\n render :error\n end\n end",
"def authorize\n redirect_to new_session_path unless logged_in?\n end",
"def guest\n @patient=User.find_by_wedgetail(params[:wedgetail],:order =>\"created_at DESC\")\n authorize_only (:patient) {@patient.wedgetail == @user.wedgetail}\n authorize :admin\n @newuser = User.new\n \n @newuser.username= WedgePassword.username_make(\"G\")\n @newuser.password= WedgePassword.random_password(6)\n @newuser.family_name=\"Guest \"[email protected]\n @[email protected] + @patient.wedgetail\n @newuser.role=7\n if @newuser.save \n render(:layout => \"layouts/guestcard\")\n flash.now[:notice] = \"Guest User Created\"\n else\n flash.now[:notice] = \"Guest User Not Created Due to Error\"\n redirect_to(patient_path(@patient.wedgetail))\n end\n end",
"def new\n\t#Are they already logged in?\n\t# if current_user #They are! Can't create them again.\n\t# @user = User.new\n\t# if params[:email] == current_user.email\n\t# if current_user.email\n\tif current_user\n\t\t# redirect_to users_url\n\t\tredirect_to users_results_url\n\telse\n\t\t@user = User.new\n\t\t# redirect_to users_results_url\n\t\trender :new\n\tend\nend",
"def new\n\n if signed_in? && !isAdmin?\n sign_out\n redirect_to signup_url\n elsif signed_in? && isAdmin?\n redirect_to \"/new_prof\"\n end\n @title= \"Sign Up\"\n @user = User.new\n\n \n end",
"def new\n if !current_user || is_admin?\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render :json => @user }\n end\n else\n redirect_to :root\n end\n end",
"def new\n @user = User.new\n enforce_create_permission(@user)\n end",
"def new_user\n \trender action: 'new_user'\n end",
"def create\n session[:enable_admin_pages] = false\n user = User.find_by(netid: auth_hash['extra']['netid'])\n if user\n session[:netid] = user.netid\n flash[:success] = \"Signed in as #{user.name}\"\n\n # Check auth for admin paths - in this case they have a user record, so set true\n # In other apps further permissions can be checked e.g. admin user type\n session[:enable_admin_pages] = true\n\n redirect_to session[:return_url] || root_path\n else\n redirect_to not_authorized_path\n end\n end",
"def authorized\n redirect_to new_user_session_path unless logged_in?\n end",
"def authorize\n redirect_to new_session_path unless current_user #call method curent_user in sessions_helper\n end",
"def new\n reset_session_key(:user, :new, {})\n redirect_to admin_user_step_path(id: 'identity')\n end",
"def new\n\t\t@roles_new = Role.all\n\t\tif can?(:update, Role)\n\t\t\t@roles_new = Role.all\n\t\tend\n\n @user = User.new if can?(:create, User)\n respond_to do |format|\n format.json { render :json => @user } \n format.xml { render :xml => @user }\n format.html\n end\n end",
"def new\n\t\t###@the_user = User.create_new\n\t\t@the_user = User.new(user: current_user)\n\t\t@roles = Role.all\n\t\t@groups = Group.all\n\t\t@projects = Project.all\n\t\t@themes = get_themes(@theme)\n\t\t@time_zones = get_time_zones(@time_zone)\n\t\t@volumes = Volume.find_all\n\t\t@types = Typesobject.get_types(\"user\")\n\t\t@subscriptions = Subscription.all\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @the_user }\n\t\tend\n\tend",
"def new\n @permitted_user = PermittedUser.new\n end",
"def new?\n super && !user.admin? && not_a_visitor && !user_has_other_application?\n end",
"def new\n # binding.irb\n super\n # @user = User.new\n end",
"def create\n @user = User.new(user_params)\n @main = @user.main\n authorize @user\n\n if @user.save\n sign_in(@user)\n redirect_to(@user)\n else\n render :new\n end\n end",
"def new\n do_new_resource\n get_project_site\n do_set_attributes\n do_authorize_instance\n\n respond_new\n end",
"def new\n authorize\n @post = Post.new\n end",
"def create\n self.resource = warden.authenticate!(auth_options)\n def is_active?\n self.resource.etat\n end\n\n # Si le user n'est pâs activer il est \n if is_active?\n current_user.update(presence: true, date_derniere_connexion: Time.now.utc)\n if current_user.categorie == \"Admin\"\n redirect_to ecoles_liste_path, notice: \"Bienvenue !!!\"\n else\n redirect_to root_path, notice: \"Bienvenue !!!\"\n end\n else\n session.clear\n redirect_to user_session_path, notice: \"Désolé votre compte à été desactiver\"\n end\n end",
"def new\n\t\t@user = User.new\n\t\t@addresses = Address.all\n\t\t@address = Address.new\n\t\t\n\t\twidok = 'new'\n\t\twidok = 'user_new' if !(admin_logged_in?)\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html { render widok } # new.html.erb\n\t\t\tformat.xml\t{ render :xml => @user }\n\t\tend\n\tend",
"def new\n \n respond_to do |format|\n # unregistered users or admin can create new users\n if session[:user_id].nil? || User.find(session[:user_id]).status == 'admin'\n @user = User.new\n \n format.html # new.html.erb\n format.json { render json: @user }\n else\n @user = User.find(session[:user_id])\n format.html { redirect_to @user, notice: 'loged in as ' + @user.lname }\n format.json { render json: @user, status: :in, location: @user }\n end\n end\n end",
"def new_load_voyage\n return if authorise_for_web(program_name?,'create')== false\n render_new_load_voyage\n end",
"def new\n unless @current_admin.is_super_admin\n flash[:error]=\"You are not authorized to navigate to this page \"\n redirect_to admin_index_path\n return\n end\n @new_admin=Admin.new\n end",
"def new\n \t#declare user variabel with assign new user\n \t@user=User.new\n end",
"def new\n @employee = Employee.new\n @lawfirm_admin = User.new\n @roles = Role.scoped_by_company_id(current_user.company_id)\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lawfirm_admin }\n authorize!(:new,current_user) unless current_user.role?:lawfirm_admin\n end\n end",
"def new\n session[:user_return_to] ||= params[:user_return_to]\n @already_hoc_registered = params[:already_hoc_registered]\n @hide_sign_in_option = true\n if params[:providerNotLinked]\n if params[:useClever]\n # The provider was not linked, and we need to tell the user to sign in specifically through Clever\n flash.now[:alert] = I18n.t 'auth.use_clever', provider: I18n.t(\"auth.#{params[:providerNotLinked]}\")\n else\n # This code is only reached through the oauth flow when the user already has an email account.\n # Usually email would not be available for students, this is a special case where oauth fills it in.\n flash.now[:alert] = I18n.t 'auth.not_linked', provider: I18n.t(\"auth.#{params[:providerNotLinked]}\")\n @email = params[:email]\n end\n end\n super\n end",
"def create\n redirect_or_render authorization.authorize\n end",
"def new\n if current_user\n redirect_to root_url\n end\n @user_session = UserSession.new\n end",
"def new\n\t\t@unregistered_user = IncompleteUser.find(session[:tmp_checked])\n\t\t@user = User.new\n\t\[email protected]_list = '0123'\n\tend",
"def create\n if request.get? && params[:action] == 'new' && @open_auth\n @open_auth.open_authentication.connection_established\n log_in @open_auth.open_authentication.user\n redirect_back_or_default user_newsfeed_url(@open_auth.open_authentication.user)\n end\n end",
"def bind_new\n\t\t@user = User.new(params[:user])\n\t\taid = params[:authentication][:id]\n\n\t\t@auth = Authentication.find(aid)\n\t\tif @auth && @auth.user_id.blank?\n\t\t\tif @user.valid?\n\t\t\t\[email protected] = @auth.avatar\n\t\t\t\[email protected] = @auth.sex\n\t\t\t\[email protected] = @auth.birthday\n\t\t\t\[email protected]!\n\t\t\t\tsign_in(@user)\n\t\t\t\t#update current created user_id to Authentication.user_id\n\t\t\t\[email protected]_id = @user.id\n\t\t\t\[email protected]!\n\t\t\t\tredirect_to \"/\"\n\t\t\telse\n\t\t\t\t@is_new_active = true\n\t\t\t\trender :action => \"bind\"\n\t\t\t\treturn\n\t\t\tend\t\n\t\tend\n\tend",
"def new\n\t\traise\n\t\t@membership = Membership.create(user_id: session[:user_id], group_id: session[:false_id], admin: false)\n\t\[email protected]\n\t\traise\n\t\t#redirect_to 'groups'\n\tend",
"def new\n raise CanCan::AccessDenied\n end",
"def new\n @event = Event.new\n authorize @event, :new?\n end",
"def new\n # render login page\n end",
"def new\n authorize! :create, @event.event_registrations.new\n @event_registration = @event.event_registrations.new(user: current_user)\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def new\n redirect_to dashboard_path, notice: \"Logged in!\" if logged_in?\n end",
"def new\n if logged_in?\n redirect_to user_path(current_user) # Redirect to user show page if logged in\n else \n @user = User.new # Stub a new user\n render layout: 'welcome' # Render sign up form with welcome layout\n end \n end",
"def new #login page\n end",
"def new\n unless signed_in?\n @user = User.new\n else\n redirect_to root_url #? root_path and root_url are the same?\n end\n end",
"def create\n @user = params[:user] ? User.new(params[:user]) : User.new_guest\n if @user.save\n flash[:notice] = \"Your account was created successfully.\"\n current.user.move_to(@user) if current.user && current.user.guest?\n session[:user_id] = @user.id\n redirect_to root_path\n else\n render \"new\"\n flash[:notice] = \"There was a problem creating your account.\"\n end\n after_create :set_admin \n end",
"def new\n puts 'new_user_path'\n @user = User.new(session[:auth_field] => session[:auth_value])\n if params[:course].nil? # so edit view doesn't complain\n params[:course] = params[:proglang] = params[:category] = {}\n end\n\n puts 'is it cas?'\n\n if session[:auth_provider].to_sym == :cas\n unless @user.fill_from_ldap\n logger.warn \"UsersController.new: Failed to find LDAP::Person for uid #{session[:auth_value]}\"\n end\n end\n\n puts 'is it shib?'\n\n if session[:auth_provider].to_sym == :shibboleth\n unless @user.fill_from_shib\n logger.warn \"UsersController.new: Failed to create user for uid #{session[:auth_value]}\"\n end\n end\n\n puts 'is it google??'\n\n if session[:auth_provider].to_sym == :google_oauth2\n puts 'it is google'\n unless @user.fill_from_google_auth2(session[:info_hash])\n logger.warn \"UsersController.new: Failed to create user for uid #{session[:auth_value]}\"\n end\n end\n\n puts 'end of new_user_path'\n end",
"def new\n redirect_to '/404.html' and return if params[:auth_token].nil? || not_allowed_user\n @form = Form.new\n @form.user_id = user.id\n end",
"def create\n counter_fixation # Counter session fixation (but save forwarding url)\n if Rails.application.config.deny_login\n flash.now[:danger] = t('sessions.login_disabled')\n render 'new', status: :forbidden\n elsif request.env['omniauth.auth'].present?\n omniauth_login\n elsif params[:session][:provider] == 'local'\n local_login\n else\n flash.now[:danger] = t('sessions.incorrect_login_info')\n render 'new'\n end\n end",
"def new\n\n\t\t\n\tend",
"def create\n\t\tredirect_to '/users/sign_in', alert: 'Access denied.'\n\tend",
"def authorize\n if !user_signed_in?\n redirect_to new_user_session_path\n end\n end",
"def new\n if logged_in?\n redirect_to index_path\n end\n end",
"def login_required\n if params[:create_user] # hidden field in posted form. Create the user.\n user = User.new\n user.last_login = request.remote_ip\n if user.save && user.errors.empty?\n self.current_user = user # !! now logged in\n else\n flash[:error] = \"I am sorry. the system could not create a new account for you.\"\n access_denied\n end\n elsif authorized?\n return true\n else\n access_denied\n end\n end",
"def new\n user = User.not_deleted.find_for_database_authentication(:email => params[:email])\n if user.nil? then\n expose :message=>'User or password incorrect for this site', :error=>true\n return;\n end\n\n # Invalidate any session the user ha now\n # invalidateUserSession user\n\n # Validate the password, as you can see, if the password is wrong, the user seession is already\n # gone, this can improve security.\n if !user.valid_password?(params[:password]) then\n expose :message=>'User or password incorrect for this site', :error=>true\n return;\n end\n\n #Validate the customer id\n if !user.isAdmin? && !user.valid_customer_id(params[:customer_id]) then\n expose :message=>'User, password or customer id incorrect for this site', :error=>true\n return\n end\n\n #Validate the user site\n if user.isSiteLogin? && (params[:site_name].nil? || !user.valid_site?(params[:site_name])) then\n expose :message=>'User, password or customer id incorrect for this site', :error=>true\n return\n end\n\n if params[:user_type] then\n if user.user_type_name.downcase != params[:user_type].downcase\n expose :message=>\"Only '#{params[:user_type].capitalize}' Users are available to use this app\", :error => true\n return\n end\n end\n\n # Create a new session\n site = Site.find_site_by_name params[:site_name]\n customer = Customer.find_by_customer_id params[:customer_id]\n token = generateUserSession(user, site, customer)\n\n setCurrentUser user\n expose :token => token, :role => getCurrentRole.role_id\n end",
"def developer_new\n return unless Rails.env.development?\n unless user_signed_in?\n dev_user = User.find_by(\n uid: DEVELOPMENT_USER_CONFIG[:uid]\n ) || User.create!(DEVELOPMENT_USER_CONFIG)\n\n sign_in(dev_user, scope: :user)\n end\n redirect_to root_path\n end",
"def new\n\t\t#super\n\t\t# Overwriting /signup method to redirect to users/new \n\t\t respond_to do |format|\n format.html { redirect_to new_user_path }\n end\n\tend",
"def new\n @restaurant = Restaurant.new\n # authorize(@restaurant)\n end",
"def new?\n if is_super_admin?\n true\n elsif is_admin? && !has_company?\n true\n else\n false\n end\n end",
"def new\n @city = City.new\n authorize @city\n end",
"def new\r\n\r\n end"
] | [
"0.717691",
"0.71701044",
"0.70711446",
"0.69672555",
"0.6827384",
"0.6819191",
"0.6819191",
"0.68006086",
"0.6777822",
"0.6741721",
"0.6735178",
"0.67319906",
"0.6706283",
"0.6703787",
"0.6666447",
"0.66441965",
"0.6634656",
"0.66270345",
"0.66067564",
"0.66027606",
"0.6590432",
"0.6569675",
"0.6566725",
"0.6534471",
"0.65204644",
"0.6510192",
"0.65079176",
"0.64851916",
"0.6460732",
"0.6458053",
"0.64492154",
"0.64460903",
"0.64441055",
"0.64410114",
"0.6429767",
"0.64234835",
"0.6419628",
"0.6415209",
"0.64120173",
"0.64114",
"0.6408758",
"0.64082205",
"0.64053637",
"0.6405296",
"0.64050645",
"0.63836855",
"0.6381389",
"0.6380269",
"0.6376946",
"0.6373301",
"0.6355106",
"0.63451624",
"0.6342282",
"0.6323335",
"0.63192713",
"0.63159245",
"0.62953407",
"0.62938595",
"0.62935716",
"0.62926453",
"0.6288474",
"0.6288254",
"0.628221",
"0.62781906",
"0.6277246",
"0.6273121",
"0.627238",
"0.62704575",
"0.6268786",
"0.62655616",
"0.6259546",
"0.6255482",
"0.6249678",
"0.6248518",
"0.6245399",
"0.62443936",
"0.62435865",
"0.62376344",
"0.62358236",
"0.62324107",
"0.6228411",
"0.62224346",
"0.62204593",
"0.621964",
"0.62192774",
"0.6211255",
"0.6210904",
"0.6210392",
"0.6206603",
"0.6202944",
"0.62021023",
"0.619447",
"0.6193984",
"0.61899424",
"0.6189881",
"0.61763525",
"0.6173695",
"0.61687535",
"0.61667395",
"0.6165392"
] | 0.6620625 | 18 |
setup is called by omniauth before the request phase. We utilize it to setup extra query parameters to Riyosha in the CAS request based on the session | def setup
case
when session.delete(:only_dtu)
request.env['omniauth.strategy'].options[:login_url] = '/login?only=dtu&template=dtu_user'
when session.delete(:prefer_dtu)
request.env['omniauth.strategy'].options[:login_url] = '/login?template=dtu_user'
when session.delete(:public)
request.env['omniauth.strategy'].options[:login_url] = '/login?template=local_user'
else
request.env['omniauth.strategy'].options[:login_url] = '/login'
end
render :text => "Omniauth setup phase.", :status => 404
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup\n # this method gets called before *each* omniauth endpoint call, so try to avoid logging when we're returning from\n # oauth'ing\n unless stored_register_redirect\n reg_redirect = params[:r]\n reg_redirect ||= request.referer if params[:ot] && (params[:ot] == \"far\") # facebook auth referral\n store_register_redirect(reg_redirect)\n end\n\n unless stored_auth_redirect\n auth_redirect = params[:r]\n auth_redirect ||= root_path if params[:state] && (params[:state] == 'w')\n store_auth_redirect(auth_redirect)\n end\n\n remember_remember_me\n remember_signup_flow_scope\n remember_signup_flow_type\n remember_signup_flow_origin_type\n remember_signup_flow_destination\n remember_signup_flow_network\n render :text => \"Setup complete.\", :status => 404\n end",
"def setup_env_params\n unless request.env.key?('omniauth.params')\n request.env['omniauth.params'] = {}\n end\n request.env['omniauth.params']['namespace_name'] = nil\n request.env['omniauth.params']['resource_class'] = 'User'\n end",
"def request_phase\n # Stash the account into the session so that we\n # can trieve it during the callback.\n session['omniauth.zendesk.account'] = fetch_zendesk_account\n\n # Prep the urls using the account ID.\n # TODO: Could we use the :setup option and a Proc\n # to handle this rather than call here?\n set_omniauth_zendesk_urls\n\n # Continue the request as usual.\n super\n end",
"def auth_setup\n service = Person::OmniauthService::SetupPhase.new(community: @current_community, params: params, request: request)\n service.run\n render :plain => \"Setup complete.\", :status => 404 #This notifies the ominauth to continue\n end",
"def prepare\n reset\n\n yield self if block_given?\n\n # Since the OAuth flow is performed by the browser, we'll need to boot\n # the Sinatra app instead of just stubbing the app with WebMock...\n boot_once\n\n OmniAuth::Strategies::Icalia.instances.each do |strategy|\n strategy.options.client_options.tap do |options|\n options.site = url\n options.token_url = \"#{url}/oauth/token\"\n options.authorize_url = \"#{url}/oauth/authorize\"\n end\n end\n end",
"def setup\n if @request.present?\n @request.env['HTTP_ACCEPT'] = 'application/json'\n @request.headers['x-api-key'] = 'some_api_key'\n end\n ActiveSupport::Cache::FileStore.any_instance.stubs(:read).returns(\"anandsai_auth\")\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 callback_phase # rubocop:disable AbcSize, CyclomaticComplexity, MethodLength, PerceivedComplexity\n super\n @env['omniauth.params'] = decode_jwt_state(session['omniauth.state'])\n end",
"def request_setup(method, path, params)\n Proc.new do |request|\n request.headers[:authorization] = \"Bearer #{@access_token}\"\n end\n end",
"def request_phase\n p session['omniauth.state']\n OmniAuth::Strategies::Dailycred::AUTH_PARAMS.each do |param|\n val = session['omniauth.params'][param]\n if val && !val.empty?\n options[:authorize_params] ||= {}\n options[:authorize_params].merge!(param => val)\n end\n end\n old_request_phase\n end",
"def request_setup(method, path, params)\n proc do |request|\n if @access_token\n request.headers[\"X-ACCESS-TOKEN\"] = @access_token\n elsif @xapp_token\n request.headers[\"X-XAPP-TOKEN\"] = @xapp_token\n end\n if @logger\n params_s = (\"?\" + params.select { |k, v| k }.map { |k, v|\n \"#{k}=#{CGI.escape(v.to_s)}\"\n }.join(\"&\")) if params.any?\n @logger.info \"#{method.upcase} #{path}#{params_s}\"\n request.headers.each_pair do |k, v|\n @logger.debug \" #{k}: #{v}\"\n end\n end\n end\n end",
"def setup\n @account = accounts(:test_account)\n @user = @account.users.first\n \n # All requests are at account domain with logged-in user unless\n # otherwise specified in the test method\n @request.host = \"#{@account.domain}.ticktockapp.com\"\n @request.session = {:user_id => @user.id}\n end",
"def request_setup(method, path, params, signature_params)\n Proc.new do |request|\n request.headers[:authorization] = bearer_auth_header\n end\n end",
"def callback_phase\n # Prep the urls using the account ID.\n # TODO: Could we use the :setup option and a Proc\n # to handle this rather than call here? \n set_omniauth_zendesk_urls\n\n # Continue the request as usual.\n super\n end",
"def authorize_params\n super.tap do |params|\n provider = session['omniauth.params'].delete('provider') rescue nil\n params[:provider] = provider if provider\n\n service = session['omniauth.params'].delete('service') rescue nil\n params[:service] = service if service\n\n context = session['omniauth.params'].delete('context') rescue nil\n params[:context] = context if context\n end\n end",
"def setup\n @event = Event.create(eventName: \"socialLogin\")\n @referral = Referral.create(referredBy: \"http://www.jumpstartlabs.com\")\n @request = Request.create(requestType: \"GET\")\n @resolution = Resolution.create(resolutionWidth: \"1920\", resolutionHeight: \"1280\")\n @url = Url.create(url: \"http://www.jumpstartlabs.com\")\n @user_agent = UserAgent.create(userAgent: \"Mozilla/5.0 (Macintosh%3B Intel Mac OS X 10_8_2) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1309.0 Safari/537.17\")\n @user = User.create(identifier: \"jumpstartlab\", rootUrl: \"hweoaw;eofiawofhawef\")\n end",
"def set_auth\n @auth = session[:omniauth] if session[:omniauth]\n end",
"def setup_needed(oid, request, session)\n identifier = session[:openid_param]\n session[:setup_needed] = true\n redirect req.script_name + '?' + openid_param + '=' + identifier\n end",
"def callback_phase\n error = request.params['error_reason'] || request.params['error']\n fail(OAuthError, error) if error\n @session_state = request.params['session_state']\n @id_token = request.params['id_token']\n @code = request.params['code']\n @claims, @header = validate_and_parse_id_token(@id_token)\n # validate_chash(@code, @claims, @header)\n super\n end",
"def prepare\n remember_remember_me\n remember_signup_flow_type\n remember_signup_flow_origin_type\n remember_signup_flow_destination\n remember_signup_flow_network\n redirect_to auth_path(params[:network] || 'facebook')\n end",
"def setup\n # !!!! Once you have enabled test mode, all requests to OmniAuth will be short circuited to use the mock authentication hash.\n # A request to /auth/provider will redirect immediately to /auth/provider/callback !!!!\n OmniAuth.config.test_mode = true\n end",
"def callback_phase\n options.client_options[:access_token_path] = \"/oauth/qzoneoauth_access_token?oauth_vericode=#{request['oauth_vericode'] }\" if request['oauth_vericode']\n super\n end",
"def auth_param; end",
"def set_user_info\n response = Request.send_request_action(action: \"index\", cookie: @cookie)\n @authkey = response[:response][\"authkey\"]\n @passkey = response[:response][\"passkey\"]\n @user_id = response[:response][\"id\"]\n end",
"def authorize_params\n super.tap do |params|\n %w[ state ].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n\n # to support omniauth-oauth2's auto csrf protection\n session['omniauth.state'] = params[:state] if v == 'state'\n end\n end\n end\n end",
"def setup_env_params\n {\n url: @request.respond_to?(:original_url) ? @request.original_url : @request.path_info,\n referrer: @request.referer,\n http_method: action_dispatch? ? @request.method : @request.request_method,\n ip_address: @request.respond_to?(:remote_ip) ? @request.remote_ip : @request.ip,\n user_agent: @request.user_agent\n }\n end",
"def params_auth_hash; end",
"def callback_phase\n ym_session_id = env['rack.session'][RACK_SESSION_KEY]\n fail!(E_YM_SESSION_ID_BLANK) if ym_session_id.blank?\n ym_session = YourMembership::Session.new(ym_session_id, 100)\n\n begin\n fail! 'Failed To Log In' unless ym_session.authenticated?\n rescue YourMembership::Error => e\n fail! e.error_description\n end\n\n @user_id = ym_session.user_id\n @access_token = ym_session.to_s\n\n super\n end",
"def request_phase\n # Build a new request.\n saml_auth_request = OneLogin::RubySaml::Authrequest.new\n\n # Amend the settings.\n with_settings do |settings|\n # Redirect the user to the federated sign-in page.\n redirect saml_auth_request.create(settings)\n end\n rescue RuntimeError\n fail!(:invalid_response, $!)\n end",
"def prepare_request(request)\n request['x-api-key'] = @api_key if @api_key\n request\n end",
"def request_call # rubocop:disable CyclomaticComplexity, MethodLength, PerceivedComplexity\n setup_phase\n log :debug, 'Request phase initiated.'\n\n # store query params from the request url, extracted in the callback_phase\n session['omniauth.params'] = request.GET\n\n OmniAuth.config.request_validation_phase.call(env) if OmniAuth.config.request_validation_phase\n OmniAuth.config.before_request_phase.call(env) if OmniAuth.config.before_request_phase\n\n if options.form.respond_to?(:call)\n log :debug, 'Rendering form from supplied Rack endpoint.'\n options.form.call(env)\n elsif options.form\n log :debug, 'Rendering form from underlying application.'\n call_app!\n elsif !options.origin_param\n request_phase\n else\n if request.params[options.origin_param]\n env['rack.session']['omniauth.origin'] = request.params[options.origin_param]\n elsif env['HTTP_REFERER'] && !env['HTTP_REFERER'].match(/#{request_path}$/)\n env['rack.session']['omniauth.origin'] = env['HTTP_REFERER']\n end\n\n request_phase\n end\n rescue OmniAuth::AuthenticityError => e\n fail!(:authenticity_error, e)\n end",
"def callback_phase\n @auth_token = get_auth_token(request.params[\"username\"], request.params[\"sid\"])\n @user_info = get_user_info(request.params[\"username\"], @auth_token)\n ap @user_info\n super\n rescue => ex\n fail!(\"Failed to retrieve user info from ebay\", ex)\n end",
"def setup\n # Once you have enabled test mode, all requests\n # to OmniAuth will be short circuited to use the mock authentication hash.\n # A request to /auth/provider will redirect immediately to /auth/provider/callback.\n OmniAuth.config.test_mode = true\n end",
"def callback_phase\n @user_info = get_user(@auth_token = fetch_auth_token(session['omniauth.ebay.session_id']))\n super\n end",
"def request_phase\n puts \"Request\"\n @request.params.each { |index, value| puts \"param#{index} = #{value}\" }\n settings = override_options(options.dup)\n settings[:reply] ||= callback_url\n auth_request = OmniAuth::Strategies::WSFed::AuthRequest.new(settings, :whr => @request.params['whr'])\n redirect(auth_request.redirect_url)\n end",
"def sakai_init\n {\n \"openid_configuration\": SAKAI_OPENID_CONFIGURATION,\n \"registration_token\": \"1641258858:09e941d2-15cc-4389-be3f-dc1e04c14061\",\n }\nend",
"def authenticate_if_necessary!\n return unless authenticate? && should_encode?\n raise Chimps::AuthenticationError.new(\"Catalog API key (Chimps.config[:catalog][:key]) or secret (Chimps.config[:catalog][:secret]) missing from #{Chimps.config[:config]} or #{Chimps.config[:site_config]}\") unless (authenticable? || @forgive_authentication_error)\n query_params[:requested_at] = Time.now.to_i.to_s\n query_params[:apikey] = Chimps.config[:catalog][:key]\n end",
"def userauth_request(username, next_service, auth_method, *others); end",
"def set_request; end",
"def setup\n OmniAuth.config.test_mode = true\n OmniAuth.config.mock_auth[:github] = OmniAuth::AuthHash.new({:provider => 'github',:uid => '123545',:info => {:name => 'Satine', :email => '[email protected]'}})\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 initialize_query\r\n # Fix some strange request environments.\r\n env_table['REQUEST_METHOD'] ||= 'GET'\r\n\r\n # POST assumes missing Content-Type is application/x-www-form-urlencoded.\r\n if env_table['CONTENT_TYPE'].blank? && env_table['REQUEST_METHOD'] == 'POST'\r\n env_table['CONTENT_TYPE'] = 'application/x-www-form-urlencoded'\r\n end\r\n\r\n @cookies = CGI::Cookie::parse(env_table['HTTP_COOKIE'] || env_table['COOKIE'])\r\n @params = {}\r\n end",
"def request_setup request_context\n http_method = case request_context[:method]\n when :get\n Net::HTTP::Get\n when :post\n Net::HTTP::Post\n when :put\n Net::HTTP::Put\n when :delete\n Net::HTTP::Delete\n else\n raise \"Only :get, :post and :delete http method types are allowed.\"\n end\n headers = request_context[:headers] || {}\n setup = http_method.new request_context[:uri].request_uri\n setup.initialize_http_header headers\n setup.basic_auth(request_context[:uri].user, request_context[:uri].password) if request_context[:uri].user && request_context[:uri].password\n setup\n end",
"def callback_call\n setup_phase\n log :debug, 'Callback phase initiated.'\n @env['omniauth.origin'] = session.delete('omniauth.origin')\n @env['omniauth.origin'] = nil if env['omniauth.origin'] == ''\n @env['omniauth.params'] = session.delete('omniauth.params') || {}\n OmniAuth.config.before_callback_phase.call(@env) if OmniAuth.config.before_callback_phase\n callback_phase\n end",
"def setup\n # $log_on = true\n Sage::Test::Server.cas_server_sage.ensure\n Sage::Test::Server.sagebusinessbuilder.ensure\n Sage::Test::Server.sageaccountmanager.ensure\n Sage::Test::Server.billingboss.ensure\n @user = watir_session.with_sage_user(:castest)\n SSO::SAM.prepare\n assert_recaptcha_off(@user)\n SSO::SBB.prepare(true)\n @user.logs_out_cas\n @debug = false\n end",
"def init_params(params)\n @client_id = params[:client_id]\n @user_id = params[:user_id]\n\n @client = Client.get_from_memcache(@client_id)\n @user = User.using_client_shard(client: @client).find(@user_id)\n @double_opt_in_token = nil\n end",
"def required_params\n [:cas_server, :authentication_path]\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 request_setup()\n Proc.new do |request|\n request.headers[:authorization] = basic_auth_header\n request.headers[:content_type] = 'application/json; charset=UTF-8'\n request.headers[:accept] = 'application/json; charset=UTF-8'\n end\n end",
"def setup\n post '/login', :fb_access_token => FB_ACCESS_TOKEN\n assert last_response.ok?\n # puts \"[TEST] -- \" + last_response.body\n hash = JSON.parse(last_response.body)\n assert hash.key? \"token\"\n assert hash.key? \"signup\"\n assert hash[\"signup\"] == \"false\" or hash[\"signup\"] == \"true\"\n assert hash[\"token\"].class == String and hash[\"token\"].length > 0\n @@token = hash[\"token\"]\n end",
"def set_params_from_omniauth_hash_to_pass_it_to_transfer_to_guest_cmpsr\n @params_from_omniauth_for_transfer_to_guest_cmpsr = pick_fields_from_omniauth_hash_that_will_be_passed_to_transfer_guest_cmpsr_as_params\n end",
"def request_authorized_query query_string\n query query_string\nend",
"def stub_cas_first_login(pending_sage_user, pending_sage_user_email, source='billingboss')\n unstub_cas\n stub_cas_check_status\n RAILS_DEFAULT_LOGGER.debug(\"stubbing for first_login. pending_sage_user: #{pending_sage_user} pending_sage_user_email: #{pending_sage_user_email.inspect}\") \n CASClient::Frameworks::Rails::Filter.send :define_method, :handle_authentication do\n RAILS_DEFAULT_LOGGER.debug \"in stub for first_login. pending_sage_user: #{pending_sage_user} pending_sage_user_email: #{pending_sage_user_email.inspect}\" \n controller.session[:sage_user] = pending_sage_user\n controller.session[:cas_extra_attributes] = {:username => pending_sage_user, :email => pending_sage_user_email, :source => source}.with_indifferent_access \n return (returns_url? ? service_url : true)\n end\n end",
"def auth_hash\n @auth_hash ||= request.env['omniauth.auth']\n end",
"def setup\n @model = Participant\n @controller = ParticipantsController.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n\n @request.session[:user] = User.find(users(:superadmin).id )\n roleid = User.find(users(:superadmin).id).role_id\n Role.rebuild_cache\n\n Role.find(roleid).cache[:credentials]\n @request.session[:credentials] = Role.find(roleid).cache[:credentials]\n # Work around a bug that causes session[:credentials] to become a YAML Object\n @request.session[:credentials] = nil if @request.session[:credentials].is_a? YAML::Object\n @settings = SystemSettings.find(:first)\n AuthController.set_current_role(roleid,@request.session)\n\n @User = participants(:par15)\n end",
"def initialize_session\n query_data = {\n \"IsHacked\" => @is_hacked,\n \"DeviceGenerationInfo\" => @device_generation_info,\n \"PublisherSDKVersion\" => @publisher_sdk_version,\n \"IsUsingSdk\" => @is_using_sdk,\n \"PublisherUserId\" => @publisher_user_id,\n \"OSVersion\" => @os_version,\n \"ClientIp\" => @client_ip,\n \"UDIDs\" => parse_udids, \n \"AppId\" => @app_id,\n \"IsOnCellular\" => @is_on_cellular\n }\n \n @raw_data = post_request(@api_url, query_data.to_json)\n @session = W3i::SessionData.new(@raw_data)\n\n true\n end",
"def initialize_query\n # Fix some strange request environments.\n env_table['REQUEST_METHOD'] ||= 'GET'\n\n # POST assumes missing Content-Type is application/x-www-form-urlencoded.\n if env_table['CONTENT_TYPE'].blank? && env_table['REQUEST_METHOD'] == 'POST'\n env_table['CONTENT_TYPE'] = 'application/x-www-form-urlencoded'\n end\n\n @cookies = CGI::Cookie::parse(env_table['HTTP_COOKIE'] || env_table['COOKIE'])\n @params = {}\n end",
"def initialize(options={})\n @next_url = options[:callback_url] \n @sess = true\n @secure = SECURE_AUTHSUB_ENABLED # set secure = true for signed AuthSub requests\n if options[:auth_token]\n @client.authsub_token = options[:auth_token] \n # Set private key when upgrading token to session\n @client.authsub_private_key = private_key if @secure\n end\n end",
"def pre_connect(request); end",
"def capture_common_session_vars\n # merge omniauth params\n if request.env['omniauth.params']\n full_params = request.env['omniauth.params'].deep_merge(params).with_indifferent_access\n else\n full_params = params\n end\n\n session[:source] = full_params[:s] if full_params[:s].present?\n session[:campaign] = full_params[:c] if full_params[:c].present?\n session[:landing_page] = full_params[:lp] if full_params[:lp].present?\n\n # google analytics\n session[:source] = full_params[:utm_source] if full_params[:utm_source].present?\n session[:campaign] = full_params[:utm_campaign] if full_params[:utm_campaign].present?\n\n # offers\n session[:offer_code] = full_params[:offer_code] if full_params[:offer_code].present?\n\n # couponing\n session[:coupon_code] = full_params[:coupon_code] if full_params[:coupon_code].present?\n\n if full_params[:email].present?\n puts \"CAPTURING EMAIL: #{full_params[:email]}\"\n create_or_update_lead(full_params[:email], {source:session[:source], campaign:session[:campaign], landing_page:session[:landing_page]})\n end\n end",
"def http_auth_hash; end",
"def init_session\n before do\n path = defined?(init_session_path) ? init_session_path : '/'\n get(path)\n end\n end",
"def prepare\n login\n end",
"def setup_req_id_and_session_id\n random_string = \"#{Time.now.to_i}#{Kernel.rand(10000)}\"\n self.req_id ||= Utils::Crypth.uniq_token(\"#{random_string}#{(0..2000).to_a.sample}\") \n self.session_id ||= Utils::Crypth.uniq_token(\"#{random_string}#{(0..2000).to_a.sample}\") \n end",
"def auth_hash\n @auth_hash ||= request.env['omniauth.auth']\n end",
"def session_setup(input={}, raw=false)\n # options = Eviapi::Configuration::SETUP_SESSION_PARAMS.to_json\n options = Eviapi::Configuration::SETUP_SESSION_PARAMS\n\n # Override if nothing is passed to it\n if input.empty?\n input = {\n :Version => options[:Version],\n :JSONData => options[:JSONData].to_json\n } \n end\n\n response = post(\"mw/Session.Setup\", input, raw)\n end",
"def setup_session\n @session_id ||= if @smug_user.email\n setup_session_with_username\n else \n setup_session_anonymously\n end\n end",
"def setup\n TestUtils.set_workday_default\n TestUtils.enable_module_on_project 1\n @request.session[:user_id] = 1\n end",
"def setup_options_for_url(options, request_url)\n options['head'] ||= {}\n options['url_fetched'] = request_url\n end",
"def omniauth_params\n request.env['omniauth.auth'].to_hash\n end",
"def omniauth_params\n request.env['omniauth.auth'].to_hash\n end",
"def test_init\n logout\n \n post :init, :provider => 'twitter', :identity_twitter => { :follow_bountyhermes => true, :commercial => true, :email => \"[email protected]\", :accept_terms => 1 }\n assert_response :redirect\n assert_redirected_to \"/auth/twitter\"\n assert assigns(:identity)\n assert @request.session[:identity_params].present?\n assert @request.session[:identity_params][:commercial]\n assert_equal \"[email protected]\", @request.session[:identity_params][:email]\n assert @request.session[:identity_params][:follow_bountyhermes]\n end",
"def initialize_auth\n @conf[:use_user_pool_cache] = false\n end",
"def prepare\n # by default, do not push data (content entries and editable elements)\n self.parameters[:data] ||= false\n\n credentials = self.parameters.select { |k, _| %w(uri email password api_key).include?(k.to_s) }\n self.uri = credentials[:uri]\n\n begin\n Locomotive::Mounter::EngineApi.set_token(credentials)\n rescue Exception => e\n raise Locomotive::Mounter::WriterException.new(\"unable to get an API token: #{e.message}\")\n end\n end",
"def fetch_facebook_params\n\n @fb_details = request.env['omniauth.auth']\n redirect_to main_app.root_path if @fb_details.nil?\n\n session[:email] = @fb_details[:info][:email]\n session[:firstname] = @fb_details[:info][:first_name]\n session[:lastname] = @fb_details[:info][:last_name]\n session[:fb_token] = @fb_details[:credentials][:token]\n\n end",
"def set_sentry_params\n return unless ENV['SENTRY_DSN'].present?\n\n Raven.user_context(id: current_user.email) if user_signed_in?\n Raven.extra_context(params: params.to_unsafe_h, url: request.url)\n end",
"def authorize\n params[:access_token] ||= params[:oauth_token]\n super\n end",
"def prepare_basic_auth(request)\n user = @options[:user] || nil\n pass = @options[:pass] || nil\n\n request.basic_auth user, pass\n request\n end",
"def setup\n TestUtils.set_workday_default\n TestUtils.enable_module_on_project 1\n @request.session[:user_id] = 1\n @rc_cfg = Red_Counter::Config.new\n end",
"def set_course\n #ENV Variables not working\n # conf = LearningStudioAuthentication::Config::OAuthConfig.new({\n # :application_id => 'c5b8742f-c459-4fc2-91a1-7ee542acb214',\n # :application_name => 'Lightpath',\n # :client_string => 'gbtestc',\n # :consumer_key => '4d2b474e-7b70-4b7e-aff5-7313567c2c38',\n # :consumer_secret => 'DmyLEZn8ts7MuOUm'\n # })\n # oauth_factory = LearningStudioAuthentication::Service::OAuthServiceFactory.new(conf)\n # service = LearningStudioCore::BasicService.new(oauth_factory)\n # service.use_oauth2('[email protected]','msuTooEg')\n # service.data_format = LearningStudioCore::BasicService::DataFormat::JSON\n # @courses = service.request(\"GET\",\"/me/courses?expand=course\")\n # @course_title = JSON.parse(@courses.content)[\"courses\"].first.first.last.first[\"course\"][\"displayCourseCode\"]\n @course = Course.find(1)\n end",
"def prepare_basic_auth(request)\n user = @options[:user] || nil\n pass = @options[:pass] || nil\n\n request.basic_auth user, pass\n request\n end",
"def prepare_headers\n if @session_cookie\n @headers['cookie'] = @session_cookie\n end\n super\n end",
"def set_request_start\n @request_started_at = Time.now\n @used_auth_by_token = true\n end",
"def authentication_hash=(_arg0); end",
"def prepare\n super\n\n self.fetch_site\n end",
"def auth_query\n \"?login=fcoury&token=8f700e0d7747826f3e56ee13651414bd\"\n end",
"def authorize_params\n options.authorize_params[:state] = SecureRandom.hex(24) + '|' + Base64.strict_encode64(request.params.to_param)\n params = options.authorize_params.merge(options_for(\"authorize\"))\n if OmniAuth.config.test_mode\n @env ||= {}\n @env[\"rack.session\"] ||= {}\n end\n session[\"omniauth.state\"] = params[:state]\n params\n end",
"def authorize_params\n # Only set state if it hasn't already been set\n options.authorize_params[:state] ||= SecureRandom.hex(24)\n params = options.authorize_params.merge(options_for(\"authorize\"))\n if OmniAuth.config.test_mode\n @env ||= {}\n @env[\"rack.session\"] ||= {}\n end\n params\n end",
"def set_user\n \t#to do\n \t#if cookie authentication_token type facebook\n\n \t#elsif cookie authentication_token type email\n\n \t#end\n \t\t\n \t@user = User.find_by(authentication_token: request.headers['Authorization'])\n end",
"def request_phase\n redirect ebay_login_url(session['omniauth.ebay.session_id'] = get_session_id(options.runame))\n end",
"def init\n redirect_to Maestrano::Saml::Request[params[:tenant]].new(params, session).redirect_url\n end",
"def auth_params\n return {} unless TaxCloud.configuration\n {\n 'apiLoginID' => TaxCloud.configuration.api_login_id,\n 'apiKey' => TaxCloud.configuration.api_key\n }\n end",
"def init\n init_oauth_access_token\n end",
"def setup\n open_session\n end",
"def initialize #hash. Initializes them at nil if not provided\n @http_referers = nil\n @has_cookie = nil\n @session_duration = nil\n end",
"def additional_params\n @additional_params ||= if session_scope?\n if oauth2_session?\n {application_key: application_key}\n else\n {application_key: application_key, session_key: options[:session_key]}\n end\n else\n {application_key: application_key}\n end\n end",
"def authorize_params\n super.tap do |params|\n %w[auth_type display revoke scope state].each do |v|\n next unless request.params[v]\n params[v.to_sym] = request.params[v]\n\n session[\"omniauth.state\"] = params[:state] if v == \"state\"\n # to support omniauth-oauth2’s auto csrf protection\n end\n\n params[:scope] ||= DEFAULT_SCOPE\n end\n end",
"def before_connect(facebook_session)\n self.login = facebook_session.user.name\n self.facebook_name = facebook_session.user.name\n self.password = \"5uttr33_#{self.login}\"\n self.signup_source = 'facebook'\n end",
"def set_session\n \n end",
"def set_from_user_id\n cookies[:from_user] = params[:yaoqingid] if params[:yaoqingid].present?\n end"
] | [
"0.6736953",
"0.66431063",
"0.63550097",
"0.6313256",
"0.6263293",
"0.61272126",
"0.6119854",
"0.6036167",
"0.60351026",
"0.6029177",
"0.60249346",
"0.59695566",
"0.5963112",
"0.5878977",
"0.5873779",
"0.5833347",
"0.5813837",
"0.578987",
"0.578693",
"0.5783089",
"0.5768267",
"0.5763539",
"0.5738192",
"0.5728798",
"0.57138646",
"0.5713805",
"0.56882644",
"0.56875634",
"0.56679267",
"0.56563437",
"0.56334597",
"0.5624324",
"0.5622123",
"0.56187254",
"0.5610749",
"0.56058687",
"0.56049186",
"0.5578208",
"0.55671555",
"0.55525273",
"0.55491173",
"0.5538644",
"0.5534716",
"0.5531872",
"0.5530099",
"0.5520985",
"0.5520702",
"0.55204797",
"0.5514658",
"0.5511136",
"0.5500794",
"0.54987943",
"0.5469947",
"0.5464539",
"0.5459901",
"0.54510874",
"0.5437764",
"0.54204184",
"0.5413918",
"0.5412351",
"0.5404496",
"0.5397931",
"0.538778",
"0.5387667",
"0.53876376",
"0.5383549",
"0.5375857",
"0.53753024",
"0.5369326",
"0.5363821",
"0.5363821",
"0.5341225",
"0.5335787",
"0.5331818",
"0.53066045",
"0.53051686",
"0.5301544",
"0.52945614",
"0.5281587",
"0.5280044",
"0.52783537",
"0.5263045",
"0.5257635",
"0.5256348",
"0.5234447",
"0.5227489",
"0.5224698",
"0.5222772",
"0.52184546",
"0.5212507",
"0.52118933",
"0.5209287",
"0.5208347",
"0.52077395",
"0.51927",
"0.5189114",
"0.5187091",
"0.5184692",
"0.51800114",
"0.51767105"
] | 0.61245316 | 6 |
Riyosha redirects the user to create upon succesful login (since omniauthcas is configured with create as callback_url). | def create
unless can? :login, User
render(:file => 'public/401', :format => :html, :status => :unauthorized) and return
end
# extract authentication data
auth = request.env["omniauth.auth"]
provider = params['provider']
identifier = auth.uid
# try to sync user data from user database
# if sync fails
# - use cached user_data if it exists
# - otherwise fail login
user_data = Riyosha.find(identifier)
if user_data
user = User.create_or_update_with_user_data(provider, user_data)
session[:user_id] = user.id
else
user = User.find_by_provider_and_identifier(provider, identifier)
if user
session[:user_id] = user.id
logger.warn "Could not get user data from Riyosha. Using cached data for user with identifier #{identifier}."
else
logger.error "Could not get user data from Riyosha and could therefore not create new user. Login failed."
redirect_to params[:url] || root_path, :alert => 'Login failed. We apologize for the inconvenience. Please try again later.' and return
end
end
# Make CanCan re-initialize abilities based on new user id
@current_ability = nil
# Save session search history
current_user.searches << searches_from_history
current_user.save
# Set shunting cookies
cookies.permanent[:shunt] = cookies.permanent[:shunt_hint] = user.user_data["authenticator"] unless current_user.walk_in?
# redirect user to the requested url
session_return_url = session.delete(:return_url)
redirect_to params[:url] || session_return_url || root_path, :notice => 'You are now logged in'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_from_omniauth\n auth_hash = request.env[\"omniauth.auth\"]\n authentication = Authentication.find_by_provider_and_uid(auth_hash[\"provider\"], auth_hash[\"uid\"]) || Authentication.create_with_omniauth(auth_hash)\n\n # if: previously already logged in with OAuth\n if authentication.user\n user = authentication.user\n authentication.update_token(auth_hash)\n @next = root_url\n @notice = \"Signed in!\"\n # else: user logs in with OAuth for the first time\n else\n user = User.create_with_auth_and_hash(authentication, auth_hash)\n # you are expected to have a path that leads to a page for editing user details\n @next = edit_user_path(user)\n @notice = \"User created. Please confirm or edit details\"\n end\n\n sign_in(user)\n redirect_to @next, :notice => @notice\n end",
"def create\n omniauth = request.env['omniauth.auth']\n authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])\n if authentication\n flash[:notice] = \"Signed in successfully\"\n sign_in_and_redirect(:user, authentication.user)\n else\n user = User.new\n user.apply_omniauth(omniauth)\n user.login = omniauth['info'] && omniauth['info']['nickname']\n if user.save\n flash[:notice] = \"Successfully registered\"\n sign_in_and_redirect(:user, user)\n else\n session[:omniauth] = omniauth.except('extra')\n session[:omniauth_login] = user.login\n\n # Check if login already taken. If so, ask user to link_accounts\n if user.errors[:login][0] =~ /has already been taken/ # omniauth? TBD\n # fetch the user with this login id!\n user = User.find_by_login(user.login)\n return redirect_to link_accounts_url(user.id)\n end\n redirect_to new_user_registration_url\n end\n end\n end",
"def callback\n # This stores all the user information that came from Auth0\n # and the IdP\n userinfo = request.env['omniauth.auth']\n\n begin\n result = SessionService.process!(userinfo, session)\n\n if result.new_user?\n redirect_to welcome_path\n else\n # Redirect to the URL you want after successful auth\n redirect_to services_path,\n flash: {\n success: I18n.t(:welcome_html, scope: [:auth, :existing_user])\n }\n end\n rescue SignupNotAllowedError\n # no new user or existing user, so they weren't allowed to sign up\n redirect_to signup_not_allowed_path\n end\n end",
"def create\n # Where do we want to redirect to with our new session\n path = cookies.encrypted[:continue] || success_path\n\n # Get auth hash from omniauth\n auth = request.env[OMNIAUTH]\n\n if auth.nil?\n return login_failure({})\n end\n\n # Find an authentication or create an authentication\n auth_model = ::Auth::Authentication.from_omniauth(auth)\n\n # adding a new auth to existing user\n if auth_model.nil? && signed_in?\n logger.info \"User signed in and re-authenticating\"\n\n ::Auth::Authentication.create_with_omniauth(auth, current_user.id)\n redirect_to path\n Auth::Authentication.after_login_block.call(current_user, auth[PROVIDER], auth)\n\n # new auth and new user\n elsif auth_model.nil?\n args = safe_params(auth.info)\n user = ::User.new(args)\n\n # Use last name and first name by preference\n fn = args[:first_name]\n if fn && !fn.empty?\n user.name = \"#{fn} #{args[:last_name]}\"\n end\n\n authority = current_authority\n\n existing = ::User.find_by_email(authority.id, user.email)\n user = existing if existing\n user.deleted = false if user.respond_to?(:deleted)\n\n user.authority_id = authority.id\n\n # now the user record is initialised (but not yet saved), give\n # the installation the opportunity to modify the user record or\n # reject the signup outright\n result = Auth::Authentication.before_signup_block.call(user, auth[PROVIDER], auth)\n\n logger.info \"Creating new user: #{result.inspect}\\n#{user.inspect}\"\n \n if result != false && user.save\n # user is created, associate an auth record or raise exception\n Auth::Authentication.create_with_omniauth(auth, user.id)\n\n # make the new user the currently logged in user\n remove_session\n new_session(user)\n\n # redirect the user to the page they were trying to access and\n # run any custom post-login actions\n redirect_to path\n Auth::Authentication.after_login_block.call(user, auth[PROVIDER], auth)\n else\n logger.info \"User save failed: #{user.errors.messages}\"\n\n # user save failed (db or validation error) or the before\n # signup block returned false. redirect back to a signup\n # page, where /signup is a required client side path.\n store_social(auth[UID], auth[PROVIDER])\n redirect_to '/signup/index.html?' + auth_params_string(auth.info)\n end\n\n # existing auth and existing user\n else\n begin\n # Log-in the user currently authenticating\n remove_session if signed_in?\n user = User.find_by_id(auth_model.user_id)\n new_session(user)\n redirect_to path\n Auth::Authentication.after_login_block.call(user, auth[PROVIDER], auth)\n rescue => e\n logger.error \"Error with user account. Possibly due to a database failure:\\nAuth model: #{auth_model.inspect}\\n#{e.inspect}\"\n raise e\n end\n end\n end",
"def new_with_redirect;\n\t\t@user=User.new;\n\t\treturn redirect_to auth_path(:facebook) if params[:with]==\"facebook\"\n\t\treturn redirect_to auth_path(:linkedin) if params[:with]==\"linkedin\"\n\t\tif !auth_hash.blank?\n\t\t\tif @user.facebook_info(auth_hash)=='mail missing'\n\t\t\t\tflash[:error]='Sign up failed, we need your email to sign you up'\n\t\t\t\tredirect_to root_path\n\t\t\tend\n\t\tend\n\tend",
"def create \n # render :text => request.env[\"omniauth.auth\"].to_yaml\n omniauth = request.env[\"omniauth.auth\"]\n authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])\n if authentication\n flash[:notice] = \"Signed in successfully.\"\n sign_in_and_redirect(:user, authentication.user)\n elsif current_user # if user logged in but doesn't have this auth in DB\n current_user.authentications.create!(:provider => omniauth['provider'], :uid => omniauth['uid'])\n flash[:notice] = \"Authentication successful.\"\n redirect_to authentications_url\n else # if user doesn't exist\n user = User.new\n user.apply_omniauth(omniauth)\n if user.save #if validation passes\n flash[:notice] = \"Signed in successfully.\"\n sign_in_and_redirect(:user, user)\n else #if validation doesn't pass\n session[:omniauth] = omniauth.except('extra')\n redirect_to new_user_registration_url\n end\n end \n end",
"def create\n @user = User.new(params[:user])\n if logged_in? && current_user.can?(:manage_users) && params[:user][:role_id]\n @user.role_id = params[:user][:role_id]\n else\n # the first user is created as an admin...\n @user.role = Role.find_by_name(User.count == 0 ? 'admin' : 'user')\n end\n \n session[:rauth_after_login] = \"/\"\n respond_to do |format|\n if Rauth::Bridge.create_account(@user, :user_name => @user.user_name, :password => params[:password], :confirmation => params[:password_confirm])\n add_default_contexts(@user)\n add_default_account(@user)\n flash[:notice] = l('Your profile was created.')\n self.current_user = @user if !logged_in?\n format.html { redirect_to(home_url) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(params[:user])\n @user.save do |result|\n if result\n flash[:notice] = \"Login successful!\"\n #redirect_back_or_default users_url\n else\n flash[:error] = @user.errors.full_messages\n debugger\n unless @user.oauth_token.nil?\n @user = User.find_by_oauth_token(@user.oauth_token)\n unless @user.nil?\n UserSession.create(@user)\n #InitializeUserSession(@user)\n session[:atoken] = @user.oauth_token\n session[:asecret] = @user.oauth_secret\n flash[:notice] = \"Welcome back!\"\n redirect_to users_url \n else\n #flash[:error] = @user.errors.full_messages\n redirect_to users_url \n end\n end\n #end\n # render :action => :new\n end\n end\n #redirect_to users_url \n #return\n end",
"def create\n auth = request.env[\"omniauth.auth\"]\n user = User.from_omniauth(auth)\n session[:user_id] = user.id\n if params.permit[:remember_me]\n cookies.permanent[:auth_token] = user.auth_token\n else\n cookies[:auth_token] = user.auth_token\n end\n # refresh_to root_path, :ma_notice => \"Logged in\" # Called by jinda_conroller\n redirect_to root_path\n\t\t# redirect_to articles_my_path\n\n rescue\n redirect_to root_path, :alert=> \"Authentication failed, please try again.\"\n end",
"def create\n\n\t\t# grab the authentication return\n\t\tauth = request.env[\"omniauth.auth\"]\n\n\t\t# now create a temporary user with the auth element etc\n\t\tuser = User.omniauth_create auth\n\n\t\t# now set the session_id \n\t\tsession[:id] = user.id\n\n\t\t# redirect back to the root which can successfully switch the pages of the application etc\n\t\tredirect_to root_url, :notice => \"Successful Authentication\"\t\n\tend",
"def create\n omniauth = request.env['omniauth.auth']\n # Check whether the Identity exists\n identity = Identity.from_omniauth(omniauth)\n if identity # If it does, sign the user in\n flash[:notice] = 'Welcome back!'\n sign_in_and_redirect(:user, identity.user)\n else\n handle_new_identity(omniauth)\n end\n end",
"def new\n unless can? :login, User\n render(:file => 'public/401', :format => :html, :status => :unauthorized) and return\n end\n\n case\n when params[:only_dtu]\n logger.info \"Overriding shunt cookie with value from params. Using DTU CAS\"\n session[:only_dtu] = true\n when params[:public]\n logger.info \"Overriding shunt cookie with value from params. Using local user\"\n session[:public] = true\n when cookies[:shunt] == 'dtu'\n logger.info \"Shunt cookie set to 'dtu'. Shunting directly to DTU CAS\"\n session[:only_dtu] = true\n when cookies[:shunt_hint] == 'dtu'\n logger.info \"Shunt hint cookie set to 'dtu'. Shunting with hint to DTU CAS\"\n session[:prefer_dtu] = true\n when current_user.campus? && !current_user.walk_in?\n logger.info \"Campus request. Shunting with hint to DTU CAS\"\n session[:prefer_dtu] = true\n end\n\n # store given return url in session also, since omniauth-cas in\n # test mode does not pass url parameter back to sessions_controller#create\n url = session[:return_url] = params[:url] || '/'\n\n redirect_to \"#{omniauth_path(:cas)}?#{{ :url => url }.to_query }\"\n end",
"def create \n omniauth = request.env[\"omniauth.auth\"]\n \n authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])\n if authentication\n #directly sign in existing user with existing authentication\n flash[:notice] = \"signed in successfully\"\n sign_in_and_redirect(:user, authentication.user)\n elsif current_user\n #create a new authentication for currently signed in user\n current_user.authentications.create(:provider => omniauth['provider'], :uid => omniauth['uid']) \n flash[:notice] = \"Authentication successful.\" \n redirect_to authentications_url\n else\n # user does not have an account or is authenticated through a provider\n user = User.new\n user.apply_omniauth(omniauth) \n if user.save\n flash[:notice] = \"Signed in successfully.\" \n sign_in_and_redirect(:user, user) \n else\n session[:omniauth] = omniauth.except('extra') \n redirect_to new_user_registration_url\n end \n end\n end",
"def facebook_create\n @new_user = User.find_or_create_by(uid: auth['uid']) do |u|\n u.name = auth['info']['name']\n u.email = auth['info']['email']\n u.image = auth['info']['image']\n u.password = User.generic_password\n end\n @new_user.save\n session[:user_id] = @new_user.id \n redirect_to home_path(@new_user)\n end",
"def redirect_callbacks\n setup_env_params\n\n session['dta.omniauth.auth'] = request.env['omniauth.auth']\n .except('extra')\n session['dta.omniauth.params'] = omniauth_params\n tweak_session_attrs\n has_params = session['dta.omniauth.params']\n\n redirect_to action: has_params ? 'omniauth_success' : 'omniauth_failure'\n end",
"def create\n omniauth = request.env[\"omniauth.auth\"]\n\n authentication = Authentication.find_by_provider_and_uid(\n omniauth['provider'],\n omniauth['uid']\n )\n\n if authentication\n\n sign_in_and_redirect(:user, authentication.user)\n\n elsif current_user\n current_user.authentications.create(:provider => omniauth['provider'],\n :uid => omniauth['uid'])\n flash[:notice] = \"Authentication with #{omniauth['provider']} was successful.\"\n redirect_to authentications_url\n else\n # New user\n user = User.new\n\n user.apply_omniauth(omniauth)\n if user.save\n check_event_entry user.authentications[0]\n sign_in_and_redirect(:user, user)\n else\n session[:omniauth] = omniauth.except('extra')\n redirect_to new_user_registration_url\n end\n end\n end",
"def create\n\t\t@user = User.find_or_create_from_auth_hash(request.env[\"omniauth.auth\"])\n\t\tredirect_to(@@extension_url + '?access_token=' + @user.oauth_token)\n\tend",
"def create\n @user = User.where_omniauth(auth_hash)\n sign_in @user\n redirect_to root_url, alert: \"You have been signed in successfully.\"\n end",
"def amniauth_create\n user = User.find_or_create_by(:provider => auth_hash[:provider], :uid => auth_hash[:uid]) do |user|\n user.name = auth_hash[:info][:name]\n end\n\n session[:user_id] = user.id\n redirect_to user_path(user)\n end",
"def create\n @user = User.new(user_params)\n @user.netid = session[:cas_user]\n @user.objectm = {}\n\n respond_to do |format|\n if @user.save\n #UserMailer.welcome_email(@user).deliver\n format.html { redirect_to \"/auth/facebook\" }\n format.json { render action: 'show', status: :created, location: @user }\n else\n format.html { render action: 'new' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n auth = request.env[\"omniauth.auth\"]\n user_info = auth[\"info\"] ? auth[\"info\"] : auth[\"user_info\"]\n authentication = Authorization.where(:provider => auth['provider'], :uid => auth['uid']).first\n authentication = Authorization.new(:provider => auth['provider'], :uid => auth['uid']) if !authentication\n session[:fb_token] = auth['credentials']['token'] if auth['credentials']['token'] != nil\n # if the user exists, but does not have a link with the social service\n if !authentication.user && current_user\n authentication.user = current_user\n authentication.save\n end\n # twitter only (gets no email)\n if !authentication.user && !user_info[\"email\"]\n flash[:notice] = \"No user linked to this account. Please sign in or create a new account\"\n redirect_to '/users/sign_up/'\n # if user doesnt exists, register user\n elsif !authentication.user\n user = User.where(email: user_info['email']).first\n if user\n authentication.user = user\n else\n new_user = User.new(email: user_info['email'], username: user_info['name'], first_name: user_info['first_name'], last_name: user_info['last_name'], role: \"registered\")\n new_user.save\n authentication.user = new_user\n end\n authentication.save\n end\n # if user exists, sign in. Gives a Mongoid glitch of not signing in after registration. So double sign in\n if authentication.user\n if !current_user\n sign_in authentication.user\n sign_out authentication.user\n sign_in authentication.user\n # raise \"user signed in? #{user_signed_in?.to_s}\".inspect\n flash[:notice] = \"Authorization successful.\"\n redirect_to root_path\n else\n flash[:notice] = \"Linked successfully.\"\n redirect_to '/users/'+current_user.id\n end\n end\n end",
"def create_user\n \tunless @user\n \t\tflash[:notice_login] = \"Incorrect password or username.\"\n \t return render action: 'new_user'\n \tend\n \tsession[:comedian_id] = nil\n \tsession[:user_id] = @user.id\n\n \tflash[:notice_login] = 'Signed in!'\n \tredirect_to root_path\n end",
"def new\n redirect_to user_saml_omniauth_authorize_path\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 createF\r\n user = User.omniauth(env['omniauth.auth'])\r\n session[:user_id] = user.id\r\n Action.create(info: current_user.username + ' has logged in using facebook.', user_email: current_user.email)\r\n redirect_to user\r\n end",
"def require_signed_up\n return true if session[:cas_user].present? and User.exists?(:login => session[:cas_user])\n\n redirect_to :controller => :users, :action => :new\n return false\n end",
"def require_signed_up\n return true if session[:cas_user].present? and User.exists?(:login => session[:cas_user])\n\n redirect_to :controller => :users, :action => :new\n return false\n end",
"def create\n omniauth = request.env['omniauth.auth']\n authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])\n if authentication\n flash[:notice] = \"Signed in successfully\"\n sign_in_and_redirect(:user, authentication.user)\n else\n user = User.new\n user.apply_omniauth(omniauth)\n user.email = omniauth['extra'] && omniauth['extra']['user_hash'] && omniauth['extra']['user_hash']['email']\n if user.save\n flash[:notice] = \"Successfully registered\"\n sign_in_and_redirect(:user, user)\n else\n session[:omniauth] = omniauth.except('extra')\n session[:omniauth_email] = omniauth['extra'] && omniauth['extra']['user_hash'] && omniauth['extra']['user_hash']['email']\n\n # Check if email already taken. If so, ask user to link_accounts\n if user.errors[:email][0] =~ /has already been taken/ # omniauth? TBD\n # fetch the user with this email id!\n user = User.find_by_email(user.email)\n return redirect_to link_accounts_url(user.id)\n end\n redirect_to new_user_registration_url\n end\n end\n end",
"def create\n user = User.from_omniauth(env[\"omniauth.auth\"])\n session[:user_id] = user.id\n redirect_to '/mindapp/pending'\n rescue\n redirect_to root_path, :alert=> \"Authentication failed, please try again.\"\n end",
"def facebook\n @user = User.find_or_create_for_facebook(request.env[\"omniauth.auth\"], current_user)\n flash[:alert] = \"Signed in with Facebook successfully.\"\n # use devise-provided method to redirect the user\n if @user.sign_in_count == 0\n sign_in @user, :event => :authentication\n redirect_to users_get_path\n else\n sign_in_and_redirect @user, :event => :authentication\n end\n end",
"def create\n @errors = validate(params[:user])\n if @errors.size < 1\n logged_in_user = LinkedData::Client::Models::User.authenticate(params[:user][:username], params[:user][:password])\n if logged_in_user && !logged_in_user.errors\n login(logged_in_user)\n redirect = \"/\"\n\n if session[:redirect]\n redirect = CGI.unescape(session[:redirect])\n end\n\n\n redirect_to redirect\n else\n @errors << \"Invalid account name/password combination\"\n render :action => 'index'\n end\n else\n render :action => 'index'\n end\n end",
"def new\n auth_hash = request.env['omniauth.auth']\n session[:auth_provider] = auth_hash[:provider]\n\n # look up auth_field, auth_value of User by provider, from config/initializers/omniauth.rb\n # Currently CAS is our only provider\n auth_config = ResearchMatch::Application.config.auth_providers[session[:auth_provider].to_sym]\n if auth_config\n auth_field = auth_config[:auth_field].to_s\n auth_value = auth_hash[auth_config[:auth_value]].to_s\n session[:auth_field] = auth_field\n session[:auth_value] = auth_value\n else\n flash[:error] = \"There were problems identifying your auth provider. Please try again or contact support.\"\n redirect_to home_path\n return\n end\n\n\n user = User.where(auth_field => auth_value).first\n if user.present?\n UserSession.new(user).save\n session[:user_id] = user.id # TODO remove (use only @user_session)\n redirect_to dashboard_path\n else\n if session[:auth_provider].to_sym == :google_oauth2\n session[:info_hash] = auth_hash[:info]\n end\n puts 'redirect_to new_user_path'\n redirect_to new_user_path\n end\n end",
"def create\n @user = User.new(params[:user])\n if @user.save\n reset_session\n auto_login(@user) \n redirect_to user_path(@user), notice: \"Your Account has been created.\"\n else\n render action: \"new\" \n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n redirect_to \"/login\"\n end\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 :show, status: :created, location: @user }\n # render template: 'users/login'\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.find_or_create_with_omniauth auth_hash\n session[:user_id] = @user.id\n redirect_to auth_path\n end",
"def create\n @user = User.new(user_params) # Not the final implementation!\n if @user.save\n # Handle a successful save.\n log_in @user\n flash[:success] = \"Welcome to the Sample App!\"\n redirect_to @user #the same as redirect_to user_url(@user)\n # note: here i can redirect to home_page and change the home page according to the user\n # something like: if @user then display the organisations. It might be easier to keep\n # a list of organisations at the home page so we can update the user organisation\n else\n render 'new'\n end\n end",
"def new\n redirect_to('/auth/cas')\n end",
"def create_with_api\n begin \n @num_users = User.all.size\n user = User.from_omniauth(request.env[\"omniauth.auth\"])\n log_in user\n if @num_users == (User.all.size - 1)\n redirect_to edit_user_path(user)\n flash[:success] = \"Log in successful! Please set a password and update \n any additional information.\"\n else \n redirect_back_or edit_user_path(user)\n end\n rescue\n flash[:warning] = \"There was an error during the authentication \n process. \"\n redirect_to root_url\n end\n end",
"def ensure_facebook_connect\n set_facebook_session()\n if facebook_session && facebook_session.user.id\n @user = User.find_or_create_by_facebook_id(facebook_session.user.id)\n else\n redirect_to :controller=>:account, :action=>:login, :next_url=>request.request_uri\n end\n end",
"def create_with_api\n @user = User.find_or_create_from_auth_hash(request.env[\"omniauth.auth\"])\n if @user\n session[:user_id] = @user.id\n redirect_to @user\n else \n flash.now[:danger] = \"Whoops, something went wrong!\"\n render 'new'\n end\n end",
"def create\n\t\tuser = User.from_sso(cookies[:UTEP_SE], cookies[:UTEP_SA])\n\t\tlog_in(user) if user\n\t\tredirect_to root_url\n\tend",
"def omniauth\r\n @user = User.create_by_google_omniauth(auth)\r\n \r\n session[:user_id] = @user.id\r\n redirect_to user_path(@user)\r\n end",
"def create\n omniauth = request.env['omniauth.auth']\n authparams = ActionController::Parameters.new(omniauth.slice 'provider', 'uid').permit('provider', 'uid')\n # Our query parameters appear in env['omniauth.params']\n if origin_url = request.env['omniauth.origin'] # Remove any enclosing quotes\n origin_url.sub! /^\"?([^\"]*)\"?/, '\\\\1'\n end\n # Originator is where we came from, so we can go back there if login fails\n if originator = request.env['omniauth.params']['originator'] # Remove any enclosing quotes\n originator.sub! /^\"?([^\"]*)\"?/, '\\\\1'\n end\n # Check for existing authorization\n @authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])\n (info = omniauth['info']) && (email = info['email']) && (user = User.find_by_email(email))\n intention = request.env['omniauth.params']['intention'] # If intention is 'signup', don't accept existing authentications\n if intention == \"signup\"\n if @authentication || user # This authentication method already in use\n flash[:notice] = \"That #{omniauth.provider.capitalize} login is already in use on RecipePower.<br>Perhaps you just need to sign in?\"\n response_service.amend originator\n url_to = originator\n else # No user and no authentication: perfect\n # Just create the account, getting what we can get out of the authorization info\n (user = User.new).apply_omniauth(omniauth)\n response_service.amend originator\n if user.save\n @authentication = user.authentications.create!(authparams) # Link authorization to user\n sign_in user, :event => :authentication\n response_service.user = user\n SignupEvent.post user # RpMailer.welcome_email(user).deliver\n flash[:notice] =\n %Q{Welcome to RecipePower, #{user.polite_name}! Introductory email is on its way. }\n url_to = after_sign_in_path_for(user)\n else\n # If user can't be saved, go back to edit params\n url_to = response_service.decorate_path(new_user_registration_url)\n end\n end\n # Intention is not signing up\n elsif current_user\n if @authentication # Authentication already in use\n if @authentication.user == current_user\n flash[:notice] = \"You're already connected through #{@authentication.provider_name}!\"\n else\n flash[:notice] = \"Sorry, your current #{@authentication.provider_name} login is tied to another RecipePower user.\"\n end\n else\n # Add the authentication method to the current user. We return to the authentications dialog\n current_user.apply_omniauth(omniauth)\n @authentication = current_user.authentications.create!(authparams) # Link to existing user\n flash[:notice] = \"Yay! You're now connected to RecipePower through #{@authentication.provider_name}.\"\n end\n url_to = origin_url\n elsif @authentication\n flash[:notice] = \"Yay! Signed in with #{@authentication.provider_name}. Welcome back, #{@authentication.user.handle}!\"\n sign_in @authentication.user, :event => :authentication\n response_service.amend originator\n url_to = after_sign_in_path_for(@authentication.user)\n # This is a new authentication (not previously linked to a user) and there is\n # no current user to link it to. It's possible that the authentication will come with\n # an email address which we can use to log the user in.\n elsif user\n user.apply_omniauth(omniauth)\n @authentication = user.authentications.create!(authparams) # Link to existing user\n sign_in user, :event => :authentication\n flash[:notice] = \"Yay! Signed in with #{@authentication.provider_name}. Nice to see you again, #{user.handle}!\"\n response_service.amend originator\n url_to = after_sign_in_path_for(user)\n end\n # We haven't managed to get the user signed in by other means, but we still have an authorization\n if !(current_user || user) # Failed login not because of failed invitation\n # The email didn't come in the authorization, so we now need to\n # discriminate between an existing user(and have them log in)\n # and a new user (and have them sign up). Time to throw the problem\n # over to the user controller, providing it with the authorization.\n session[:omniauth] = omniauth.except('extra')\n flash[:notice] = \"Hmm, apparently that service isn't linked to your account. If you log in by other means (perhaps you need to create an account?), you can link that service in Sign-In Services\"\n url_to = originator || new_user_session_path\n end\n # response_service.amend origin_url # Amend response expectations according to the originating URL\n render 'callback', :layout => false, :locals => { url_to: url_to }\n end",
"def create\n \n \n user = User.from_omniauth(env[\"omniauth.auth\"])\n session[:user_id] = user.id\n \n redirect_to root_path\n \n #render :text => auth_hash.inspect\n #raise request.env[\"omniauth.auth\"].to_yaml\n \n #Original\n # user=Authorization.find_by_provider_and_uid(auth[\"provider\"],auth[\"uid\"]) || Authorization.create_with_omniauth(auth)\n # #session[:user_id] = user.id\n #redirect_to root_path\n \n end",
"def azureactivedirectory\n auth = request.env[\"omniauth.auth\"]\n user = User.create_with_omniauth(auth)\n if user.present?\n session[:user_id] = user.id\n sign_in user\n redirect_to root_path, notice: 'User created with outlook'\n else\n redirect_to new_user_registration_path, notice: 'Invalid email or password'\n end\n end",
"def oauth_signup\n @user = User.new(\n nickname: params[:nickname],\n sex: params[:sex],\n phone: params[:phone],\n birthday: params[:birthday],\n province: params[:province],\n city: params[:city],\n area: params[:area] )\n @user.created_by_oauth = 'mobile'\n @user.authentications.build(\n uid: params[:oauth_uid],\n provider: params[:provider],\n access_token: params[:access_token])\n if @user.save\n @user.confirm!\n render :login\n else\n render json: {\n success: false,\n message: @user.errors.messages\n }\n end\n end",
"def facebook_callback\n user_data = parse_facebook_user_data\n token = sign_user_token(user_data[\"email\"],\"facebook\")\n\n user = User.find_by_token(token)\n if user\n set_current_user(user)\n else\n user = User.new(:email => user_data[\"email\"],\n :nick => user_data[\"first_name\"],\n :token => token)\n user.save!\n\n set_current_user(user)\n end\n redirect_to :controller => \"sales_management\",\n :action => \"index\",\n :user_id => user.id\n end",
"def create\n @user = User.new(user_params)\n\n if @user.create_first\n flash[:message] = t('welcome', scope: 'refinery.authentication.devise.users.create', who: @user)\n sign_in(@user)\n redirect_back_or_default(Refinery::Core.backend_path)\n else\n render :new\n end\n end",
"def create\n @user = User.find_or_create_from_auth_hash(auth_hash)\n # self.current_user = @user\n session[:user] = @user.id\n redirect_to '/'\n end",
"def create\n\t\tredirect_to '/users/sign_in', alert: 'Access denied.'\n\tend",
"def create\n self.current_user = User.from_omniauth(request.env['omniauth.auth'])\n\n if current_user\n redirect_to auctions_path\n else\n redirect_to auth_path(provider: authentication_data['provider'])\n end\n end",
"def create\n user = User.authenticate(params[:email], params[:password])\n if user\n session[:user_id] = user.id\n render :json => { :success=>'ok', :email=>user.email, :user_id => user.id}, :callback => params['callback'], :status=>200\n else\n render :json=> {:success=>false, :message=>\"Error with your login or password\"}, :callback => params['callback'], :status=>401\n\n end\n end",
"def create\n @user = user_from_params\n if @user.save\n sign_in @user\n redirect_back_or url_after_create\n else\n render template: \"users/new\"\n end\n end",
"def create\n @user = User.new(params[:user])\n \n respond_to do |format|\n if @user.valid?\n if @user.has_login?\n @user.register! # will save\n else\n @user.register_openid! # will save\n end\n flash[:notice] = \"Account registered!\"\n format.html do \n flash[:notice] = \"Thanks for signing up!\"\n logger.info \"signed up with #{@user.has_login? ? 'login' : 'OpenID'}\"\n logger.info \"stored url = #{session[:return_to]}\"\n if @user.has_login?\n flash[:notice] << \" We're sending you an email with your activation code.\"\n logger.info \"back or default_url...\"\n redirect_to default_url\n else\n flash[:notice] << \" You can now login with your OpenID.\"\n logger.info \"back or account_url...\"\n redirect_back_or_default account_url\n end\n end\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html do\n flash[:error] = \"Sorry, there was an error creating your account.\"\n render :action => \"new\"\n end\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def verify_existing_login\n return if cookies[GlobalConstant::Cookie.user_cookie_name.to_sym].blank?\n\n @response = CompanyApi::Request::Client.new(\n CompanyApi::Response::Formatter::Client,\n request.cookies,\n {\"User-Agent\" => http_user_agent}\n ).fetch_verify_cookie_details\n\n # success means user is already logged in, we would redirect to dashboard / planner\n # Error means user ain't logged in yet.\n return unless @response.success?\n\n @presenter_obj = ::WebPresenter::UserPresenter.new(@response, params)\n\n if @presenter_obj.client_token.step_three_done?\n redirect_to :dashboard, status: GlobalConstant::ErrorCode.temporary_redirect and return\n else\n redirect_to :planner, status: GlobalConstant::ErrorCode.temporary_redirect and return\n end\n\n end",
"def omniauth\n if params[:provider] == 'github'\n @user = User.find_or_create_by_github_omniauth(auth)\n else \n @user = User.find_or_create_by_google_omniauth(auth)\n end\n\n session[:user_id] = @user.id\n redirect_to user_path(@user)\n end",
"def create\n user = User.from_omniauth(request.env['omniauth.auth'])\n if params[:remember_me]\n cookies[:auth_token] = { value: user.auth_token,\n expires: 1.weeks.from_now.utc }\n else\n # browser doesn't delete session cookies if session restore used\n cookies[:auth_token] = { value: user.auth_token,\n expires: 30.minutes.from_now.utc }\n end\n redirect_to user_path(user), notice: \"Welcome #{user.nickname}\"\n end",
"def auth_user\n redirect_to new_user_registration_url unless user_signed_in?\n end",
"def create\n auth = request.env[\"omniauth.auth\"]\n user = StudentUser.find_by_provider_and_uid(auth[\"provider\"],auth[\"uid\"]) || StudentUser.create_with_omniauth(auth)\n session[:user_id] = user.id\n redirect_to search_path #where go to when logged in\n end",
"def create\n if user = User.Authenticate(params[:login][:email], params[:login][:password])\n # Save the user ID in the session so it can be used in\n # subsequent requests\n session[:current_user_id] = user.id\n redirect_to root_url\n else\n \tflash[:error] = \"Email ou senha incorreto.\"\n \trender :index\n end\n end",
"def create\n if logged_in?\n # User who has logged in has no need to access create action\n redirect_to current_user\n else \n # Ready to create new user\n @user = User.new(params[:user])\n if @user.save\n # Handle a successful save.\n log_in @user\n flash[:success] = \"Welcome to the Sample App!\"\n redirect_to @user\n else\n \t# Render signup page\n render 'new'\n end\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n flash[:success] = \"welcome to croakr!\"\n log_in @user\n redirect_to @user\n else\n render 'new'\n end\n end",
"def create\n validate_user\n\n # Check if any errors were recorded. If not, send a success response.\n if @errors.empty?\n render(success_response(\n message: \"User Signed In Successfully\", \n session: session_hash(@user)\n )) and return\n else # If there are any errors, send back a failure response.\n render(fail_response(errors: @errors, status: @fail_status))\n end\n \n end",
"def create\n @user = User.new(params[:user]) \n \n if (@user.save)\n @display_message = flash[:success] = 'Your account has been successfully created. You may now login.'\n redirect_to :controller => 'sessions', :action => 'new'\n else\n render 'new'\n end\n \n end",
"def create\n @user = User.new(params[:user])\n if @user.save\n sign_in @user\n flash[:success] = \"Welcome to Startups2Students.com!\"\n #This might kill shit, we want them to go to root\n redirect_to @user\n else\n render 'new'\n end\n end",
"def newaccount\n if params[:commit] == \"Cancel\"\n session[:authhash] = nil\n session.delete :authhash\n redirect_to root_url\n else # create account\n @newuser = User.new\n @newuser.name = session[:authhash][:name]\n @newuser.email = session[:authhash][:email]\n @newuser.services.build(:provider => session[:authhash][:provider], :uid => session[:authhash][:uid], :uname => session[:authhash][:name], :uemail => session[:authhash][:email])\n \n if @newuser.save!\n # signin existing user\n # in the session his user id and the service id used for signing in is stored\n session[:user_id] = @newuser.id\n session[:service_id] = @newuser.services.first.id\n \n flash[:notice] = 'Your account has been created and you have been signed in!'\n\tif session[:authhash][:provider] == 'facebook'\n\t\tredirect_to services_facebook_redirect_path\n\telse\n \tredirect_to services_path\n\tend\n else\n flash[:error] = 'This is embarrassing! There was an error while creating your account from which we were not able to recover.'\n redirect_to root_url\n end \n end\n end",
"def create\n @omniauth = request.env[\"omniauth.auth\"]\n \n authentication = Authentications.find_by_provider_and_uid(@omniauth['provider'], @omniauth['uid'])\n\n if(@@logingIn ==0) \n registering(authentication)\n elsif(@@logingIn ==1)\n signingIn(authentication)\n end\n\nend",
"def create\n user = User.from_omniauth(env[\"omniauth.auth\"])\n session[:user_id] = user.id\n \n redirect_to root_path\n end",
"def create_google\n @user = GetOauthUser.new(:service_hash => omniauth_hash).call\n\n if @user\n establish_session @user\n redirect_to return_location\n else\n redirect_to sign_in_url, :notice => \"Error signing in\"\n end\n end",
"def create\n counter_fixation # Counter session fixation (but save forwarding url)\n if Rails.application.config.deny_login\n flash.now[:danger] = t('sessions.login_disabled')\n render 'new', status: :forbidden\n elsif request.env['omniauth.auth'].present?\n omniauth_login\n elsif params[:session][:provider] == 'local'\n local_login\n else\n flash.now[:danger] = t('sessions.incorrect_login_info')\n render 'new'\n end\n end",
"def sign_up(resource_name, resource)\n redirect_to users_url\n end",
"def create\n if user = User.authenticate_with_credentials(params_for_login)\n # a session cookie is assigned to logged users\n session[:user_id] = user.id\n redirect_to session[:return_to]\n else\n redirect_to session[:return_to], flash: { error: \"Invalid email address\" }\n end\n end",
"def create\n if auth_hash = request.env[\"omniauth.auth\"]\n @user = User.find_or_create_by_omniauth(auth_hash)\n set_session_and_redirect\n else\n @user = User.find_by(username: params[:username])\n if @user && @user.authenticate(params[:password])\n set_session_and_redirect\n else\n redirect_to login_path #Does not allow for field w/errors and does not keep data.\n #not rendering log in for extra security. User needs to reenter information.\n\n flash[:message] = \"There was an error with your request. Please try again.\"\n end\n end\n end",
"def create\n @user = User.new(params[:user])\n if @user.save\n flash[:success] = 'you have successfully created your account, please login in !'\n redirect_to root_path\n else\n render 'new'\n end\n end",
"def create\n cookies.delete :auth_token\n @user = User.new(params[:user])\n @user.save\n if @user.errors.empty?\n self.current_user = @user\n flash[:notice] = \"Thanks for signing up!\"\n redirect_back_or_default root_path\n else\n flash[:error] = \"There was an error during signup\"\n render :action => 'new', :layout => 'login'\n end\n end",
"def create_omniauth\n org_uid = params[:state]\n organization = Maestrano::Connector::Rails::Organization.find_by_uid_and_tenant(org_uid, current_user.tenant)\n\n if organization && is_admin?(current_user, organization)\n organization.from_omniauth(env[\"omniauth.auth\"])\n\n # Fetch SalesForce user details\n user_details = Maestrano::Connector::Rails::External.fetch_user(organization)\n current_user.update_attribute(:locale, user_details['locale'])\n current_user.update_attribute(:timezone, user_details['timezone'])\n\n # Fetch SalesForce company name\n company = Maestrano::Connector::Rails::External.fetch_company(organization)\n organization.update_attribute(:oauth_name, company['Name'])\n organization.update_attribute(:oauth_uid, company['Id'])\n end\n\n redirect_to root_url\n end",
"def create\n\t\t@user = User.create(user_params)\n\t\tlogin(@user)\n\t\tredirect_to root_path\n\tend",
"def create_from_oauth\n if stored_anonymous_user?\n user, from_registration = update_from_omniauth(env[\"omniauth.auth\"], params[:provider])\n else\n user, from_registration = create_from_omniauth(env[\"omniauth.auth\"], params[:provider])\n end\n\n if user.errors.any?\n redirect_to_registration_page(user)\n else\n change_global_user_id(user.id)\n sign_in(user)\n fandom_play_login(user)\n \n if from_registration\n log_data = { 'form_data' => env[\"omniauth.auth\"], 'user_id' => current_user.id }\n log_synced(\"registration from oauth\", adjust_user_and_log_data_with_utm(user, log_data))\n\n set_account_up()\n cookies[:from_registration] = true \n end\n\n if $site.force_facebook_tab && !request_is_from_mobile_device?(request)\n redirect_to request.site.force_facebook_tab\n else\n redirect_after_oauth_successful_login()\n end\n end\n end",
"def create\n\t # get the authentication parameter from the Rails router\n\t params[:provider] ? authentication_route = params[:provider] : authentication_route = 'No authentication recognized (invalid callback)'\n\n\t # get the full hash from omniauth\n\t omniauth = request.env['omniauth.auth']\n\t \n\t # continue only if hash and parameter exist\n\t if omniauth and params[:provider] == 'identity'\n\t # in the session his user id and the authentication id used for signing in is stored\n\t session[:identity] = omniauth['uid']\n\t redirect_to root_url, :notice => \"Signed in successfully.\"\n\t \n\t elsif omniauth and params[:provider]\n\t # create a new hash\n\t @authhash = Hash.new\n\t if authentication_route == 'google_oauth2'\n\t omniauth['info']['email'] ? @authhash[:email] = omniauth['info']['email'] : @authhash[:email] = ''\n\t omniauth['info']['name'] ? @authhash[:name] = omniauth['info']['name'] : @authhash[:name] = ''\n\t omniauth['uid'] ? @authhash[:uid] = omniauth['uid'].to_s : @authhash[:uid] = ''\n\t omniauth['provider'] ? @authhash[:provider] = omniauth['provider'] : @authhash[:provider] = ''\n\t else \n\t # debug to output the hash that has been returned when adding new authentications\n\t render :text => omniauth.to_yaml\n\t return\n\t end\n\t \n\t if @authhash[:uid] != '' and @authhash[:provider] != ''\n\t auth = Authentication.find_by_provider_and_uid(@authhash[:provider], @authhash[:uid])\n\t # if the user is currently signed in, he/she might want to add another account to signin\n\t if logged_in?\n\t if auth\n\t flash[:notice] = 'Your account at ' + @authhash[:provider].capitalize + ' is already connected with this site.'\n\t redirect_to authentications_path\n\t else\n\t current_user.authentications.create!(:provider => @authhash[:provider], :uid => @authhash[:uid], :uname => @authhash[:name], :uemail => @authhash[:email])\n\t flash[:notice] = 'Your ' + @authhash[:provider].capitalize + ' account has been added for signing in at this site.'\n\t redirect_to authentications_path\n\t end\n\t else\n\t if auth\n\t # signin existing user\n\t # in the session his user id and the authentication id used for signing in is stored\n\t session[:user] = auth.user.id\n\t session[:authentication_id] = auth.id\n\t \n\t flash[:notice] = 'Signed in successfully.'\n\t redirect_to root_url\n\t else\n\t # this is a new user; show signup; @authhash is available to the view and stored in the sesssion for creation of a new user\n\t if Rails.env == \"development\" or @authhash[:email].split('@').include?('intridea.com')\n\t session[:authhash] = @authhash\n\t render signup_authentications_path\n\t end\n\t # render signup_authentications_path\n\t end\n\t end\n\t else\n\t flash[:error] = 'Error while authenticating via ' + authentication_route + '/' + @authhash[:provider].capitalize + '. The authentication returned invalid data for the user id.'\n\t redirect_to login_path\n\t end\n\t else\n\t flash[:error] = 'Error while authenticating via ' + authentication_route.capitalize + '. The authentication did not return valid data.'\n\t redirect_to login_path\n\t end\n\t end",
"def create\n omniauth = request.env['omniauth.auth']\n authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])\n if authentication\n flash[:notice] = \"Signed in successfully\"\n sign_in_and_redirect(:account, authentication.account)\n else\n user = Account.new(password: Devise.friendly_token) # If you create an account with twitter/fb, we don't need a passwod\n user.apply_omniauth(omniauth)\n user.email = get_email_from_omniauth omniauth\n if user.save\n flash[:notice] = \"Successfully registered\"\n sign_in_and_redirect(:account, user)\n else\n session[:omniauth] = omniauth.except('extra')\n session[:omniauth_email] = omniauth['extra'] && omniauth['extra']['user_hash'] && omniauth['extra']['user_hash']['email']\n\n # Check if email already taken. If so, ask user to link_accounts\n if user.errors[:email][0] =~ /has already been taken/ # omniauth? TBD\n # fetch the user with this email id!\n user = Account.find_by_email(user.email)\n return redirect_to link_accounts_url(user.id)\n end\n redirect_to new_account_registration_url\n end\n end\n end",
"def new\n client = FacebookAccount.auth(callback_prive_options_facebook_url).client\n redirect_to client.authorization_uri(:scope => SalonVar::FACEBOOK_SCOPE)\n end",
"def create\n auth_hash = request.env['omniauth.auth']\n if auth_hash and auth_hash[:uid]\n username = auth_hash[:uid].split('@').first\n user = User.new.tap do |u|\n u.username = username\n end\n # `admin` is used in development.\n if user.username == 'admin' or user.medusa_admin?\n return_url = clear_and_return_return_path\n sign_in user\n # We can access other information via auth_hash[:extra][:raw_info][key]\n # where key is one of the shibboleth* keys in shibboleth.yml\n # (which have to correspond to passed attributes).\n redirect_to return_url\n return\n end\n end\n flash['error'] = sprintf('Sign-in failed. Ensure that you are a member '\\\n 'of the %s AD group.',\n ::Configuration.instance.medusa_admins_group)\n redirect_to root_url\n end",
"def confirm_new_user\n # If we end up on this page without the relevant session info, redirect to root\n return redirect_to root_path if auth_hash.blank?\n\n @institution = provider.institution\n @users = User.where(email: auth_email)\n @email = auth_email\n store_hash_in_session!\n render 'auth/confirm_new_user'\n end",
"def auth_user\n redirect_to new_user_session_url unless user_signed_in?\n end",
"def create\n cookies.delete :auth_token\n @user = User.new(params[:user])\n @user.save!\n self.current_user = @user\n redirect_back_or_default('/')\n flash[:notice] = 'Your account has been created. Please check your email.'\n rescue ActiveRecord::RecordInvalid\n render :action => 'new'\n end",
"def create\n user = User.find_by(email: params[:email])\n if user and user.authenticate(params[:password])\n session[:user_id] = user.id\n if flash[:ref_url] && flash[:ref_url] != login_url\n redirect_to flash[:ref_url]\n else\n redirect_to root_path\n end\n\n else\n redirect_to login_url,\n alert: \"Invalid user/password combination please try again or register an account\"\n end\n end",
"def create\n auth = request.env[\"omniauth.auth\"]\n user = User.find_by_provider_and_uid(auth[\"provider\"], auth[\"uid\"]) || User.create_with_omniauth(auth)\n session[:user_id] = user.id\n redirect_to app_path\n end",
"def create\n super and return unless current_user\n @user = User.new(user_params)\n redirect_path = params[:redirect_path].present? ? params[:redirect_path] : users_path\n @user.password = @user.password_confirmation = SecureRandom.hex(6)\n respond_to do |format|\n if @user.save\n format.html { redirect_to redirect_path, notice: 'user was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.js { render \"users/new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end \n end",
"def after_sign_in_path_for(user)\n # CODE FOR CAS LOGIN --> NEW USER\n if ENV['CAS_AUTH'] && current_user && current_user.id.nil? &&\n current_user.username\n # store username in session since there's a request in between\n session[:new_username] = current_user.username\n new_user_path\n else\n super\n end\n end",
"def create\n self.current_user = User.from_omniauth(request.env['omniauth.auth'])\n\n if current_user\n # Send the email notifying the user!\n NotificationsMailer.signup(@user).deliver_later\n # byebug\n redirect_to request.referer\n else\n redirect_to auth_path(provider: 'github')\n end\n end",
"def create\n auth = request.env[\"omniauth.auth\"]\n user = User.find_by_provider_and_uid(auth[\"provider\"], auth[\"uid\"]) || User.create_with_omniauth(auth)\n User.update(user.id, :fb_nickname => auth[\"info\"][\"nickname\"])\n session[:user_id] = user.id\n redirect_to root_url\n end",
"def create\n id_token = flash[:google_sign_in_token]\n if user = authenticate_with_google(id_token)\n cookies.signed[:user_id] = user.id\n else\n @user = User.new\n @user.name = GoogleSignIn::Identity.new(id_token).name\n @user.google_id = GoogleSignIn::Identity.new(id_token).user_id\n @user.save\n cookies.signed[:user_id] = @user.id\n end\n callback = cookies.signed[:callback]\n cookies.delete(:callback)\n redirect_to callback\n end",
"def create\n if openid = request.env[Rack::OpenID::RESPONSE]\n case openid.status\n when :success\n ax = OpenID::AX::FetchResponse.from_success_response(openid)\n user = User.where(:identifier_url => openid.display_identifier).first\n user ||= User.find_by_email(ax.get_single('http://axschema.org/contact/email')) \n \n sign_in user\n if user.first_name.blank?\n redirect_to edit_user_path(user)\n else\n redirect_back_or(user)\n end\n when :failure\n render :action => 'problem'\n end\n else\n redirect_to new_session_path\n end\n end",
"def create\n @user = User.find_or_create_by(uid: auth['uid']) do |u|\n u.name = auth['info']['name']\n u.email = auth['info']['email']\n end\n\n session[:user_id] = @user.id\n\n render 'welcome/home'\n end",
"def create\n if user_signed_in?\n render json: { redirect_url: after_sign_in_path_for(@current_user) }\n else\n render json: { errors: \"Invalid email or password\"} and return \n end\n end",
"def create\n if @user = login(params[:email], params[:password])\n redirect_back_or_to(:users, notice: 'Login successful')\n else\n flash.now[:alert] = 'Login failed'\n render action: 'new'\n end\n end",
"def create\n if user.save\n redirect_to users_path\n else\n render 'new'\n end\n end",
"def new\n if current_haka_user\n flash.notice = \"Olet jo kirjautunut sisään.\"\n redirect_to registrations_root_path and return\n end\n\n request = OneLogin::RubySaml::Authrequest.new\n redirect_to(request.create(saml_settings))\n end",
"def new\n client = Facebook.auth(callback_facebook_url).client\n redirect_to client.authorization_uri(\n :scope => Facebook.config[:scope]\n )\n end",
"def new\n client = Facebook.auth(callback_facebook_url).client\n redirect_to client.authorization_uri(\n :scope => Facebook.config[:scope]\n )\n end"
] | [
"0.71605223",
"0.70857066",
"0.7009876",
"0.6943294",
"0.693119",
"0.6834771",
"0.6822586",
"0.68205875",
"0.6799796",
"0.6797928",
"0.679365",
"0.67695785",
"0.6751467",
"0.6749682",
"0.6710988",
"0.67022943",
"0.66953963",
"0.6666064",
"0.6660519",
"0.66413015",
"0.66280806",
"0.662523",
"0.6614798",
"0.6606623",
"0.6605209",
"0.6575886",
"0.6575886",
"0.65750974",
"0.65567905",
"0.654946",
"0.654866",
"0.65435505",
"0.654082",
"0.653353",
"0.652946",
"0.6518657",
"0.6510344",
"0.65058327",
"0.6502896",
"0.6489056",
"0.64811116",
"0.6479274",
"0.6474596",
"0.64616144",
"0.6449523",
"0.6426213",
"0.6419735",
"0.6418816",
"0.64177334",
"0.6416353",
"0.6415284",
"0.6410069",
"0.6406386",
"0.63893014",
"0.6375485",
"0.63754696",
"0.63627684",
"0.6358458",
"0.6347439",
"0.6346146",
"0.63392377",
"0.6338205",
"0.63288736",
"0.6326604",
"0.6326242",
"0.6325297",
"0.63214874",
"0.6317803",
"0.6309622",
"0.6307443",
"0.63042206",
"0.63041323",
"0.6300662",
"0.62935483",
"0.62923044",
"0.62909234",
"0.62896746",
"0.62840015",
"0.6283877",
"0.6281778",
"0.62736315",
"0.6270363",
"0.6264322",
"0.6262922",
"0.62620896",
"0.6234699",
"0.623441",
"0.6231041",
"0.6219712",
"0.62162936",
"0.62159485",
"0.6214664",
"0.6211239",
"0.6210582",
"0.620923",
"0.6202964",
"0.6200397",
"0.6195259",
"0.61932075",
"0.61932075"
] | 0.69779634 | 3 |
GET /pessoas GET /pessoas.json | def index
@cliente = Clienteempresa.where(empresa_id: current_user.empresa_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def index\n @prueba_jsons = PruebaJson.all\n end",
"def index\n @palestrantes = Palestrante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @palestrantes }\n end\n end",
"def index\n @papels = Papel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @papels }\n end\n end",
"def show\n pessoa = Pessoa.find(params[:id])\n render json: {status: 'SUCCESS', message:'Loaded pessoa', data:pessoa},status: :ok\n end",
"def index\n @pacientes = Pacientes.all\n render json: @pacientes\n end",
"def index\n @pizzas = Pizza.all\n render json: @pizzas\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 index\n @parishes = Parish.all\n\n render json: @parishes\n end",
"def index\n @puntajes = Puntaje.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @puntajes }\n end\n end",
"def index\n @propuestas = Propuesta.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @propuestas }\n end\n end",
"def show\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @peso }\n end\n end",
"def index\n @patrocinios = Patrocinio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patrocinios }\n end\n end",
"def index\n @premios = Premio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @premios }\n end\n end",
"def index\n @ventas_presupuestos = Ventas::Presupuesto.paginate(:page => params[:page], :per_page => 5)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas_presupuestos }\n end\n end",
"def index\n @pagamentos = Pagamento.page(params[:page]).per(NUMERO_POR_PAGINA)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pagamentos }\n end\n end",
"def index\n @vehicule_persos = VehiculePerso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @vehicule_persos }\n end\n end",
"def index\n @puntajes = Puntaje.order('created_at DESC').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @puntajes }\n end\n end",
"def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end",
"def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end",
"def index\n if params[:propietario]\n @usuario = Usuario.find(params[:usuario_id])\n authorize! :show, @usuario\n @negocios_propios = Usuario.find(params[:usuario_id]).negocios_propios\n render json: @negocios_propios,\n root: 'negocios_propios',\n each_serializer: NegocioPropioSerializer\n else\n @negocios = Negocio.all\n render json: @negocios\n end\n end",
"def index\n @projetos = Projeto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projetos }\n end\n end",
"def index\n @peticion_servicio_tis = Peticion::ServicioTi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peticion_servicio_tis }\n end\n end",
"def index\n @pugs = Pug.all\n\n render json: @pugs\n end",
"def index\n @ef_pares = EfPare.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ef_pares }\n end\n end",
"def show\n @publicaciones = Publicacione.find(params[:id])\n render json: @publicaciones, status: :ok\n end",
"def show\n @papel = Papel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @papel }\n end\n end",
"def index\n @pagamentos = Pagamento.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pagamentos }\n end\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def index\n\t\texecutar_acoes\n\t\t@pontos = PontoInteresse.all.order(\"enable DESC, denuncias_count DESC, created_at DESC\").page(params[:page])\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @pontos }\n\t\tend\n\tend",
"def show\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paciente }\n end\n end",
"def show\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paciente }\n end\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 index\n @postos = Posto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @postos }\n end\n end",
"def index\n @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 @perfilnegocio = Perfilnegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @perfilnegocio }\n end\n end",
"def show\n @pessoa_receber = PessoaReceber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @pessoa_receber }\n end\n end",
"def get_ponto\n render json: Usuario.ultimo_ponto(params[:user_id], params[:evento_id]).to_json\n end",
"def show\n @palestrante = Palestrante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @palestrante }\n end\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 @periodo_para_ingresars = PeriodoParaIngresar.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @periodo_para_ingresars }\n end\n end",
"def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\n end",
"def index\n @deporte_usuarios = DeporteUsuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deporte_usuarios }\n end\n end",
"def index\n @tipo_usuarios = TipoUsuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tipo_usuarios }\n end\n end",
"def index\n @processos = Processo.all\n\n render json: @processos\n end",
"def index\n @departamentos = Departamento.all\n\n render json: @departamentos\n end",
"def index\n authorize! :index, Por, :message => 'Acceso denegado.'\n @pors = @campus.pors.paginate(:per_page => 3, :page => params[:page])\n\t\t@points = @pors\n\t\t@point_name = \"por\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render \"points/index.json.erb\" } # index.json.erb\n end\n end",
"def index\n @personas = Persona.all\n @users = User.all\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @personas }\n end\n end",
"def index\n @repas = Repa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @repas }\n end\n end",
"def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end",
"def index\n @assuntos = Assunto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assuntos }\n end\n end",
"def show\n @presenza = Presenza.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @presenza }\n end\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n @listas = @pessoa.listas\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pessoa }\n end\n end",
"def index\n @ponto_paradas = PontoParada.all\n end",
"def show\n @ventas_presupuesto = Ventas::Presupuesto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ventas_presupuesto }\n end\n end",
"def index\n @preparatoria_o_universidad_de_origens = PreparatoriaOUniversidadDeOrigen.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @preparatoria_o_universidad_de_origens }\n end\n end",
"def index\n @prayers = Prayer.all\n render json: @prayers, status: 200 # you've got a serializer. Maybe you should use it.\n end",
"def index\n @pedidos = Pedido.find(:all, :conditions => [\"cliente_id=?\", session[:usuario_id]])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pedidos }\n end\n end",
"def show\n @paise = Paise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paise }\n end\n end",
"def index\n @profesors = Profesor.all\n # if @profesors!= nil\n#render json: @profesors\n#else\n# @profesors= '{\"exito\",false,\"no se encontraron profesores\"}'\n\n render json: @profesors\n # end\n end",
"def index\n @proposals = Proposal.all\n\n render json: @proposals\n end",
"def show\n @tipo_pregunta = TipoPregunta.find(params[:id])\n\n render json: @tipo_pregunta\n end",
"def list_pengaduan_proses\n pengaduan = Pengaduan.all.where(status: 'proses').where(user_id: @user.id).order(created_at: :desc)\n render json: {status: true, total: pengaduan.count, data: pengaduan}\n end",
"def index\n @prayers = Prayer.where(\"user_id = ?\", getUser())\n\n @prayer_requests = PrayerRequest.all \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prayers }\n end\n end",
"def index\n @search = (params[:term] ? params[:term] : params[:search])\n @order = get_order()\n\n if params[:contratado] == \"1\"\n @defcontratacao = \"contratacoes.id IS NULL\"\n @title = \"Pessoas (não contratadas)\"\n elsif params[:contratado] == \"2\"\n @defcontratacao = \"contratacoes.id IS NOT NULL\"\n @title = \"Pessoas (contratadas)\"\n else\n @defcontratacao = \"\"\n @title = \"Pessoas\"\n end \n\n @pessoas = Pessoa.pagination_with_search(params[:page], @search, @order).find(:all, :limit => 10,\n :joins => \"LEFT JOIN contratacoes ON contratacoes.pessoa_id = pessoas.id\" ,\n :conditions => @defcontratacao)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pessoas }\n end\n end",
"def index\n @empresas = Empresa.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @empresas }\n end\n end",
"def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end",
"def show\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @premio }\n end\n end",
"def index\n if params[:usuario_producto]\n @usuario = Usuario.find(params[:usuario_id])\n render json: @usuario.productos\n else\n @productos = Producto.all\n render json: @productos\n end\n end",
"def index\n @pets = Pet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pets }\n end\n end",
"def index\n render json: @fiestas\n end",
"def index\n @prayers = Prayer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prayers }\n end\n end",
"def show\n @partecipanti_gruppo = PartecipantiGruppo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @partecipanti_gruppo }\n end\n end",
"def index\n @tutorados = Tutorado.all\n\n render json: @tutorados, status: :ok\n end",
"def index\n @deportes = Deporte.all\n render json: @deportes, status: :ok \n @deportes = Deporte.paginate(:page => params[:page])\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 @anuncios = Anuncio.all.paginate(page: params[:page], per_page: 4 )\n\n respond_to do |format|\n format.html\n format.json { render json: @jobs }\n end\n end",
"def show\n render json: @parish\n end",
"def show\n @propuesta = Propuesta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @propuesta }\n end\n end",
"def index\n @dia_eventos = DiaEvento.all\n render json: @dia_eventos\n end",
"def index\n @tipoclientes = Tipocliente.paginate(:page => params[:numero_hoja], :per_page => 18)\n if params[:numero_hoja].nil?\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @tipoclientes }\n end\n else\n respond_to do |format|\n format.html { render :layout => \"application_paginate\"}# index.html.erb\n #format.json { render json: @impuestos }\n end\n end\n end",
"def index\n @nepals = Nepal.all\n\n render json: @nepals\n end",
"def index\n @usuarios = Usuario.paginate(page: params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end",
"def index\n @equipos = Equipo.all\n render json: @equipos, status: :ok\n end",
"def show\n @profesor_pertenece_asignatura = ProfesorPerteneceAsignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profesor_pertenece_asignatura }\n end\n end",
"def index\n @acoes = Acao.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @acoes }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @personas }\n end\n end",
"def show\n @patrocinio = Patrocinio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patrocinio }\n end\n end",
"def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end",
"def index\n @itemtipos = Itemtipo.all\n\n render json: @itemtipos\n end",
"def index\n @pecas = Peca.find :all, :order => :produto_id\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pecas }\n end\n end",
"def show\n @pto = Pto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pto }\n end\n end",
"def index\n @pets = Pet.all\n # @users= Pet.user.all\n render json: @pets, each_serializer: PetSerializer\n \n end",
"def index\n @anuncios = Anuncio.all\n render json: @anuncios, status: :ok\n end",
"def show\n @clasificacion_pegi = ClasificacionPegi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clasificacion_pegi }\n end\n end",
"def create\n if params[:get]\n @plato = Plato.where(\"soda_id = ?\", params[:soda_id])\n\n #if [email protected]?\n # render json: @plato.as_json(only: [:id, :nombre, :precio, :categoria, :tipo, :calificaciones, :total, :soda_id], include: [comentario:{only: [:id]}])\n #else\n render json: @plato.as_json(only: [:id, :nombre, :precio, :categoria, :tipo, :calificaciones, :total, :soda_id])\n #end\n\n else\n @plato = Plato.new(plato_params)\n\n if @plato.save\n render json: @plato, status: :created, location: @plato\n else\n render json: @plato.errors, status: :unprocessable_entity\n end\n end\n\n end",
"def index\n @territorios = Territorio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @territorios }\n end\n end",
"def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end",
"def index\n @powiadomienia = Powiadomienie.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @powiadomienia }\n end\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"
] | [
"0.7387573",
"0.73654187",
"0.72759485",
"0.7222796",
"0.7139148",
"0.70332515",
"0.70289993",
"0.69802135",
"0.6959833",
"0.6948439",
"0.6947057",
"0.69234544",
"0.6918215",
"0.69053686",
"0.68207294",
"0.68110824",
"0.6733631",
"0.67322695",
"0.67213917",
"0.669133",
"0.669133",
"0.66772413",
"0.66590375",
"0.66467315",
"0.6640276",
"0.66233826",
"0.66154957",
"0.66115683",
"0.66072315",
"0.65610665",
"0.65564775",
"0.65514475",
"0.65514475",
"0.6537894",
"0.65333825",
"0.652413",
"0.6523732",
"0.65185046",
"0.6508735",
"0.64477617",
"0.6438488",
"0.6435145",
"0.64189917",
"0.6412297",
"0.64032876",
"0.6402787",
"0.63969266",
"0.6388391",
"0.63676536",
"0.63644385",
"0.6360664",
"0.6359",
"0.6347277",
"0.63347304",
"0.63270164",
"0.6325108",
"0.6321894",
"0.63211197",
"0.6319499",
"0.63121134",
"0.6307589",
"0.630477",
"0.63020647",
"0.6296752",
"0.6294773",
"0.62920403",
"0.6290979",
"0.62863564",
"0.6281089",
"0.62791485",
"0.62760836",
"0.6275415",
"0.6258997",
"0.62483317",
"0.6248016",
"0.62429523",
"0.6234736",
"0.62343276",
"0.6228749",
"0.62259644",
"0.6221542",
"0.62193036",
"0.62163186",
"0.62124425",
"0.6208053",
"0.6206225",
"0.62038296",
"0.6203231",
"0.6194198",
"0.61918974",
"0.6189736",
"0.6188163",
"0.6185167",
"0.61825925",
"0.6182154",
"0.6180982",
"0.6178415",
"0.61777544",
"0.61753774",
"0.6168767",
"0.61676586"
] | 0.0 | -1 |
GET /pessoas/1 GET /pessoas/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def show\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @peso }\n end\n end",
"def show\n pessoa = Pessoa.find(params[:id])\n render json: {status: 'SUCCESS', message:'Loaded pessoa', data:pessoa},status: :ok\n end",
"def index\n @palestrantes = Palestrante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @palestrantes }\n end\n end",
"def index\n @prueba_jsons = PruebaJson.all\n end",
"def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end",
"def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end",
"def show\n @pessoa_receber = PessoaReceber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @pessoa_receber }\n end\n end",
"def index\n @papels = Papel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @papels }\n end\n end",
"def show\n @tipo_pregunta = TipoPregunta.find(params[:id])\n\n render json: @tipo_pregunta\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 index\n @premios = Premio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @premios }\n end\n end",
"def index\n @propuestas = Propuesta.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @propuestas }\n end\n end",
"def index\n @patrocinios = Patrocinio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patrocinios }\n end\n end",
"def show\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paciente }\n end\n end",
"def show\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paciente }\n end\n end",
"def show\n @publicaciones = Publicacione.find(params[:id])\n render json: @publicaciones, status: :ok\n end",
"def index\n @pagamentos = Pagamento.page(params[:page]).per(NUMERO_POR_PAGINA)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pagamentos }\n end\n end",
"def show\n @perfilnegocio = Perfilnegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @perfilnegocio }\n end\n end",
"def show\n @palestrante = Palestrante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @palestrante }\n end\n end",
"def show\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @premio }\n end\n end",
"def show\n @papel = Papel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @papel }\n end\n end",
"def index\n @puntajes = Puntaje.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @puntajes }\n end\n end",
"def index\n @pacientes = Pacientes.all\n render json: @pacientes\n end",
"def show\n @tipo_pensum = TipoPensum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_pensum }\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 @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end",
"def index\n @pizzas = Pizza.all\n render json: @pizzas\n end",
"def show\n @presenza = Presenza.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @presenza }\n end\n end",
"def index\n @projetos = Projeto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projetos }\n end\n end",
"def index\n @parishes = Parish.all\n\n render json: @parishes\n end",
"def show\n @pologeno = Pologeno.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pologeno }\n end\n end",
"def index\n @vehicule_persos = VehiculePerso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @vehicule_persos }\n end\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 show\n @propuesta = Propuesta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @propuesta }\n end\n end",
"def index\n @ventas_presupuestos = Ventas::Presupuesto.paginate(:page => params[:page], :per_page => 5)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas_presupuestos }\n end\n end",
"def index\n @pagamentos = Pagamento.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pagamentos }\n end\n end",
"def index\n @puntajes = Puntaje.order('created_at DESC').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @puntajes }\n end\n end",
"def show\n @ventas_presupuesto = Ventas::Presupuesto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ventas_presupuesto }\n end\n end",
"def index\n if params[:propietario]\n @usuario = Usuario.find(params[:usuario_id])\n authorize! :show, @usuario\n @negocios_propios = Usuario.find(params[:usuario_id]).negocios_propios\n render json: @negocios_propios,\n root: 'negocios_propios',\n each_serializer: NegocioPropioSerializer\n else\n @negocios = Negocio.all\n render json: @negocios\n end\n end",
"def index\n @peticion_servicio_tis = Peticion::ServicioTi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peticion_servicio_tis }\n end\n end",
"def show\n @personaje = Personaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personaje }\n end\n end",
"def show\n @patrocinio = Patrocinio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patrocinio }\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 consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def show\n @partecipanti_gruppo = PartecipantiGruppo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @partecipanti_gruppo }\n end\n end",
"def index\n @repas = Repa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @repas }\n end\n end",
"def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end",
"def show\n @produto = Produto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produto }\n end\n end",
"def show\n @profesor_pertenece_asignatura = ProfesorPerteneceAsignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profesor_pertenece_asignatura }\n end\n end",
"def show\n @seguro = Seguro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seguro }\n end\n end",
"def show\n @paise = Paise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paise }\n end\n end",
"def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end",
"def show\n @pto = Pto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pto }\n end\n end",
"def show\n @pagamento = Pagamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pagamento }\n end\n end",
"def show\n @pagamento = Pagamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pagamento }\n end\n end",
"def show\n @pagamento = Pagamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pagamento }\n end\n end",
"def show\n @tipomedalla = Tipomedalla.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipomedalla }\n end\n end",
"def show\n @sezione = Sezione.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sezione }\n end\n end",
"def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end",
"def show\n @clasificacion_pegi = ClasificacionPegi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clasificacion_pegi }\n end\n end",
"def index\n @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 @processos = Processo.all\n\n render json: @processos\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n @listas = @pessoa.listas\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pessoa }\n end\n end",
"def show\n @selecao = Selecao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @selecao }\n end\n end",
"def show\n @plato = Plato.find(params[:id])\n\n if [email protected]?\n render json: @plato.as_json(only: [:id, :nombre, :precio, :categoria, :tipo, :calificaciones, :total, :soda_id], include: [comentario:{only: [:id]}])\n else\n render json: @plato.as_json(only: [:id, :nombre, :precio, :categoria, :tipo, :calificaciones, :total, :soda_id])\n end\n end",
"def show\n @publicidade = Publicidade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @publicidade }\n end\n end",
"def show\n @produccion = Produccion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produccion }\n end\n end",
"def show\n @produccion = Produccion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produccion }\n end\n end",
"def get_ponto\n render json: Usuario.ultimo_ponto(params[:user_id], params[:evento_id]).to_json\n end",
"def index\n @postos = Posto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @postos }\n end\n end",
"def show\n @vehicule_perso = VehiculePerso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @vehicule_perso }\n end\n end",
"def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end",
"def show\n @competency_pertenece_asignatura = CompetencyPerteneceAsignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency_pertenece_asignatura }\n end\n end",
"def show\n @profesore = Profesore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profesore }\n end\n end",
"def show\n @prepagada = Prepagada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prepagada }\n end\n end",
"def index\n @periodo_para_ingresars = PeriodoParaIngresar.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @periodo_para_ingresars }\n end\n end",
"def index\n @pedidos = Pedido.find(:all, :conditions => [\"cliente_id=?\", session[:usuario_id]])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pedidos }\n end\n end",
"def show\n @respuesta = Respuesta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @respuesta }\n end\n end",
"def show\n @mapeamento = Mapeamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mapeamento }\n end\n end",
"def index\n\n if params[:ventas_seguimiento]\n cliente_id = params[:ventas_seguimiento][:cliente_id]\n @ventas_seguimientos = Ventas::Seguimiento.where(\"cliente_id = ?\",cliente_id).order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new(:cliente_id => cliente_id)\n else\n @ventas_seguimientos = Ventas::Seguimiento.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas_seguimientos }\n end\n end",
"def index\n\t\texecutar_acoes\n\t\t@pontos = PontoInteresse.all.order(\"enable DESC, denuncias_count DESC, created_at DESC\").page(params[:page])\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @pontos }\n\t\tend\n\tend",
"def show\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @veiculo }\n end\n end",
"def new\n @peso = Peso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @peso }\n end\n end",
"def index\n @ofertas = Oferta.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ofertas }\n end\n end",
"def index\n @ef_pares = EfPare.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ef_pares }\n end\n end",
"def show\n @receipe = Receipe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @receipe }\n end\n end",
"def show\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @persona }\n end\n end",
"def show\n @puestos_entidad = PuestosEntidad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puestos_entidad }\n end\n end",
"def show\n @cliente = Cliente.find(params[:cliente_id])\n @pago = @cliente.pagos.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pago }\n end\n end",
"def index\n @assuntos = Assunto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assuntos }\n end\n end",
"def show\n @publicidad = Publicidad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @publicidad }\n end\n end",
"def index\n if params[:usuario_producto]\n @usuario = Usuario.find(params[:usuario_id])\n render json: @usuario.productos\n else\n @productos = Producto.all\n render json: @productos\n end\n end",
"def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\n end",
"def show\n @pichanga = Pichanga.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @pichanga }\n end\n end",
"def show\n \t@empresa = Core::Empresa.find(params[:empresa_id])\n @core_porto = Core::Porto.find(params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @core_porto }\n end\n end",
"def show\n @asiento = Asiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @asiento }\n end\n end",
"def index\n @pugs = Pug.all\n\n render json: @pugs\n end",
"def show\n @periodo_para_ingresar = PeriodoParaIngresar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @periodo_para_ingresar }\n end\n end",
"def show\n @plannegocio = Plannegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plannegocio }\n end\n end"
] | [
"0.7616914",
"0.7605932",
"0.73462224",
"0.7248876",
"0.7076793",
"0.7014455",
"0.6997127",
"0.6997127",
"0.691861",
"0.6878145",
"0.6858194",
"0.6856384",
"0.6830739",
"0.6820469",
"0.6818778",
"0.68159974",
"0.68159974",
"0.68044615",
"0.6778125",
"0.6777232",
"0.67763954",
"0.67611486",
"0.6752413",
"0.67483974",
"0.674679",
"0.67234904",
"0.6711885",
"0.6709372",
"0.670892",
"0.6704821",
"0.6683613",
"0.66598713",
"0.6653696",
"0.6630059",
"0.661965",
"0.661654",
"0.6590706",
"0.6587838",
"0.65850496",
"0.65826035",
"0.656654",
"0.65642124",
"0.6561733",
"0.655408",
"0.655275",
"0.65489024",
"0.6546129",
"0.6544941",
"0.6534813",
"0.6519542",
"0.65131766",
"0.65088254",
"0.65030235",
"0.6502162",
"0.650138",
"0.64983934",
"0.64983934",
"0.64983934",
"0.6496973",
"0.6496559",
"0.6464755",
"0.6462417",
"0.64619327",
"0.6458738",
"0.64553237",
"0.64500505",
"0.6447223",
"0.6446353",
"0.64432615",
"0.64432615",
"0.64415133",
"0.6429636",
"0.6421393",
"0.6420555",
"0.6419544",
"0.6417076",
"0.6399845",
"0.6393957",
"0.6392245",
"0.63894653",
"0.6384995",
"0.6384898",
"0.63815856",
"0.63791597",
"0.6379049",
"0.6378374",
"0.63768977",
"0.63731647",
"0.6370173",
"0.63689184",
"0.6363077",
"0.6357491",
"0.6355173",
"0.63519806",
"0.6345149",
"0.63427454",
"0.6342111",
"0.6338994",
"0.63383055",
"0.6337333",
"0.6335522"
] | 0.0 | -1 |
POST /pessoas POST /pessoas.json | def create
if params[:cliente_id] == ""
@pessoa = Pessoa.new(pessoa_params)
if params[:senha] == ""
@password = SecureRandom.random_number(99999999)
else
@password = params[:senha]
end
@user = User.new
@user.email = @pessoa.email
@user.password = @password
@user.password_confirmation = @password
if current_user.id == 1
@user.empresa_id = current_user.empresa_id
#@user.role = "ADMIN"
else
@user.empresa_id = 1
#@user.role = "USER"
end
@user.role = "USER"
respond_to do |format|
if @pessoa.save
#criando usuário
@user.pessoa_id = @pessoa.id
if @user.save
Userinfo.send_email(@user,current_user.empresa.nome_empresa).deliver
end
#relacionando usuário com empresa
Clienteempresa.create(:empresa_id => current_user.empresa_id, :pessoa_id => @pessoa.id)
format.html { redirect_to @pessoa, notice: 'Cadastro realizado com sucesso!.' }
format.json { render :show, status: :created, location: @pessoa }
else
format.html { render :new }
format.json { render json: @pessoa.errors, status: :unprocessable_entity }
end
end
else
Clienteempresa.create(:empresa_id => current_user.empresa_id, :pessoa_id => params[:cliente_id])
respond_to do |format|
format.html { redirect_to pessoas_url, notice: 'Cadastro realizado com sucesso!' }
format.json { head :no_content }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n puts 'AQQQQQUUUUUUUIIIIII'\n json = ActiveSupport::JSON.decode(params[:pessoa])\n puts json\n @pessoa = Pessoa.new(json)\n # @address = Address.new(params[:address])\n\n # @client.addresses = @address\n\n respond_to do |format|\n if @pessoa.save\n format.html { redirect_to @pessoa, notice: 'Pessoa was successfully created.' }\n format.json { render json: @pessoa, status: :created, location: @pessoa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pessoa = Pessoa.new(params[:pessoa])\n\n respond_to do |format|\n if @pessoa.save\n format.html { redirect_to pessoas_path, notice: 'Pessoa criada com sucesso.' }\n format.json { render json: @pessoa, status: :created, location: @pessoa }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n format.js { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @peso = Peso.new(params[:peso])\n\n respond_to do |format|\n if @peso.save\n format.html { redirect_to @peso, notice: 'Peso was successfully created.' }\n format.json { render json: @peso, status: :created, location: @peso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @peso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n pessoa = Pessoa.new(pessoa_params) \n \n if pessoa.save\n render json: {status: 'SUCCESSO', message:'Usuário cadastrado com sucesso!', data:pessoa},status: :ok\n else\n render json: {status: 'ERRO', message:'Usuário não pode ser cadastrado. Tente novamente mais tarde.', data:pessoa.errors},status: :unprocessable_entity\n end\n end",
"def create\n @peso = Peso.new(peso_params)\n\n respond_to do |format|\n if @peso.save\n format.html { redirect_to @peso, notice: 'Peso was successfully created.' }\n format.json { render :show, status: :created, location: @peso }\n else\n format.html { render :new }\n format.json { render json: @peso.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 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 create\n @ponto_parada = PontoParada.new(ponto_parada_params)\n\n respond_to do |format|\n if @ponto_parada.save\n format.html { redirect_to @ponto_parada, notice: 'Ponto parada was successfully created.' }\n format.json { render :show, status: :created, location: @ponto_parada }\n else\n format.html { render :new }\n format.json { render json: @ponto_parada.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\n @pocetna = Pocetna.new(pocetna_params)\n\n respond_to do |format|\n if @pocetna.save\n format.html { redirect_to @pocetna, notice: \"Pocetna was successfully created.\" }\n format.json { render :show, status: :created, location: @pocetna }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @pocetna.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end",
"def create\n @palabra = Palabra.new(params[:palabra])\n @palabra.significados = params[:significados] \n respond_to do |format|\n if @palabra.save\n format.html { redirect_to @palabra, notice: 'La palabra fue guardada correctamente.' }\n format.json { render json: @palabra, status: :created, location: @palabra }\n else\n format.html { render action: \"new\" }\n format.json { render json: @palabra.errors, status: :unprocessable_entity }\n end\n end\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 @poto = Poto.new(poto_params)\n\n respond_to do |format|\n if @poto.save\n format.html { redirect_to @poto, notice: 'Poto was successfully created.' }\n format.json { render :show, status: :created, location: @poto }\n else\n format.html { render :new }\n format.json { render json: @poto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def peso_params\n params.require(:peso).permit(:fecha, :peso, :usuario_id)\n end",
"def create\n @ponte = Ponte.new(ponte_params)\n\n respond_to do |format|\n if @ponte.save\n format.html { redirect_to pontes_url, notice: 'Ponte criada com sucesso.' }\n format.json { render :show, status: :created, location: @ponte }\n else\n format.html { render :new }\n format.json { render json: @ponte.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @suceso_perro = SucesoPerro.new(suceso_perro_params)\n\n respond_to do |format|\n if @suceso_perro.save\n format.html { redirect_to @suceso_perro, notice: 'Suceso perro was successfully created.' }\n format.json { render :show, status: :created, location: @suceso_perro }\n else\n format.html { render :new }\n format.json { render json: @suceso_perro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @presenza = Presenza.new(params[:presenza])\n\n respond_to do |format|\n if @presenza.save\n format.html { redirect_to @presenza, notice: 'Presenza was successfully created.' }\n format.json { render json: @presenza, status: :created, location: @presenza }\n else\n format.html { render action: \"new\" }\n format.json { render json: @presenza.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pedidos_has_prato = PedidosHasPrato.new(pedidos_has_prato_params)\n\n respond_to do |format|\n if @pedidos_has_prato.save\n format.html { redirect_to @pedidos_has_prato, notice: 'Pedidos has prato was successfully created.' }\n format.json { render :show, status: :created, location: @pedidos_has_prato }\n else\n format.html { render :new }\n format.json { render json: @pedidos_has_prato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profesor = Profesor.new(profesor_params)\n\n if @profesor.save\n render json: @profesor, status: :created, location: @profesor\n else\n render json: @profesor.errors, status: :unprocessable_entity\n end\n end",
"def create\n @paciente = Paciente.new(params[:paciente])\n \n respond_to do |format|\n if @paciente.save\n format.html { redirect_to pacientes_path, notice: 'Paciente criado com sucesso.' }\n format.json { render json: @paciente, status: :created, location: @paciente }\n else\n format.html { render action: \"new\" }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pessoa = Pessoa.new(params[:pessoa])\n respond_to do |format|\n if @pessoa.save\n format.html { redirect_to(@pessoa, :notice => 'Pessoa cadastrada com sucesso.') }\n format.xml { render :xml => @pessoa, :status => :created, :location => @pessoa }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @pessoa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_parada = TipoParada.new(tipo_parada_params)\n\n respond_to do |format|\n if @tipo_parada.save\n format.html { redirect_to @tipo_parada, notice: 'Tipo parada was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_parada }\n else\n format.html { render :new }\n format.json { render json: @tipo_parada.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ponderacion = Ponderacion.new(ponderacion_params)\n\n respond_to do |format|\n if @ponderacion.save\n format.html { redirect_to @ponderacion, notice: 'Ponderacion was successfully created.' }\n format.json { render :show, status: :created, location: @ponderacion }\n else\n format.html { render :new }\n format.json { render json: @ponderacion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @panneau = Panneau.new(panneau_params)\n\n respond_to do |format|\n if @panneau.save\n format.html { redirect_to @panneau, notice: 'Panneau was successfully created.' }\n format.json { render :show, status: :created, location: @panneau }\n else\n format.html { render :new }\n format.json { render json: @panneau.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @perro = Perro.new(perro_params)\n\n respond_to do |format|\n if @perro.save\n format.html { redirect_to perros_url, notice: 'Perro creado.' }\n format.json { render :show, status: :created, location: @perro }\n else\n format.html { render :new }\n format.json { render json: @perro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pimo = Pimo.new(pimo_params)\n\n respond_to do |format|\n if @pimo.save\n format.html { redirect_to @pimo, notice: 'Pimo was successfully created.' }\n format.json { render :show, status: :created, location: @pimo }\n else\n format.html { render :new }\n format.json { render json: @pimo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @poliza = Poliza.new(poliza_params)\n\n respond_to do |format|\n if @poliza.save\n format.html { redirect_to @poliza, notice: 'Poliza was successfully created.' }\n format.json { render :show, status: :created, location: @poliza }\n else\n format.html { render :new }\n format.json { render json: @poliza.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n \n respond_to do |format|\n if @paciente.save\n format.html { redirect_to @paciente, notice: 'Paciente creado exitosamente.' }\n format.json { render :show, status: :created, location: @paciente }\n else \n format.html { render :new}\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cliente = Cliente.new\n if params[:type] == \"PessoaFisica\"\n @cliente.pessoa = PessoaFisica.new\n else\n @cliente.pessoa = PessoaJuridica.new\n end\n @cliente.assign_attributes(cliente_params)\n respond_to do |format|\n if @cliente.save\n format.html { redirect_to action: \"index\"}\n format.json { render json: @cliente.to_json(include: [:pessoa]) }\n else\n format.html { render :new }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @psa = Psa.new(params[:psa])\n\n respond_to do |format|\n if @psa.save\n format.html { redirect_to @psa, notice: 'Psa was successfully created.' }\n format.json { render json: @psa, status: :created, location: @psa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @psa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @posto = Posto.new(params[:posto])\n\n respond_to do |format|\n if @posto.save\n format.html { redirect_to @posto, notice: 'Posto de Saude cadastrado com sucesso' }\n format.json { render json: @posto, status: :created, location: @posto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @posto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pessoacondominio = Pessoacondominio.new(pessoacondominio_params)\n\n respond_to do |format|\n if @pessoacondominio.save\n format.html { redirect_to @pessoacondominio, notice: 'Pessoa cadastrada com sucesso.' }\n format.json { render :show, status: :created, location: @pessoacondominio }\n else\n format.html { render :new }\n format.json { render json: @pessoacondominio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pessoa = Pessoa.new(params[:pessoa])\n\n respond_to do |format|\n if @pessoa.save\n flash[:notice] = 'Pessoa was successfully created.'\n format.html { redirect_to(@pessoa) }\n format.xml { render :xml => @pessoa, :status => :created, :location => @pessoa }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @pessoa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @servico_pacote = Servico::Pacote.new(servico_pacote_params)\n\n respond_to do |format|\n if @servico_pacote.save\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully created.' }\n format.json { render action: 'show', status: :created, location: @servico_pacote }\n else\n format.html { render action: 'new' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @osoba = Osoba.new(params[:osoba])\n\n if @osoba.save\n render json: @osoba, status: :created, location: @osoba\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def prueba_json_params\n params[:prueba_json]\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 @prato = Prato.new(prato_params)\n\n respond_to do |format|\n if @prato.save\n format.html { redirect_to @prato, notice: 'Prato was successfully created.' }\n format.json { render :show, status: :created, location: @prato }\n else\n format.html { render :new }\n format.json { render json: @prato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asiento = Asiento.new(params[:asiento])\n\n respond_to do |format|\n if @asiento.save\n format.html { redirect_to @asiento, :notice => 'El apunte fue creado.' }\n format.json { render :json => @asiento, :status => :created, :location => @asiento }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @asiento.errors, :status => :unprocessable_entity }\n end\n end\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: 'El puntaje ha sido registrado con exito. ' }\n CustomLogger.info(\"Un nuevo puntaje: #{@puntaje.puntaje.to_i.inspect} correspondiente a la tarea: #{@puntaje.planificacion_tarea.inspect} del alumno: #{@puntaje.alumno.user_full_name.inspect} , Descripcion:#{@puntaje.descripcion.inspect} ha sido registrado por el usuario: #{current_user.full_name.inspect}, #{Time.now}\")\n format.json { render json: @puntaje, status: :created, location: @puntaje }\n else\n atributos\n format.html { render action: \"new\" }\n CustomLogger.error(\"Se ha producido un error al querer registrar el puntaje: #{@puntaje.puntaje.to_i.inspect} y sus demas atributos, por el usuario: #{current_user.full_name.inspect}, #{Time.now}\")\n format.json { render json: @puntaje.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pai = Pai.new(pai_params)\n\n respond_to do |format|\n if @pai.save\n format.html { redirect_to pais_path, notice: 'Pais creado existosamente.' }\n format.json { render :index, status: :created, location: @pai }\n else\n format.html { render :new }\n format.json { render json: @pai.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_aposta = TipoAposta.new(tipo_aposta_params)\n\n respond_to do |format|\n if @tipo_aposta.save\n format.html { redirect_to @tipo_aposta, notice: 'Tipo aposta was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_aposta }\n else\n format.html { render :new }\n format.json { render json: @tipo_aposta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @precio_paquete = PrecioPaquete.new(precio_paquete_params)\n\n respond_to do |format|\n if @precio_paquete.save\n format.html { redirect_to action: \"index\", notice: 'Precio paquete creado existosamente.' }\n format.json { render action: 'show', status: :created, location: @precio_paquete }\n else\n format.html { render action: 'new' }\n format.json { render json: @precio_paquete.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @paciente = Paciente.new(paciente_params)\n\n respond_to do |format|\n if @paciente.save\n format.html { redirect_to @paciente, notice: 'Paciente was successfully created.' }\n format.json { render :show, status: :created, location: @paciente }\n else\n format.html { render :new }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\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 create\n @soatseguro = Soatseguro.new(soatseguro_params)\n\n respond_to do |format|\n if @soatseguro.save\n format.html { redirect_to @soatseguro, notice: 'Soatseguro was successfully created.' }\n format.json { render :show, status: :created, location: @soatseguro }\n else\n format.html { render :new }\n format.json { render json: @soatseguro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_pensum = TipoPensum.new(params[:tipo_pensum])\n\n respond_to do |format|\n if @tipo_pensum.save\n format.html { redirect_to @tipo_pensum, notice: 'Tipo pensum was successfully created.' }\n format.json { render json: @tipo_pensum, status: :created, location: @tipo_pensum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_pensum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @perfilnegocio = Perfilnegocio.new(params[:perfilnegocio])\n\n respond_to do |format|\n if @perfilnegocio.save\n format.html { redirect_to @perfilnegocio, notice: 'Perfilnegocio was successfully created.' }\n format.json { render json: @perfilnegocio, status: :created, location: @perfilnegocio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @perfilnegocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipoapreensao = Tipoapreensao.new(tipoapreensao_params)\n\n respond_to do |format|\n if @tipoapreensao.save\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tipoapreensao }\n else\n format.html { render action: 'new' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @etapa = Etapa.new(etapa_params)\n\n respond_to do |format|\n if @etapa.save\n format.html { redirect_to @etapa, notice: 'Etapa fue creada exitosamente.' }\n format.json { render :show, status: :created, location: @etapa }\n else\n format.html { render :new }\n format.json { render json: @etapa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pozi = Pozi.new(pozi_params)\n\n respond_to do |format|\n if @pozi.save\n format.html { redirect_to pozis_path, notice: 'Pozi was successfully created.' }\n format.json { render :show, status: :created, location: @pozi }\n else\n format.html { render :new }\n format.json { render json: @pozi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @paciente = Paciente.new(params[:paciente])\n\n respond_to do |format|\n if @paciente.save\n format.html { redirect_to @paciente, notice: 'Paciente registrado com sucesso.' }\n format.json { render json: @paciente, status: :created, location: @paciente }\n else\n format.html { render action: \"new\" }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @padrao = Padrao.new(padrao_params)\n\n respond_to do |format|\n if @padrao.save\n format.html { redirect_to @padrao, notice: 'Padrao was successfully created.' }\n format.json { render action: 'show', status: :created, location: @padrao }\n else\n format.html { render action: 'new' }\n format.json { render json: @padrao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asignatura = Asignatura.new(asignatura_params)\n\n respond_to do |format|\n if @asignatura.save\n format.json { render json: \"Asignatura Creada\", status: :created, location: @asignatura }\n else\n format.json { render json: @asignatura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @prorroga = Prorroga.new(prorroga_params)\n\n respond_to do |format|\n if @prorroga.save\n format.html { redirect_to @prorroga, notice: 'Prorroga was successfully created.' }\n format.json { render :show, status: :created, location: @prorroga }\n else\n format.html { render :new }\n format.json { render json: @prorroga.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @sivic_pessoa = SivicPessoa.new(sivic_pessoa_params)\r\n\r\n respond_to do |format|\r\n if @sivic_pessoa.save\r\n format.html { redirect_to @sivic_pessoa, notice: 'Registro inserido com sucesso.' }\r\n format.json { render action: 'show', status: :created, location: @sivic_pessoa }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @sivic_pessoa.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n\n @prepagada = Prepagada.new({ :prepagada => params[:prepagada], :odontologo_id => params[:odontologo_id] })\n\n respond_to do |format|\n if @prepagada.save\n format.html { redirect_to @prepagada, notice: 'Prepagada was successfully created.' }\n format.json { render json: @prepagada, status: :created, location: @prepagada }\n else\n format.html { render action: \"new\" }\n format.json { render json: @prepagada.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @posto = Posto.new(posto_params)\n\n respond_to do |format|\n if @posto.save\n format.html { redirect_to @posto, notice: 'Posto was successfully created.' }\n format.json { render :show, status: :created, location: @posto }\n else\n format.html { render :new }\n format.json { render json: @posto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @partecipante = Partecipante.new(params[:partecipante])\n\n respond_to do |format|\n if @partecipante.save\n format.html { redirect_to @partecipante, notice: 'Partecipante was successfully created.' }\n format.json { render json: @partecipante, status: :created, location: @partecipante }\n else\n format.html { render action: \"new\" }\n format.json { render json: @partecipante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @parola = Parola.new(parola_params)\n\n respond_to do |format|\n if @parola.save\n format.html { redirect_to @parola, notice: 'Parola was successfully created.' }\n format.json { render action: 'show', status: :created, location: @parola }\n else\n format.html { render action: 'new' }\n format.json { render json: @parola.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @parte_cuerpo = ParteCuerpo.new(parte_cuerpo_params)\n\n respond_to do |format|\n if @parte_cuerpo.save\n format.html { redirect_to @parte_cuerpo, notice: 'Parte cuerpo was successfully created.' }\n format.json { render :show, status: :created, location: @parte_cuerpo }\n else\n format.html { render :new }\n format.json { render json: @parte_cuerpo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @paciente = Paciente.new(params[:paciente])\n\n paciente = @paciente\n respond_to do |format|\n if @paciente.save\n\n enviar_correo_nuevo_paciente paciente\n\n format.html { redirect_to @paciente, notice: 'Paciente was successfully created.' }\n format.json { render json: @paciente, status: :created, location: @paciente }\n else\n format.html { render action: \"new\" }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n\n\n\n end",
"def create\n @personaje = Personaje.new(params[:personaje])\n\n respond_to do |format|\n if @personaje.save\n format.html { redirect_to @personaje, notice: 'Personaje was successfully created.' }\n format.json { render json: @personaje, status: :created, location: @personaje }\n else\n format.html { render action: \"new\" }\n format.json { render json: @personaje.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.create(post_params)\n puts \"LLLLLOOOOOOOLLLLLL\"\n puts current_usuario.to_json\n @post = current_usuario.posts.create(post_params)\n \n @post.sangre = current_usuario.tipoDeSangre\n\n\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @papel = Papel.new(papel_params)\n\n respond_to do |format|\n if @papel.save\n format.html { redirect_to @papel, notice: 'Papel foi criado com sucesso' }\n format.json { render :show, status: :created, location: @papel }\n else\n format.html { render :new }\n format.json { render json: @papel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if params[:get]\n @plato = Plato.where(\"soda_id = ?\", params[:soda_id])\n\n #if [email protected]?\n # render json: @plato.as_json(only: [:id, :nombre, :precio, :categoria, :tipo, :calificaciones, :total, :soda_id], include: [comentario:{only: [:id]}])\n #else\n render json: @plato.as_json(only: [:id, :nombre, :precio, :categoria, :tipo, :calificaciones, :total, :soda_id])\n #end\n\n else\n @plato = Plato.new(plato_params)\n\n if @plato.save\n render json: @plato, status: :created, location: @plato\n else\n render json: @plato.errors, status: :unprocessable_entity\n end\n end\n\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 @pichanga = Pichanga.new(params[:pichanga])\n\n respond_to do |format|\n if @pichanga.save\n format.html { redirect_to @pichanga, :notice => 'Pichanga was successfully created.' }\n format.json { render :json => @pichanga, :status => :created, :location => @pichanga }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @pichanga.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @ponto = Ponto.new(ponto_params)\n\n respond_to do |format|\n if @ponto.save\n format.html { redirect_to @ponto, notice: 'Ponto foi Adicionado.' }\n format.json { render :show, status: :created, location: @ponto }\n else\n format.html { render :new }\n format.json { render json: @ponto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pasien = Pasien.new(pasien_params)\n\n respond_to do |format|\n if @pasien.save\n format.html { redirect_to @pasien, notice: 'Pasien was successfully created.' }\n format.json { render :show, status: :created, location: @pasien }\n else\n format.html { render :new }\n format.json { render json: @pasien.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pessoa_receber = PessoaReceber.new(params[:pessoa_receber])\n @pessoa_receber.user_id = current_user.id\n respond_to do |format|\n if @pessoa_receber.save\n format.html { redirect_to @pessoa_receber, :notice => 'Pessoa receber was successfully created.' }\n format.json { render :json => @pessoa_receber, :status => :created, :location => @pessoa_receber }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @pessoa_receber.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @propuesta = Propuesta.new(propuesta_params)\n\n respond_to do |format|\n if @propuesta.save\n format.html { redirect_to @propuesta, notice: 'Propuesta was successfully created.' }\n format.json { render :show, status: :created, location: @propuesta }\n else\n format.html { render :new }\n format.json { render json: @propuesta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipomedalla = Tipomedalla.new(params[:tipomedalla])\n\n respond_to do |format|\n if @tipomedalla.save\n format.html { redirect_to @tipomedalla, notice: 'Tipomedalla was successfully created.' }\n format.json { render json: @tipomedalla, status: :created, location: @tipomedalla }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipomedalla.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @selecao = Selecao.new(params[:selecao])\n\n respond_to do |format|\n if @selecao.save\n format.html { redirect_to @selecao, notice: 'Selecao was successfully created.' }\n format.json { render json: @selecao, status: :created, location: @selecao }\n else\n format.html { render action: \"new\" }\n format.json { render json: @selecao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @saida_produto = SaidaProduto.new(saida_produto_params)\n\n respond_to do |format|\n if @saida_produto.save\n format.html { redirect_to @saida_produto, notice: 'Saida produto was successfully created.' }\n format.json { render :show, status: :created, location: @saida_produto }\n else\n format.html { render :new }\n format.json { render json: @saida_produto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @peliculass = Peliculass.new(peliculass_params)\n\n respond_to do |format|\n if @peliculass.save\n format.html { redirect_to @peliculass, notice: 'Peliculass was successfully created.' }\n format.json { render :show, status: :created, location: @peliculass }\n else\n format.html { render :new }\n format.json { render json: @peliculass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pergunta = @topico.perguntas.new(pergunta_params)\n\n respond_to do |format|\n if @pergunta.save\n format.html { redirect_to set_path, notice: 'Pergunta criada com sucesso.' }\n format.json { render action: 'show', status: :created, location: @pergunta }\n else\n format.html { render action: 'new' }\n format.json { render json: @pergunta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @parjo = Parjo.new(parjo_params)\n\n respond_to do |format|\n if @parjo.save\n format.html { redirect_to @parjo, notice: 'Parjo was successfully created.' }\n format.json { render :show, status: :created, location: @parjo }\n else\n format.html { render :new }\n format.json { render json: @parjo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @abogado_p = AbogadoP.new(abogado_p_params)\n\n respond_to do |format|\n if @abogado_p.save\n format.html { redirect_to abogado_ps_path, notice: 'El abogado se ha creado correctamente.' }\n format.json { render :show, status: :created, location: @abogado_p }\n else\n format.html { render :new }\n format.json { render json: @abogado_p.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @peticion = Peticion.new(peticion_params)\n\n respond_to do |format|\n if @peticion.save\n format.html { redirect_to @peticion, notice: 'Peticion was successfully created.' }\n format.json { render :show, status: :created, location: @peticion }\n else\n format.html { render :new }\n format.json { render json: @peticion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sugestao = Sugestao.new(sugestao_params)\n\n respond_to do |format|\n if @sugestao.save\n format.html { redirect_to @sugestao, notice: 'Sugestão salva com sucesso.' }\n format.json { render :show, status: :created, location: @sugestao }\n else\n format.html { render :new }\n format.json { render json: @sugestao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pago = Pago.new(params[:pago])\n\n respond_to do |format|\n if @pago.save\n format.html { render :text => @pago.attributes.merge( :saldo => @pago.saldo ).to_json }\n format.xml { render :xml => @pago, :status => :created, :location => @pago }\n else\n format.html { render :action => \"new\", :status => :unprocessable_entity }\n format.xml { render :xml => @pago.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @empresas = Empresa.new(empresa_params)\n\n respond_to do |format|\n if @empresas.save\n format.html { redirect_to @empresas, notice: 'Empresa was successfully created.' }\n format.json { render :show, status: :created, location: @empresas }\n else\n format.html { render :new }\n format.json { render json: @empresas.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pregoestitulo = Pregoestitulo.new(pregoestitulo_params)\n\n pregao = Pregao.where('data = ?', @pregoestitulo.date).first\n\n if pregao.blank?\n pregao = Pregao.new\n pregao.data = @pregoestitulo.date\n pregao.flagativo = true\n pregao.save\n end\n\n @pregoestitulo.pregao_id = pregao.id\n\n respond_to do |format|\n if @pregoestitulo.save\n format.html { redirect_to @pregoestitulo, notice: 'Título incluído com sucesso.' }\n format.json { render :show, status: :created, location: @pregoestitulo }\n else\n format.html { render :new }\n format.json { render json: @pregoestitulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sugerencia = Sugerencia.new(params[:sugerencia])\n\n respond_to do |format|\n if @sugerencia.save\n format.html { redirect_to @sugerencia, :notice => 'Sugerencia was successfully created.' }\n format.json { render :json => @sugerencia, :status => :created, :location => @sugerencia }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @sugerencia.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @basico_pais = Basico::Pais.new(basico_pais_params)\n respond_to do |format|\n if @basico_pais.save\n format.html { redirect_to @basico_pais, notice: 'Pais was successfully created.' }\n format.json { render :show, status: :created, location: @basico_pais }\n else\n format.html { render :new }\n format.json { render json: @basico_pais.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @puisi = Puisi.new(puisi_params)\n\n respond_to do |format|\n if @puisi.save\n format.html { redirect_to @puisi, notice: 'Puisi was successfully created.' }\n format.json { render action: 'show', status: :created, location: @puisi }\n else\n format.html { render action: 'new' }\n format.json { render json: @puisi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @espetaculo = Espetaculo.new(espetaculo_params)\n\n respond_to do |format|\n if @espetaculo.save\n format.html { redirect_to @espetaculo, notice: 'Espetaculo was successfully created.' }\n format.json { render :show, status: :created, location: @espetaculo }\n else\n format.html { render :new }\n format.json { render json: @espetaculo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @persona = Persona.new(params[:persona])\n \n respond_to do |format|\n if @persona.save\n format.json { render :json => @persona,\n :status => :created, :location => @persona }\n else\n format.json { render :json => @persona.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @peso = Peso.new(params[:peso])\n p params[:peso]\n\n respond_to do |format|\n if @peso.save\n flash[:notice] = 'Peso was successfully created.'\n format.html { redirect_to(@peso) }\n format.xml { render :xml => @peso, :status => :created, :location => @peso }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @peso.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @fotos_empresa = FotosEmpresa.new(fotos_empresa_params)\n\n respond_to do |format|\n if @fotos_empresa.save\n format.html { redirect_to @fotos_empresa, notice: 'Fotos empresa was successfully created.' }\n format.json { render :show, status: :created, location: @fotos_empresa }\n else\n format.html { render :new }\n format.json { render json: @fotos_empresa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @enfermeras_paciente = EnfermerasPaciente.new(enfermeras_paciente_params)\n\n respond_to do |format|\n if @enfermeras_paciente.save\n format.html { redirect_to @enfermeras_paciente, notice: 'Enfermeras paciente was successfully created.' }\n format.json { render :show, status: :created, location: @enfermeras_paciente }\n else\n format.html { render :new }\n format.json { render json: @enfermeras_paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @perdida = Perdida.new(perdida_params)\n\n respond_to do |format|\n if @perdida.save\n format.html { redirect_to perdidaa_path, notice: 'Se ha Creado un Registro.' }\n format.json { render :show, status: :created, location: @perdida }\n else\n format.html { render :new }\n format.json { render json: @perdida.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @puestos_entidad = PuestosEntidad.new(params[:puestos_entidad])\n\n respond_to do |format|\n if @puestos_entidad.save\n format.html { redirect_to @puestos_entidad, notice: 'Puestos entidad was successfully created.' }\n format.json { render json: @puestos_entidad, status: :created, location: @puestos_entidad }\n else\n format.html { render action: \"new\" }\n format.json { render json: @puestos_entidad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pie = PIE.new(pie_params)\n\n respond_to do |format|\n if @pie.save\n format.html { redirect_to @pie, notice: 'PIE was successfully created.' }\n format.json { render :show, status: :created, location: @pie }\n else\n format.html { render :new }\n format.json { render json: @pie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pessoa_params\n params.require(:pessoa).permit(:nome, :email, :cidade, :data_nasc, :telefone)\n end",
"def create\n @estatuto = Estatuto.new(params[:estatuto])\n\n respond_to do |format|\n if @estatuto.save\n format.html { redirect_to @estatuto, notice: 'Estatuto was successfully created.' }\n format.json { render json: @estatuto, status: :created, location: @estatuto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estatuto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @puesto_salud = PuestoSalud.new(puesto_salud_params)\n\n respond_to do |format|\n if @puesto_salud.save\n format.html { redirect_to @puesto_salud, notice: 'Puesto salud was successfully created.' }\n format.json { render :show, status: :created, location: @puesto_salud }\n else\n format.html { render :new }\n format.json { render json: @puesto_salud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_propiedad = TipoPropiedad.new(tipo_propiedad_params)\n\n respond_to do |format|\n if @tipo_propiedad.save\n format.html { redirect_to @tipo_propiedad, notice: 'Tipo propiedad was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_propiedad }\n else\n format.html { render :new }\n format.json { render json: @tipo_propiedad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asignatura = Asignatura.new(params[:asignatura])\n\n respond_to do |format|\n if @asignatura.save\n format.html { redirect_to @asignatura, notice: 'Asignatura was successfully created.' }\n format.json { render json: @asignatura, status: :created, location: @asignatura }\n else\n format.html { render action: \"new\" }\n format.json { render json: @asignatura.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7089397",
"0.7042876",
"0.70071715",
"0.699476",
"0.6932317",
"0.6914089",
"0.6873405",
"0.68388647",
"0.6769829",
"0.67177093",
"0.67110264",
"0.6698779",
"0.66812253",
"0.6641314",
"0.66333777",
"0.6627719",
"0.6608695",
"0.6599225",
"0.6590115",
"0.6571456",
"0.65704614",
"0.65592104",
"0.65515643",
"0.6542426",
"0.6536898",
"0.6536529",
"0.65355",
"0.6527102",
"0.6523466",
"0.65206224",
"0.65087533",
"0.65071255",
"0.6506426",
"0.65051055",
"0.649769",
"0.6478403",
"0.6476902",
"0.6462667",
"0.64491713",
"0.64424574",
"0.64378494",
"0.6434222",
"0.642617",
"0.6423786",
"0.6419469",
"0.6416891",
"0.64167523",
"0.6416673",
"0.6414748",
"0.6401694",
"0.6398312",
"0.63936824",
"0.6387164",
"0.638112",
"0.63800716",
"0.63793427",
"0.6377621",
"0.6375572",
"0.6374467",
"0.63734937",
"0.6368858",
"0.63602227",
"0.635934",
"0.6359045",
"0.63571537",
"0.6353743",
"0.6349789",
"0.6347963",
"0.63477504",
"0.6344325",
"0.6341323",
"0.63402075",
"0.6331886",
"0.63310456",
"0.63249373",
"0.6321394",
"0.63169986",
"0.63127315",
"0.6308755",
"0.6307313",
"0.6306304",
"0.63029104",
"0.63000953",
"0.6291086",
"0.6290056",
"0.62889713",
"0.62883633",
"0.62820244",
"0.6269883",
"0.626782",
"0.6266683",
"0.62623537",
"0.62610805",
"0.6260089",
"0.62584263",
"0.6257359",
"0.6255738",
"0.62488616",
"0.62483287",
"0.62454337",
"0.6244353"
] | 0.0 | -1 |
PATCH/PUT /pessoas/1 PATCH/PUT /pessoas/1.json | def update
respond_to do |format|
if @pessoa.update(pessoa_params)
format.html { redirect_to @pessoa, notice: 'Cadastro alterado com sucesso!.' }
format.json { render :show, status: :ok, location: @pessoa }
else
format.html { render :edit }
format.json { render json: @pessoa.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n if @peso.update_attributes(params[:peso])\n format.html { redirect_to @peso, notice: 'Peso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @peso.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 @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 respond_to do |format|\n if @peso.update(peso_params)\n format.html { redirect_to @peso, notice: 'Peso was successfully updated.' }\n format.json { render :show, status: :ok, location: @peso }\n else\n format.html { render :edit }\n format.json { render json: @peso.errors, status: :unprocessable_entity }\n end\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 respond_to do |format|\n if @tipoapreensao.update(tipoapreensao_params)\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @parola.update(parola_params)\n format.html { redirect_to parolas_url, notice: 'Parola was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @parola.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\r\n respond_to do |format|\r\n if @sivic_pessoa.update(sivic_pessoa_params)\r\n format.html { redirect_to @sivic_pessoa, notice: 'Registro alterado com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_pessoa.errors, status: :unprocessable_entity }\r\n end\r\n end\r\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 update\n respond_to do |format|\n if @pocetna.update(pocetna_params)\n format.html { redirect_to @pocetna, notice: \"Pocetna was successfully updated.\" }\n format.json { render :show, status: :ok, location: @pocetna }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @pocetna.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n if @oferta.update_attributes(params[:oferta])\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @poto.update(poto_params)\n format.html { redirect_to @poto, notice: 'Poto was successfully updated.' }\n format.json { render :show, status: :ok, location: @poto }\n else\n format.html { render :edit }\n format.json { render json: @poto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @platoon.update(platoon_params)\n format.html { redirect_to @platoon, notice: 'Platoon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @platoon.errors, status: :unprocessable_entity }\n end\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 respond_to do |format|\n if @tiposveiculo.update(tiposveiculo_params)\n format.html { redirect_to tiposveiculos_url, notice: 'Tipo de Veículo editado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @tiposveiculo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @placa_casa = PlacaCasa.find(params[:id])\n @placa_casa.pessoa.update_attributes(params[:pessoa]) \n @placa_casa.placa.update_attributes(params[:placa])\n\n respond_to do |format|\n if @placa_casa.update_attributes(params[:placa_casa])\n format.html { redirect_to(@placa_casa, :notice => ' - Dados atualizados com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @placa_casa.errors, :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 @persona = Persona.find(params[:id])\n \n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.json { head :ok }\n else\n format.json { render :json => @persona.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @osoba = Osoba.find(params[:id])\n\n if @osoba.update(params[:osoba])\n head :no_content\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @tapioca.update(tapioca_params)\n format.html { redirect_to @tapioca, notice: 'Tapioca was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tapioca.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_pregunta = TipoPregunta.find(params[:id])\n\n if @tipo_pregunta.update(params[:tipo_pregunta])\n head :no_content\n else\n render json: @tipo_pregunta.errors, status: :unprocessable_entity\n end\n end",
"def update\n\trespond_to do |format|\n\tif @precio_boleto.update(precio_boleto_params)\n\t\tformat.html { redirect_to @precio_boleto, notice: 'Precio boleto was successfully updated.' }\n\t\tformat.json { head :no_content }\n\telse\n\t\tformat.html { render action: 'edit' }\n\t\tformat.json { render json: @precio_boleto.errors, status: :unprocessable_entity }\n\tend\n\tend\nend",
"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 @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @poligono.update(poligono_params)\n format.html { redirect_to @poligono, notice: 'Poligono was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @poligono.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @precio_boleto.update(precio_boleto_params)\n format.html { redirect_to @precio_boleto, notice: 'Precio boleto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @precio_boleto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ventas_presupuesto = Ventas::Presupuesto.find(params[:id])\n\n respond_to do |format|\n if @ventas_presupuesto.update_attributes(params[:ventas_presupuesto])\n format.html { redirect_to @ventas_presupuesto, notice: 'Presupuesto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ventas_presupuesto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @opcao.update(opcao_params)\n format.html { redirect_to @opcao, notice: 'Opcao atualizada com sucesso!' }\n format.json { render :show, status: :ok, location: @opcao }\n else\n format.html { render :edit }\n format.json { render json: @opcao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @precio_paquete.update(precio_paquete_params)\n format.html { redirect_to action: \"index\", notice: 'Precio paquete actualizado existosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @precio_paquete.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(objeto_params)\n format.html { redirect_to @objeto, notice: 'Objeto was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(objeto_params)\n format.html { redirect_to @objeto, notice: 'Objeto was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @selecao = Selecao.find(params[:id])\n\n respond_to do |format|\n if @selecao.update_attributes(params[:selecao])\n format.html { redirect_to @selecao, notice: 'Selecao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @selecao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @soatseguro.update(soatseguro_params)\n format.html { redirect_to @soatseguro, notice: 'Soatseguro was successfully updated.' }\n format.json { render :show, status: :ok, location: @soatseguro }\n else\n format.html { render :edit }\n format.json { render json: @soatseguro.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 patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n respond_to do |format|\n if @placa.update(placa_params)\n format.html { redirect_to @placa, notice: 'Placa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @placa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @apoio.update(apoio_params)\n format.html { redirect_to @apoio, notice: 'Apoio was successfully updated.' }\n format.json { render :show, status: :ok, location: @apoio }\n else\n format.html { render :edit }\n format.json { render json: @apoio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @asiento = Asiento.find(params[:id])\n\n respond_to do |format|\n if @asiento.update_attributes(params[:asiento])\n format.html { redirect_to @asiento, :notice => 'El apunte fue cambiado.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @asiento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @palabra = Palabra.find(params[:id])\n @palabra.significados = params[:significados] \n respond_to do |format|\n if @palabra.update_attributes(params[:palabra])\n format.html { redirect_to @palabra, notice: 'La Palabra fue actualizada correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @palabra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prato.update(prato_params)\n format.html { redirect_to @prato, notice: 'Prato was successfully updated.' }\n format.json { render :show, status: :ok, location: @prato }\n else\n format.html { render :edit }\n format.json { render json: @prato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @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 @respuesta = Respuesta.find(params[:id])\n\n if @respuesta.update(params[:respuesta])\n head :no_content\n else\n render json: @respuesta.errors, status: :unprocessable_entity\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 respond_to do |format|\n if @poliza.update(poliza_params)\n format.html { redirect_to @poliza, notice: 'Poliza was successfully updated.' }\n format.json { render :show, status: :ok, location: @poliza }\n else\n format.html { render :edit }\n format.json { render json: @poliza.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @atracao = Atracao.find(params[:id])\n\n respond_to do |format|\n if @atracao.update_attributes(params[:atracao])\n format.html { redirect_to @atracao, :notice => 'Atracao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @atracao.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @perfilnegocio = Perfilnegocio.find(params[:id])\n\n respond_to do |format|\n if @perfilnegocio.update_attributes(params[:perfilnegocio])\n format.html { redirect_to @perfilnegocio, notice: 'Perfilnegocio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @perfilnegocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sintoma.update(sintoma_params)\n format.html { redirect_to @sintoma, notice: 'Sintoma was successfully updated.' }\n format.json { render :show, status: :ok, location: @sintoma }\n else\n format.html { render :edit }\n format.json { render json: @sintoma.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prospecto_meta_largo_plazo.update(prospecto_meta_largo_plazo_params)\n format.html { redirect_to @prospecto_meta_largo_plazo, notice: 'Prospecto meta largo plazo was successfully updated.' }\n format.json { render :show, status: :ok, location: @prospecto_meta_largo_plazo }\n else\n format.html { render :edit }\n format.json { render json: @prospecto_meta_largo_plazo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipoveiculo.update(tipoveiculo_params)\n format.html { redirect_to @tipoveiculo, notice: 'Tipoveiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoveiculo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_aposta.update(tipo_aposta_params)\n format.html { redirect_to @tipo_aposta, notice: 'Tipo aposta was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_aposta }\n else\n format.html { render :edit }\n format.json { render json: @tipo_aposta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fotos_empresa.update(fotos_empresa_params)\n format.html { redirect_to @fotos_empresa, notice: 'Fotos empresa was successfully updated.' }\n format.json { render :show, status: :ok, location: @fotos_empresa }\n else\n format.html { render :edit }\n format.json { render json: @fotos_empresa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ponte.update(ponte_params)\n format.html { redirect_to pontes_url, notice: 'Ponte atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @ponte }\n else\n format.html { render :edit }\n format.json { render json: @ponte.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n retorno = {erro: \"322\" ,body: \"\"}\n if @usuario.update(valid_request?)\n retorno = {erro: \"000\", body: {evento_id: @usuario.id, usuario_nome: @usuario.nome}}\n end\n render json: retorno.to_json\n end",
"def update\n authorize! :update, Tipo\n respond_to do |format|\n if @tipo.update(tipo_params)\n log(\"Se ha editado la nomina #{@lt}\", 1)\n format.html { redirect_to tipos_path, notice: 'Los datos de la nómina fueron actualizados exitosamente.' }\n format.json { head :no_content }\n end\n end\n end",
"def update\n @tipomedalla = Tipomedalla.find(params[:id])\n\n respond_to do |format|\n if @tipomedalla.update_attributes(params[:tipomedalla])\n format.html { redirect_to @tipomedalla, notice: 'Tipomedalla was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipomedalla.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @resto.update(resto_params)\n format.html { redirect_to @resto, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @resto }\n else\n format.html { render :edit }\n format.json { render json: @resto.errors, status: :unprocessable_entity }\n end\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 flash[:notice] = 'Pessoa was successfully updated.'\n format.html { redirect_to(@pessoa) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pessoa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ejemplo.update(ejemplo_params)\n format.html { redirect_to @ejemplo, notice: 'Ejemplo was successfully updated.' }\n format.json { render :show, status: :ok, location: @ejemplo }\n else\n format.html { render :edit }\n format.json { render json: @ejemplo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @suceso_perro.update(suceso_perro_params)\n format.html { redirect_to @suceso_perro, notice: 'Suceso perro was successfully updated.' }\n format.json { render :show, status: :ok, location: @suceso_perro }\n else\n format.html { render :edit }\n format.json { render json: @suceso_perro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @servico.update(servico_params)\n format.html { redirect_to servicos_url, notice: 'Serviço atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @servico }\n else\n format.html { render :edit }\n format.json { render json: @servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @perro.update(perro_params)\n format.html { redirect_to perros_url, notice: 'Perro Actualizado.' }\n format.json { render :show, status: :ok, location: @perro }\n else\n format.html { render :edit }\n format.json { render json: @perro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prato.update(prato_params)\n format.html { redirect_to @prato, notice: 'prato atualizado.' }\n format.json { render :show, status: :ok, location: @prato }\n else\n format.html { render :edit }\n format.json { render json: @prato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n if @paciente.update_attributes(params[:paciente])\n format.html { redirect_to @paciente, notice: 'Paciente atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @painel.update(painel_params)\n format.html { redirect_to @painel, notice: 'Painel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @painel.errors, status: :unprocessable_entity }\n end\n end\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 @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 @problema.update(problema_params)\n format.html { redirect_to @problema, notice: 'Problema was successfully updated.' }\n format.json { render :show, status: :ok, location: @problema }\n else\n format.html { render :edit }\n format.json { render json: @problema.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @respuesta = Respuesta.find(params[:id])\n\n respond_to do |format|\n if @respuesta.update_attributes(params[:respuesta])\n format.html { redirect_to @respuesta, notice: 'Respuesta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @respuesta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cooperativa = Cooperativa.find(params[:id])\n\n respond_to do |format|\n if @cooperativa.update_attributes(params[:cooperativa])\n format.html { redirect_to [:admin, @cooperativa], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @cooperativa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prace_polozka.update(prace_polozka_params)\n format.html { redirect_to @prace_polozka, notice: 'Zaznam byl zmenen.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prace_polozka.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @seguro = Seguro.find(params[:id])\n\n respond_to do |format|\n if @seguro.update_attributes(params[:seguro])\n format.html { redirect_to @seguro, notice: 'Seguro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @seguro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @inventario_cosa.update(inventario_cosa_params)\n format.html { redirect_to @inventario_cosa, notice: 'Inventario cosa was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventario_cosa }\n else\n format.html { render :edit }\n format.json { render json: @inventario_cosa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @asiento_de_servicio.update(asiento_de_servicio_params)\n format.html { redirect_to @asiento_de_servicio, notice: 'Asiento de servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @asiento_de_servicio }\n else\n format.html { render :edit }\n format.json { render json: @asiento_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_de_servicio.update(tipo_de_servicio_params)\n format.html { redirect_to @tipo_de_servicio, notice: 'Tipo de servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_de_servicio }\n else\n format.html { render :edit }\n format.json { render json: @tipo_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @propose = Propose.find(params[:id])\n\n respond_to do |format|\n if @propose.update_attributes(params[:propose])\n format.html { redirect_to @propose, notice: 'Propuesta actualizada' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @propose.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @papel.update(papel_params)\n format.html { redirect_to @papel, notice: 'Papel foi atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @papel }\n else\n format.html { render :edit }\n format.json { render json: @papel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @repuesto.update(repuesto_params)\n format.html { redirect_to @repuesto, notice: 'Repuesto was successfully updated.' }\n format.json { render :show, status: :ok, location: @repuesto }\n else\n format.html { render :edit }\n format.json { render json: @repuesto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pedidos_has_prato.update(pedidos_has_prato_params)\n format.html { redirect_to @pedidos_has_prato, notice: 'Pedidos has prato was successfully updated.' }\n format.json { render :show, status: :ok, location: @pedidos_has_prato }\n else\n format.html { render :edit }\n format.json { render json: @pedidos_has_prato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n if @peso.update_attributes(params[:peso])\n flash[:notice] = 'Peso was successfully updated.'\n format.html { redirect_to(@peso) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @peso.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @peliculass.update(peliculass_params)\n format.html { redirect_to @peliculass, notice: 'Peliculass was successfully updated.' }\n format.json { render :show, status: :ok, location: @peliculass }\n else\n format.html { render :edit }\n format.json { render json: @peliculass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(etiqueta_params)\n format.html { redirect_to @objeto, notice: 'Etiqueta was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profilsekolah.update(profilsekolah_params)\n format.html { redirect_to @profilsekolah, notice: 'Profilsekolah was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profilsekolah.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @resa.update(resa_params)\n format.html { redirect_to edit_resa_path(@resa), notice: 'Resa was successfully updated.' }\n format.json { render json: @resa, status: :accepted }\n\n else\n format.html { render action: 'edit' }\n format.json { render json: @resa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @parlo.update(parlo_params)\n format.html { redirect_to @parlo, notice: 'Parlo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @parlo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @puesto.update(puesto_params)\n format.html { redirect_to @puesto, notice: 'Puesto Actualizado.' }\n format.json { render :show, status: :ok, location: @puesto }\n else\n format.html { render :edit }\n format.json { render json: @puesto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipoenvolvido.update(tipoenvolvido_params)\n format.html { redirect_to @tipoenvolvido, notice: 'Tipoenvolvido was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoenvolvido.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @puisi.update(puisi_params)\n format.html { redirect_to @puisi, notice: 'Puisi was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @puisi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @repuesto_servicio.update(repuesto_servicio_params)\n format.html { redirect_to @repuesto_servicio, notice: 'Repuesto o servicio fue actualizado con éxito.' }\n format.json { render :show, status: :ok, location: @repuesto_servicio }\n else\n format.html { render :edit }\n format.json { render json: @repuesto_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @propuesta.update(propuesta_params)\n format.html { redirect_to @propuesta, notice: 'Propuesta was successfully updated.' }\n format.json { render :show, status: :ok, location: @propuesta }\n else\n format.html { render :edit }\n format.json { render json: @propuesta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pessoa_receber = PessoaReceber.find(params[:id])\n\n respond_to do |format|\n if @pessoa_receber.update_attributes(params[:pessoa_receber])\n format.html { redirect_to @pessoa_receber, :notice => 'Pessoa receber was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @pessoa_receber.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @copropietario.update(copropietario_params)\n format.html { redirect_to @copropietario, notice: 'Copropietario was successfully updated.' }\n format.json { render :show, status: :ok, location: @copropietario }\n else\n format.html { render :edit }\n format.json { render json: @copropietario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pregoestitulosgrafico.update(pregoestitulosgrafico_params)\n format.html { redirect_to @pregoestitulosgrafico, notice: 'Pregoestitulosgrafico was successfully updated.' }\n format.json { render :show, status: :ok, location: @pregoestitulosgrafico }\n else\n format.html { render :edit }\n format.json { render json: @pregoestitulosgrafico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ingresso.update(ingresso_params)\n format.html { redirect_to @ingresso, notice: 'Ingresso was successfully updated.' }\n format.json { render :show, status: :ok, location: @ingresso }\n else\n format.html { render :edit }\n format.json { render json: @ingresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ocorrencia.update(ocorrencia_params)\n format.html { redirect_to @ocorrencia, notice: 'Ocorrencia was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ocorrencia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend"
] | [
"0.69056123",
"0.6770499",
"0.6701876",
"0.66376215",
"0.6611621",
"0.6592055",
"0.6566299",
"0.6496665",
"0.6478969",
"0.64550555",
"0.64524204",
"0.6430414",
"0.6430275",
"0.64165235",
"0.6402418",
"0.63850635",
"0.6384151",
"0.6380684",
"0.63727236",
"0.63695145",
"0.63663864",
"0.6361268",
"0.6359674",
"0.63522786",
"0.63438493",
"0.63388866",
"0.6325045",
"0.6324102",
"0.6321741",
"0.6320835",
"0.6315548",
"0.6305409",
"0.63047653",
"0.63047653",
"0.629361",
"0.6292378",
"0.62916666",
"0.62841207",
"0.6275127",
"0.6275081",
"0.62715423",
"0.6263503",
"0.6258958",
"0.6256976",
"0.6253113",
"0.62492335",
"0.62330574",
"0.6230109",
"0.6229973",
"0.62273246",
"0.622669",
"0.62241375",
"0.6220564",
"0.62177837",
"0.6216917",
"0.621219",
"0.6210364",
"0.6209761",
"0.6208686",
"0.62032026",
"0.62016416",
"0.62005836",
"0.62002534",
"0.6197582",
"0.6194671",
"0.6185584",
"0.61809057",
"0.61790746",
"0.61783725",
"0.61783725",
"0.61767393",
"0.61737823",
"0.61737573",
"0.617253",
"0.6172521",
"0.6171216",
"0.616565",
"0.61641514",
"0.6161031",
"0.61578256",
"0.61575574",
"0.61575454",
"0.6157515",
"0.61569667",
"0.6155835",
"0.61547774",
"0.6154125",
"0.61539805",
"0.61537516",
"0.6150513",
"0.6146427",
"0.61456066",
"0.61451364",
"0.61436665",
"0.61418664",
"0.6141158",
"0.61410946",
"0.61402357",
"0.6139213",
"0.6137533"
] | 0.6745924 | 2 |
DELETE /pessoas/1 DELETE /pessoas/1.json | def destroy
@pessoa.destroy
respond_to do |format|
format.html { redirect_to pessoas_url, notice: 'Registro deletado com sucesso!.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @pessoa = Pessoa.find(params[:id])\n @pessoa.destroy\n\n respond_to do |format|\n format.html { redirect_to pessoas_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 @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @peso = Peso.find(params[:id])\n @peso.destroy\n\n respond_to do |format|\n format.html { redirect_to pesos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @servico_pacote.destroy\n respond_to do |format|\n format.html { redirect_to servico_pacotes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipoapreensao.destroy\n respond_to do |format|\n format.html { redirect_to tipoapreensoes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n respond_to do |format|\n format.html { redirect_to respuestas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ocorrencia.destroy\n respond_to do |format|\n format.html { redirect_to ocorrencias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @puntaje = Puntaje.find(params[:id])\n @puntaje.destroy\n\n respond_to do |format|\n format.html { redirect_to puntajes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @sivic_pessoa.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_pessoas_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @asiento = Asiento.find(params[:id])\n @asiento.destroy\n\n respond_to do |format|\n format.html { redirect_to asientos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @peso.destroy\n respond_to do |format|\n format.html { redirect_to pesos_url, notice: 'Peso was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @soatseguro.destroy\n respond_to do |format|\n format.html { redirect_to soatseguros_url, notice: 'Soatseguro was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @veiculo = Veiculo.find(params[:id])\n @veiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to veiculos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cargo_eleicao = CargoEleicao.find(params[:id])\n @cargo_eleicao.destroy\n\n respond_to do |format|\n format.html { redirect_to cargo_eleicaos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @paciente = Paciente.find(params[:id])\n @paciente.destroy\n\n respond_to do |format|\n format.html { redirect_to paciente_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @selecao = Selecao.find(params[:id])\n @selecao.destroy\n\n respond_to do |format|\n format.html { redirect_to selecaos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @soiree = Soiree.find(params[:id])\n @soiree.destroy\n\n respond_to do |format|\n format.html { redirect_to soirees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipoveiculo.destroy\n respond_to do |format|\n format.html { redirect_to tipoveiculos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @parola.destroy\n respond_to do |format|\n format.html { redirect_to parolas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @servicio = Servicio.find(params[:id])\n @servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to servicios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @seguidore = Seguidore.find(params[:id])\n @seguidore.destroy\n\n respond_to do |format|\n format.html { redirect_to seguidores_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @escola = Escola.find(params[:id])\n @escola.destroy\n\n respond_to do |format|\n format.html { redirect_to escolas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @puesto.destroy\n respond_to do |format|\n format.html { redirect_to puestos_url, notice: 'Puesto Eliminado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estatuto = Estatuto.find(params[:id])\n @estatuto.destroy\n\n respond_to do |format|\n format.html { redirect_to estatutos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asociado = Asociado.find(params[:id])\n @asociado.destroy\n\n respond_to do |format|\n format.html { redirect_to asociados_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @sezione = Sezione.find(params[:id])\n @sezione.destroy\n\n respond_to do |format|\n format.html { redirect_to sezioni_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pessoa = Pessoa.find(params[:id])\n @pessoa.destroy\n\n respond_to do |format|\n format.html { redirect_to(pessoas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end",
"def destroy\n @sugerencia = Sugerencia.find(params[:id])\n @sugerencia.destroy\n\n respond_to do |format|\n format.html { redirect_to sugerencias_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @seguro = Seguro.find(params[:id])\n @seguro.destroy\n\n respond_to do |format|\n format.html { redirect_to seguros_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @opcao.destroy\n respond_to do |format|\n format.html { redirect_to opcaos_url, notice: 'Opção Apagada com sucesso!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #--ADICIONADO\n @cliente.perfilclientes.destroy\n #--ADICIONADO\n @cliente.destroy\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @antropo.destroy\n respond_to do |format|\n format.html { redirect_to antropos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @atracao = Atracao.find(params[:id])\n @atracao.destroy\n\n respond_to do |format|\n format.html { redirect_to atracaos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @puisi.destroy\n respond_to do |format|\n format.html { redirect_to puisis_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @odontologia1 = Odontologia1.find(params[:id])\n @odontologia1.destroy\n\n respond_to do |format|\n format.html { redirect_to odontologia1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @padrao.destroy\n respond_to do |format|\n format.html { redirect_to padraos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pedido.destroy\n respond_to do |format|\n format.html { redirect_to pedidos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @detalle_ot_presupuesto.destroy\n respond_to do |format|\n format.html { redirect_to detalle_ot_presupuestos_url, notice: 'Detalle ot presupuesto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @reconocimiento = Reconocimiento.find(params[:id])\n @reconocimiento.destroy\n\n respond_to do |format|\n format.html { redirect_to reconocimientos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @presenza = Presenza.find(params[:id])\n @presenza.destroy\n\n respond_to do |format|\n format.html { redirect_to presenze_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_aposta.destroy\n respond_to do |format|\n format.html { redirect_to tipo_apostas_url, notice: 'Tipo aposta was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @piiza_id.destroy\n respond_to do |format|\n format.html { redirect_to piiza_ids_url, notice: 'Piiza was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to datos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fulcliente = Fulcliente.find(params[:id])\n @fulcliente.destroy\n\n respond_to do |format|\n format.html { redirect_to fulclientes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @suceso_perro.destroy\n respond_to do |format|\n format.html { redirect_to suceso_perros_url, notice: 'Suceso perro was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datos_insumos_reactivo.destroy\n respond_to do |format|\n format.html { redirect_to datos_insumos_reactivos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @paciente = Paciente.find(params[:id])\n @paciente.destroy\n\n respond_to do |format|\n format.html { redirect_to pacientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @presupuestooo.destroy\n respond_to do |format|\n format.html { redirect_to presupuestooos_url, notice: 'Presupuesto Eliminado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @placa.destroy\n respond_to do |format|\n format.html { redirect_to placas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @precio_boleto.destroy\n respond_to do |format|\n format.html { redirect_to precio_boletos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asiento_de_servicio.destroy\n respond_to do |format|\n format.html { redirect_to asiento_de_servicios_url, notice: 'Asiento de servicio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resa.destroy\n respond_to do |format|\n format.html { redirect_to resas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clientepedido = Clientepedido.find(params[:id])\n @clientepedido.destroy\n\n respond_to do |format|\n format.html { redirect_to clientepedidos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datos_de_pasaje.destroy\n respond_to do |format|\n format.html { redirect_to datos_de_pasajes_url, notice: 'Datos de pasaje was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ativo_outro = AtivoOutro.find(params[:id])\n @ativo_outro.destroy\n\n respond_to do |format|\n format.html { redirect_to ativo_outros_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @painel.destroy\n respond_to do |format|\n format.html { redirect_to painels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ejemplo.destroy\n respond_to do |format|\n format.html { redirect_to ejemplos_url, notice: 'Ejemplo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipoenvolvido.destroy\n respond_to do |format|\n format.html { redirect_to tipoenvolvidos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asana.destroy\n respond_to do |format|\n format.html { redirect_to asanas_url, notice: 'Asana excluído com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @anteproyecto_observacion.destroy\n respond_to do |format|\n format.html { redirect_to anteproyecto_observaciones_url, notice: 'Anteproyecto observacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tapioca.destroy\n respond_to do |format|\n format.html { redirect_to tapiocas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @poligono.destroy\n respond_to do |format|\n format.html { redirect_to poligonos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @anteproyecto_estudiante.destroy\n respond_to do |format|\n format.html { redirect_to anteproyecto_estudiantes_url, notice: 'Anteproyecto estudiante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datosgenerale.destroy\n respond_to do |format|\n format.html { redirect_to datosgenerales_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @soiree.destroy\n respond_to do |format|\n format.html { redirect_to soirees_url, notice: 'Votre évènement a bien été supprimé.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_pensum = TipoPensum.find(params[:id])\n @tipo_pensum.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_pensums_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n checar_egresso_super\r\n @egresso.destroy\r\n respond_to do |format|\r\n format.html { redirect_to egressos_url, notice: 'Egresso excluído com sucesso.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @peso = Peso.find(params[:id])\n @peso.destroy\n\n respond_to do |format|\n format.html { redirect_to(pesos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @fotos_empresa.destroy\n respond_to do |format|\n format.html { redirect_to fotos_empresas_url, notice: 'Fotos empresa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_de_imposto.destroy\n respond_to do |format|\n format.html { redirect_to @empresa, notice: 'Tipo de imposto removido com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def delete\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.find(params[:id])\n @aviso.destroy\n\n respond_to do |format|\n format.html { redirect_to avisos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @papel.destroy\n respond_to do |format|\n format.html { redirect_to papels_url, notice: 'Papel foi excluido com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @safra_verdoso = SafraVerdoso.find(params[:id])\n @safra_verdoso.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n end\n end",
"def destroy\n @pessoacondominio.destroy\n respond_to do |format|\n format.html { redirect_to pessoacondominios_url, notice: 'Pessoa deletada com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @perfilnegocio = Perfilnegocio.find(params[:id])\n @perfilnegocio.destroy\n\n respond_to do |format|\n format.html { redirect_to perfilnegocios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prepagada = Prepagada.find(params[:id])\n @prepagada.destroy\n\n respond_to do |format|\n format.html { redirect_to prepagadas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sistema = Sistema.find(params[:id])\n @sistema.destroy\n\n respond_to do |format|\n format.html { redirect_to sistemas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n head :no_content\n end",
"def destroy\n @nota_tecnica.destroy\n respond_to do |format|\n format.html { redirect_to nota_tecnicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventario_cosa.destroy\n respond_to do |format|\n format.html { redirect_to inventario_cosas_url, notice: 'Inventario cosa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n @lancamentorapido = Lancamentorapido.find(params[:id])\n @lancamentorapido.destroy \n\n respond_to do |format|\n format.html { redirect_to lancamentorapidos_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @precio_paquete.destroy\n respond_to do |format|\n format.html { redirect_to precio_paquetes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ventas_presupuesto = Ventas::Presupuesto.find(params[:id])\n @ventas_presupuesto.destroy\n\n respond_to do |format|\n format.html { redirect_to ventas_presupuestos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @apolice.destroy\n respond_to do |format|\n format.html { redirect_to apolices_url, notice: 'Registro deletado com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente.destroy\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @poto.destroy\n respond_to do |format|\n format.html { redirect_to potos_url, notice: 'Poto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @premio = Premio.find(params[:id])\n @premio.destroy\n\n respond_to do |format|\n format.html { redirect_to premios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @premio = Premio.find(params[:id])\n @premio.destroy\n\n respond_to do |format|\n format.html { redirect_to premios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pagamento = Pagamento.find(params[:id])\n os = @pagamento.os\n @pagamento.destroy\n\n respond_to do |format|\n #format.html { redirect_to pagamentos_url }\n format.html { redirect_to os }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sintoma.destroy\n respond_to do |format|\n format.html { redirect_to sintomas_url, notice: 'Sintoma was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @suplente = Suplente.find(params[:id])\n @suplente.destroy\n\n respond_to do |format|\n format.html { redirect_to suplentes_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.75959617",
"0.7577778",
"0.7525122",
"0.74744433",
"0.7373033",
"0.7326529",
"0.73216206",
"0.73159456",
"0.73159456",
"0.7297888",
"0.72847253",
"0.7280789",
"0.72759295",
"0.726857",
"0.7226427",
"0.72175115",
"0.72116655",
"0.72099775",
"0.71974933",
"0.71956444",
"0.71920305",
"0.7190138",
"0.71897465",
"0.7189646",
"0.71837276",
"0.71830446",
"0.71801",
"0.7179163",
"0.71790713",
"0.71786416",
"0.7177234",
"0.7171108",
"0.7170663",
"0.7170362",
"0.71667683",
"0.71645784",
"0.71626467",
"0.715695",
"0.71434546",
"0.71383536",
"0.7136611",
"0.7136597",
"0.7134534",
"0.7133264",
"0.7130595",
"0.71297127",
"0.7128441",
"0.71264577",
"0.71254057",
"0.71237355",
"0.7123718",
"0.7122911",
"0.7119537",
"0.7118395",
"0.7117881",
"0.71157545",
"0.7114511",
"0.71143997",
"0.7113396",
"0.7111334",
"0.7110183",
"0.7110108",
"0.7109197",
"0.7108101",
"0.71072036",
"0.7105466",
"0.7105165",
"0.7104939",
"0.71042436",
"0.7104226",
"0.7104055",
"0.71011245",
"0.71007794",
"0.70990294",
"0.70966905",
"0.70962614",
"0.70958555",
"0.7094471",
"0.7094403",
"0.7094013",
"0.70915806",
"0.7091355",
"0.70887274",
"0.7085328",
"0.7084782",
"0.70838517",
"0.70831954",
"0.7082629",
"0.7081118",
"0.70800143",
"0.70789635",
"0.70789635",
"0.70789635",
"0.7078078",
"0.7077834",
"0.7077821",
"0.7077821",
"0.7077112",
"0.7075332",
"0.7075098"
] | 0.736696 | 5 |
Use callbacks to share common setup or constraints between actions. | def set_pessoa
@pessoa = Pessoa.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 pessoa_params
params.require(:pessoa).permit(:nome_primeiro, :nome_sobrenome, :cpf, :data_nascimento, :email, :sexo, :codigo_cliente, endereco_attributes: [:id, :endereco, :complemento, :desc_cep, :cidade_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def valid_params_request?; end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\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 ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\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 backend_user_params\n params.permit!\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def 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.6981273",
"0.6783789",
"0.67460483",
"0.6742222",
"0.67354137",
"0.65934366",
"0.65028495",
"0.6497783",
"0.64826745",
"0.6479415",
"0.6456823",
"0.6440081",
"0.63800216",
"0.6376521",
"0.636652",
"0.6319898",
"0.6300256",
"0.62994003",
"0.6293621",
"0.6292629",
"0.6291586",
"0.629103",
"0.6282451",
"0.6243152",
"0.62413",
"0.6219024",
"0.6213724",
"0.62103724",
"0.61945",
"0.61786324",
"0.61755824",
"0.6173267",
"0.6163613",
"0.6153058",
"0.61521065",
"0.6147508",
"0.61234015",
"0.61168665",
"0.6107466",
"0.6106177",
"0.6091159",
"0.60817343",
"0.6071238",
"0.6062299",
"0.6021663",
"0.60182893",
"0.6014239",
"0.6011563",
"0.60080767",
"0.60080767",
"0.60028875",
"0.60005623",
"0.59964156",
"0.5993086",
"0.5992319",
"0.5992299",
"0.59801805",
"0.59676576",
"0.59606016",
"0.595966",
"0.59591126",
"0.59589803",
"0.5954058",
"0.5953234",
"0.5944434",
"0.5940526",
"0.59376484",
"0.59376484",
"0.5935253",
"0.5930846",
"0.5926387",
"0.59256274",
"0.5917907",
"0.5910841",
"0.590886",
"0.59086543",
"0.59060425",
"0.58981544",
"0.5898102",
"0.5896809",
"0.5895416",
"0.58947027",
"0.58923644",
"0.5887903",
"0.58830196",
"0.5880581",
"0.5873854",
"0.58697754",
"0.5869004",
"0.58669055",
"0.5866886",
"0.58664906",
"0.5864619",
"0.58630043",
"0.5862495",
"0.5861368",
"0.5859712",
"0.5855544",
"0.58551925",
"0.5851284",
"0.5850602"
] | 0.0 | -1 |
def test_edit_set only works if there is a set to edit get '/sets/temp_set/edit' assert_equal 200, last_response.status assert_includes last_response.body, 'Save' assert_includes last_response.body, 'form' end | def test_public_sets
set_names = File.readlines('data/set_names.txt')
set_names.each_with_index do |name, index|
get "/sets/public/#{index}"
assert_equal 200, last_response.status
assert_includes last_response.body, name
assert_includes last_response.body, 'Study'
assert_includes last_response.body, 'table'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_should_get_edit\n get :edit, :id => 107\n assert_response :success\n end",
"def test_edit\n\n # Try editing without logging in.\n get(:edit, {:id => subsections( :subsection_01_1_1).id }, {})\n assert_redirected_to(:controller => 'user', :action => 'login')\n\n # Try editing from a non-Admin account.\n get(:edit, { :id => subsections(:subsection_01_1_1).id }, rich_designer_session)\n assert_redirected_to(:controller => 'tracker',\t:action => 'index')\n #assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n # Try editing from an Admin account\n get(:edit, { :id => subsections(:subsection_01_1_1).id }, cathy_admin_session)\n assert_response 200\n assert_equal(subsections(:subsection_01_1_1).id, assigns(:subsection).id)\n assert_raise(ActiveRecord::RecordNotFound) { post(:edit, :id => 32423423) }\n\n end",
"def test_edit\n #login_as(:john)\n #get :edit, :id => @first_id\n\n #assert_response :success\n #assert_template 'edit'\n\n #assert_not_nil assigns(:taverna_enactor)\n #assert assigns(:taverna_enactor).valid?\n \n assert true\n end",
"def test_should_get_edit\n get :edit, :id => 1\n assert_response :success\n assert_select \"h1\", \"Editing post\"\n assert_select \"form\" do\n assert_select(\"input[type=text][id=post_title][value=?]\", \"MyString\")\n assert_select(\"textarea[id=post_body]\", \"MyText\")\n end\n end",
"def test_edit\n \n # Try editing from an Admin account\n admin_session = cathy_admin_session\n \n post(:edit,\n { :id => design_directories(:hw_design_ah).id },\n admin_session)\n assert_response 200\n assert_equal(design_directories(:hw_design_ah).name, \n assigns(:design_directory).name)\n\n assert_raise(ActiveRecord::RecordNotFound) {\n post( :edit, {:id => 1000000 }, admin_session)\n }\n\n end",
"def test_should_get_edit\n login_as(:john)\n get :edit, :id => 1\n assert_response :redirect\n end",
"def test_should_get_edit\n login_as(:john)\n get :edit, :id => 1\n assert_response :redirect\n end",
"def update\n @test_set = TestSet.find(params[:id])\n permitted_to! :update, @test_set.problem\n respond_to do |format|\n if @test_set.update_attributes(permitted_params)\n format.html { redirect_to @test_set, :notice => 'Test set was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @test_set.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_setviewer \n set = ResourceSet.new('SemanticExpression.new().spo(\\'<http://www.w3.org/2000/01/rdf-schema#Class>\\',\\'<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>\\',\\'<http://www.w3.org/2000/01/rdf-schema#Class>\\')') \n value ='self.localname'\n post :setviewer, :setid => set.rsid, :value => value #do the request passing the adapter's object_id \n resource = set.resources[0] \n assert_equal resource.explorator::view, value #assert that the view was set.\n assert_response :success #assert that the request was executed successful\n end",
"def test_should_get_edit\n # login_as :user_986324922\n # get :edit, :id => jobs(:one).id\n # assert_response :success\n end",
"def test_edit\n\n # Try editing without logging in.\n check_05 = checks(:check_05)\n \n get(:edit, { :id => check_05.id }, {})\n assert_redirected_to(:controller => 'user', :action => 'login')\n\n # Try editing from a non-Admin account.\n get(:edit, { :id => check_05.id }, rich_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n #assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n # Try editing from an Admin account\n admin_session = cathy_admin_session\n get(:edit, { :id => check_05.id }, admin_session)\n assert_response 200\n assert_equal(check_05.id, assigns(:check).id)\n\n assert_raise(ActiveRecord::RecordNotFound) {\n get(:edit, { :id => 32423423 }, admin_session)\n }\n end",
"def test_user_can_edit_project\n login_as(:can_edit)\n get :show, :id=>projects(:three)\n assert_select \"a\",:text=>/Edit Project/,:count=>1\n assert_select \"a\",:text=>/\\[Change\\]/,:count=>1\n\n get :edit, :id=>projects(:three)\n assert_response :success\n\n put :update, :id=>projects(:three).id,:project=>{}\n assert_redirected_to project_path(assigns(:project))\n end",
"def test_edit\n get :edit\n assert_response :success\n assert_template 'frontend/password_reset_requests/new'\n \n # @user\n user = assigns(:user)\n assert_nil user\n \n user = frontend_user_for_login\n user.reset_perishable_token!\n get :edit, :id => user.perishable_token\n assert_response :success\n assert_template 'frontend/password_reset_requests/edit'\n \n # @user\n user = assigns(:user)\n assert_not_nil user\n \n assert_select 'head' do\n assert_select 'title', 'example.com - Neues Passwort speichern'\n end\n assert_select 'body' do\n assert_select 'form input[type=hidden][name=id]', true\n assert_select \"form input[type=password][name='frontend_user[password]']\", true\n assert_select \"form input[type=password][name='frontend_user[password_confirmation]']\", true\n end\n \n # @current_user\n current_user = assigns(:current_user)\n assert_nil current_user\n \n # @current_user_session\n current_user_session = assigns(:current_user_session)\n assert_nil current_user_session\n \n # redirection if logged in\n frontend_user_log_on\n \n get :edit, :id => user.perishable_token\n assert_response :redirect\n assert_redirected_to url_for(:controller => 'frontend/community/users', :action => 'account', :namespace => nil, :subdomains => ['www'])\n end",
"def test_should_verify_root_can_edit_any_record\n\n assert @typus_user.is_root?\n\n Post.find(:all).each do |post|\n get :edit, { :id => post.id }\n assert_response :success\n assert_template 'edit'\n end\n\n end",
"def test_edit\n\n checklist_0_1 = checklists(:checklist_0_1)\n \n # Try editing without logging in.\n get(:edit, {:id => checklist_0_1.id}, {})\n assert_redirected_to(:controller => 'user',:action => 'login')\n\n # Try destroying from a non-Admin account.\n get(:edit, { :id => checklist_0_1.id }, rich_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n #assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n get(:edit, { :id => checklist_0_1.id }, cathy_admin_session)\n assert_response 200\n\n end",
"def test_show_add\n xhr :get, :show_add, :contract_id => @contract.id\n \n assert_template 'assignment/_assignment_form'\n end",
"def test_legal_edit_assignment\n @assignment = Assignment.first\n id = Assignment.first.id\n number_of_assignment = Assignment.count\n questionnaire_id = Questionnaire.first.id\n post :update, :id => id, :assignment=> { :name => 'updatedAssignment9',\n :review_questionnaire_id => questionnaire_id,\n :review_of_review_questionnaire_id => questionnaire_id,\n :author_feedback_questionnaire_id => questionnaire_id\n }\n\n assert_equal flash[:notice], 'Assignment was successfully updated.'\n\n assert_response :redirect\n assert_equal Assignment.count, number_of_assignment\n assert Assignment.find(:all, :conditions => \"name = 'updatedAssignment9'\")\n end",
"def test_edit_questionnaire\r\n post :edit, {:id => @Questionnaire, :save => true, \r\n :questionnaire => {:name => \"test edit name\", \r\n :type => \"ReviewQuestionnaire\",\r\n :min_question_score => 1,\r\n :max_question_score => 3}}\r\n assert_response(:success)\r\n assert_not_nil(Questionnaire.find(:first, :conditions => [\"name = ?\", \"test edit name\"]))\r\n end",
"def test_execute\n #Adds a set in the pool that will be removed later.\n set = ResourceSet.new('SemanticExpression.new().spo(\\'<http://www.w3.org/2000/01/rdf-schema#Class>\\',\\'<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>\\',\\'<http://www.w3.org/2000/01/rdf-schema#Class>\\')') \n #test refresh\n post :execute, :exp=> 'refresh(\\'' +set.rsid+ '\\')'\n assert @controller.resourceset.resources.size > 0 #assert that set was remove\n assert_response :success #assert that the request was executed successful\n #test remove \n post :execute, :exp=> 'remove(\\'' +set.rsid+ '\\')'\n assert Application.is_set?(set.rsid) #assert that set was remove\n assert_response :success #assert that the request was executed successful\n end",
"def test_illegal_edit_assignment\r\n\r\n id = Assignment.first.id\r\n @assignment = Assignment.first\r\n original_assignment_name = @assignment.name\r\n number_of_assignment = Assignment.count\r\n # It will raise an error while execute render method in controller\r\n # Because the goldberg variables didn't been initialized in the test framework\r\n assert_raise (ActionView::TemplateError){\r\n post :update, :id => id, :assignment=> { :name => '',\r\n :directory_path => \"admin/test1\",\r\n :review_questionnaire_id => 1,\r\n :review_of_review_questionnaire_id => 1,\r\n },\r\n :due_date => { \"1\" , { :resubmission_allowed_id =>1 ,\r\n :submission_allowed_id =>3,\r\n :review_of_review_allowed_id =>1,\r\n :review_allowed_id =>1,\r\n :due_at =>\"2007-07-10 15:00:00\",\r\n :rereview_allowed_id =>1\r\n }\r\n }\r\n }\r\n assert_template 'assignment/edit'\r\n assert_equal original_assignment_name, Assignment.first.name\r\n end",
"def scaffold_habtm_test(singular, many, id)\n action = \"edit_#{singular}_#{many}\", {:id=>id}\n assert_nothing_raised(\"Error requesting habtm scaffold #{action}\") do\n get action\n end\n assert_response :success, \"Response for habtm scaffold #{action} not :success\"\n end",
"def test_illegal_edit_assignment\n\n id = Assignment.first.id\n @assignment = Assignment.first\n original_assignment_name = @assignment.name\n number_of_assignment = Assignment.count\n # It will raise an error while execute render method in controller\n # Because the goldberg variables didn't been initialized in the test framework\n assert_raise (ActionView::TemplateError){\n post :update, :id => id, :assignment=> { :name => '',\n :directory_path => \"admin/test1\",\n :review_questionnaire_id => 1,\n :review_of_review_questionnaire_id => 1,\n },\n :due_date => { \"1\" , { :resubmission_allowed_id =>1 ,\n :submission_allowed_id =>3,\n :review_of_review_allowed_id =>1,\n :review_allowed_id =>1,\n :due_at =>\"2007-07-10 15:00:00\",\n :rereview_allowed_id =>1\n }\n }\n }\n assert_template 'assignment/edit'\n assert_equal original_assignment_name, Assignment.first.name\n end",
"def test_edit\n \n admin_session = cathy_admin_session\n \n # Try editing from an Admin account\n get(:edit, { :id => platforms(:panther).id }, admin_session)\n assert_response 200\n assert_equal(platforms(:panther).name, assigns(:platform).name)\n\n assert_raise(ActiveRecord::RecordNotFound) {\n get(:edit, { :id => 1000000 }, admin_session)\n }\n\n end",
"def test_edit\n\n stackup = document_types(:stackup)\n get(:edit, { :id => stackup.id }, cathy_admin_session)\n assert_equal(stackup.name, assigns(:document_type).name)\n \n end",
"def test_should_get_edit\n login_as(:normal_user)\n get :edit, :id => people(:normal_person)\n assert_response :success\n end",
"def test_update\n\n subsection_01_1_2 = subsections(:subsection_01_1_2)\n subsection_01_1_1 = subsections(:subsection_01_1_1)\n subsect = Subsection.find(subsection_01_1_2.id)\n assert_equal(subsection_01_1_1.url, subsect.url)\n\n subsect.url = 'www.yahoo.com'\n post(:update, { :subsection => subsect.attributes }, cathy_admin_session)\n assert_equal('Subsection was successfully updated.', flash['notice'])\n assert_redirected_to(:controller => 'checklist',\n\t\t\t :action => 'edit',\n :id => subsection_01_1_1.checklist.id)\n\n end",
"def test_insert\n\n # Try editing without logging in.\n put(:insert, {}, {})\n assert_redirected_to(:controller => 'user', :action => 'login')\n\n # Try editing from a non-Admin account.\n put :insert, {}, rich_designer_session\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n #assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n # Try editing from an Admin account\n check_04 = checks(:check_04)\n put(:insert, { :id => check_04.id }, cathy_admin_session)\n assert_response 200\n assert_equal(check_04.subsection_id, assigns(:new_check).subsection_id)\n assert_equal(check_04.check_type, assigns(:new_check).check_type)\n\n end",
"def test_show\n login\n xhr :get, :show, :id => 2\n assert assigns(:group)\n assert_response :success\n assert_template('show')\n end",
"def test_create\n #create a new resourceset\n post :create, :exp=> 'SemanticExpression.new.union(:s,Namespace.lookup(:rdf,:type),Namespace.lookup(:rdfs,:Class))'\n assert @controller.resourceset.resources.size > 0 #assert that set was remove\n assert_response :success #assert that the request was executed successful\n \n end",
"def test_update\n set = ResourceSet.new('SemanticExpression.new().spo(\\'<http://www.w3.org/2000/01/rdf-schema#Class>\\',\\'<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>\\',\\'<http://www.w3.org/2000/01/rdf-schema#Class>\\')') \n size = set.resources.size\n #create a new resourceset. Note that the expression must return more resource than the first one.\n #we will check the number of resources to verify whether the set was updated.\n post :update, :exp => 'SemanticExpression.new.union(:s,Namespace.lookup(:rdf,:type),:o)', :id => set.rsid\n assert @controller.resourceset.resources.size > size #assert that set was remove\n assert_response :success #assert that the request was executed successful\nend",
"def test_edit_observation_get\n obs = observations(:coprinus_comatus_obs)\n assert_equal(\"rolf\", obs.user.login)\n params = { :id => obs.id.to_s }\n requires_user(:edit_observation, [\"observer\", \"show_observation\"], params)\n assert_form_action(:action => 'edit_observation', :id => obs.id.to_s)\n end",
"def test_user_can_edit_project\n\t\tlogin_as(:can_edit)\n\t\tget :show, :id=>projects(:three)\n\t\tassert_select \"a\",:text=>/Edit Project/,:count=>1\n\n\t\tget :edit, :id=>projects(:three)\n\t\tassert_response :success\n\n\t\tput :update, :id=>projects(:three).id,:project=>{}\n\t\tassert_redirected_to project_path(assigns(:project))\n\tend",
"def test_edit_without_user\n post(:edit, { :id => @cathy_m.id }, {})\n assert_redirected_to :action => \"login\"\n assert_equal(\"Please log in\", flash[:notice])\n end",
"def test_admin_can_edit_a_user\n \n #first create an admin\n ann_admin = setup_dummy_user('anneadmin')\n ann_admin.add_role('admin')\n ann_admin.save!\n \n # log ann_admin in\n get '/login' # need to do this to set up the form container.\n post '/login', { :username => 'anneadmin', :password => GOOD_PASSWORD }\n\n # ensure a request to edit and unknown ID is bounced.\n get \"/user/edit/153\"\n assert last_response.ok?\n assert last_response.body.include?(\"The user id supplied was not recognised\")\n\n # ensure a command to update an unknown ID is bounced.\n post \"/user/edit/153\"\n assert last_response.ok?\n assert last_response.body.include?(\"The user id supplied was not recognised\")\n\n # set up 2 dummy users\n george = setup_dummy_user(\"george\")\n mildred = setup_dummy_user(\"mildred\")\n \n # ensure we can bring up the edit screen for a user\n get \"/user/edit/#{george.id}\"\n assert last_response.ok?\n assert last_response.body.include?(george.username)\n assert last_response.body.include?(george.email)\n \n # check the mechanics of posting an update but change nothing just yet.\n pref = george.get_preference('HTML_EMAIL').value\n\n post \"/user/edit/#{george.id}\", { :email => george.email, :password => \"\", :_locale => george.locale,\n :html_email => pref, :roles => [''] }\n assert last_response.ok?\n assert last_response.body.include?(\"no changes\")\n \n # try changing george's html email preference only\n not_pref = pref == 'true' ? 'false' : 'true'\n get \"/user/edit/#{george.id}\" # to open the form\n post \"/user/edit/#{george.id}\", { :email => george.email, :password => \"\", :_locale => george.locale,\n :html_email => not_pref, :roles => [''] }\n assert last_response.ok?\n assert last_response.body.include?(\"User Details Saved\")\n assert not_pref == george.get_preference('HTML_EMAIL').value\n \n # try changing george's email to mildred's\n get \"/user/edit/#{george.id}\" # to open the form\n post \"/user/edit/#{george.id}\", { :email => mildred.email, :password => \"\", :_locale => george.locale,\n :html_email => pref, :roles => [''] }\n assert last_response.ok?\n assert last_response.body.include?(\"A user with email '#{mildred.email}' already exists\")\n\n # try changing george's email to something nice\n post \"/user/edit/#{george.id}\", { :email => \"[email protected]\", :password => \"\", :_locale => george.locale,\n :html_email => pref, :roles => [''] }\n assert last_response.ok?\n assert last_response.body.include?(\"User Details Saved\")\n george.reload\n assert george.email == '[email protected]'\n \n # try changing george's password and locale.\n get \"/user/edit/#{george.id}\" # to open the form\n post \"/user/edit/#{george.id}\", { :email => george.email, :password => \"newpassword\", :_locale => 'fr',\n :html_email => pref, :roles => [''] }\n assert last_response.ok?\n assert last_response.body.include?(\"User Details Saved\") # changing george's locale should not change the user's \n george.reload\n assert george.locale == 'fr'\n\n # make up a new role to give George that is not a superuser role.\n special_role_one = Role.create(:name => 'special-role-one')\n special_role_two = Role.create(:name => 'special-role-two')\n\n # try making george a 'special-role-one' and a 'user'.\n get \"/user/edit/#{george.id}\" # to open the form\n post \"/user/edit/#{george.id}\", { :email => george.email, :password => \"\", :_locale => george.locale,\n :html_email => pref, :roles => ['special-role-one','user'] }\n assert last_response.ok?\n assert last_response.body.include?(\"User Details Saved\") \n george.reload\n assert george.has_role?('special-role-one')\n assert george.has_role?('user')\n assert !george.has_role?('special-role-two')\n assert george.locale == 'fr'\n \n # try making george just a 'user'.\n get \"/user/edit/#{george.id}\" # to open the form\n post \"/user/edit/#{george.id}\", { :email => george.email, :password => \"\", :_locale => george.locale,\n :html_email => pref, :roles => ['user'] }\n assert last_response.ok?\n assert last_response.body.include?(\"User Details Saved\") \n george.reload\n assert !george.has_role?('special-role-one')\n assert george.has_role?('user')\n assert !george.has_role?('special-role-two')\n assert george.locale == 'fr'\n \n # now try making george an 'admin'\n get \"/user/edit/#{george.id}\" # to open the form\n post \"/user/edit/#{george.id}\", { :email => george.email, :password => \"\", :_locale => george.locale,\n :html_email => pref, :roles => ['admin'] }\n assert last_response.ok?\n assert last_response.body.include?(\"User Details Saved\") \n george.reload\n assert !george.has_role?('special-role-one')\n assert !george.has_role?('user')\n assert !george.has_role?('special-role-two')\n assert george.has_role?('admin')\n assert george.locale == 'fr'\n\n get '/logout'\n \n # try logging george in with his new password\n post '/login', { :username => george.username, :password => \"newpassword\" }\n assert last_response.body.include?('Vous avez ouvert une session comme') # we changed him to French.\n assert last_response.body.include?(george.username) \n assert last_response.body.include?('Utilisateurs de liste') # we made him an Admin\n \n # okay now let's test make mildred an admin and test that george can't edit mildred or root\n mildred.add_role('admin')\n mildred.save!\n \n pref = mildred.get_preference('HTML_EMAIL').value\n \n # try changing mildred's email to something nice will bounce.\n\n get \"/user/edit/#{mildred.id}\" # to open the form\n post \"/user/edit/#{mildred.id}\", { :email => \"[email protected]\", :password => \"\", :_locale => mildred.locale,\n :html_email => pref, :roles => [''] }\n assert last_response.ok? \n assert last_response.body.include?(\"Vous n'avez pas le droit d'éditer cet utilisateur\")\n \n get '/logout'\n assert last_response.ok?\n\n # next we test that root (a superuser) can edit mildred (an admin)\n post '/login', { :username => 'root', :password => GOOD_PASSWORD }\n assert last_response.ok?\n \n# require 'ruby-debug'\n# debugger\n\n # the edit will be to make mildred a superuser. Currently this is also something an admin can do to anyone but other admins.\n # TODO: This of course means a corrupt admin could create a fake user for another email address they own, with superuser access. \n # To close this loophole only superusers ought to be able to assign someone a superuser role.\n # admins may not assign anyone a superuser role.\n get \"/user/edit/#{mildred.id}\" # to open the form\n post \"/user/edit/#{mildred.id}\", { :email => \"[email protected]\", :password => \"\", :_locale => mildred.locale,\n :html_email => pref, :roles => ['admin', 'superuser'] }\n assert last_response.ok?\n assert last_response.body.include?('User Details Saved')\n \n # require 'ruby-debug'\n # debugger\n\n mildred.reload\n assert mildred.has_role?('admin')\n assert mildred.has_role?('superuser')\n assert mildred.email == '[email protected]'\n \n # finally we test that root can edit another superuser. So now that is a mildred a superuser root should edit her.\n # in this case change her email and remove her from the superuser role, but leave her as an admin.\n get \"/user/edit/#{mildred.id}\" # to open the form\n post \"/user/edit/#{mildred.id}\", { :email => \"[email protected]\", :password => \"\", :_locale => mildred.locale,\n :html_email => pref, :roles => ['admin'] }\n assert last_response.ok?\n assert last_response.body.include?('User Details Saved')\n mildred.reload\n assert mildred.has_role?('admin')\n assert !mildred.has_role?('superuser')\n assert mildred.email == '[email protected]'\n \n get '/logout'\n assert last_response.ok?\n \n # now finally test that mildred, as an admin, can't edit root, a superuser.\n root = User.find_by_username('root')\n post '/login', {:username => 'mildred', :password => GOOD_PASSWORD }\n assert last_response.ok?\n\n get \"/user/edit/#{root.id}\" # to open the form\n post \"/user/edit/#{root.id}\", { :email => \"[email protected]\", :password => \"\", :_locale => root.locale,\n :html_email => pref, :roles => ['admin','superuser'] }\n assert last_response.ok?\n\n assert last_response.body.include?('You do not have permission to edit that user')\n \n get '/logout'\n assert last_response.ok?\n\n \n \n # clean up database at the end of the test\n special_role_two.destroy\n special_role_one.destroy\n mildred.destroy\n george.destroy\n ann_admin.destroy\n end",
"def test_auth_to_edit\n\n @request.session[:return_to] = \"/bogus/location\"\n\n # Log in as a designer and try to edit a user record.\n post(:login,\n { :user_login => \"richm\", :user_password => \"designer\" },\n {})\n assert_equal('Login successful', flash['notice'])\n \n post(:edit, { :id => @cathy_m.id }, rich_designer_session)\n assert_redirected_to( :action => \"index\", :controller => \"tracker\" )\n #assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n # Log in as a manager and try to edit a user record.\n post(:login,\n { :user_login => \"jim_l\", :user_password => \"test\" },\n {})\n\n #assert_equal('Login successful', flash['notice'])\n \n post(:edit, { :id => @cathy_m.id }, jim_manager_session)\n assert_redirected_to( :action => \"index\", :controller => \"tracker\" )\n #assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n end",
"def test_edit\n\n merix = fab_houses(:merix)\n get(:edit, {:id => merix.id}, cathy_admin_session)\n assert_equal(merix.name, assigns(:fab_house).name)\n \n end",
"def test_edit_course_with_valid_title\r\n number_of_course = Course.count\r\n title = Course.find(1).title\r\n post :update_course,:id => 1, :course => { :title => 'Database'}\r\n assert_equal flash[:notice], 'Course was successfully updated.'\r\n assert_redirected_to :action => 'list_folders', :id =>1\r\n assert_equal Course.count, number_of_course\r\n assert Course.find(:all, :conditions => \"title = 'Database'\");\r\n assert_nil Course.find(:first, :conditions => \"title = '#{title}'\");\r\n end",
"def test_edit_observation_get\n obs = observations(:coprinus_comatus_obs)\n assert_equal(\"rolf\", obs.user.login)\n params = { :id => obs.id.to_s }\n requires_user(:edit_observation, [\"observer\", \"show_observation\"], params)\n assert_form_action(:action => 'edit_observation')\n end",
"def test_modify_checks\n\n subsection_01_1_1 = subsections(:subsection_01_1_1)\n\n # Try editing without logging in.\n @request.session[:user] = nil\n @request.session[:active_role] = nil\n @request.session[:roles] = nil\n \n put(:modify_checks, { :id => subsection_01_1_1.id }, {})\n assert_redirected_to(:controller => 'user', :action => 'login')\n assert_equal('Please log in', flash[:notice])\n\n # Try editing from an Admin account\n admin_session = cathy_admin_session\n put(:modify_checks, { :id => subsection_01_1_1.id }, admin_session)\n assert_response 200\n assert_equal(subsection_01_1_1.id, assigns(:subsection).id)\n \n # TODO:\n # Is there a better way to test than with hard code?\n # The only query I can think of is the same one that \n # is used in the method\n assert_equal(3, assigns(:checks).size)\n\n # Try with a subsection that has no checks.\n subsection_01_2_3 = subsections(:subsection_01_2_3)\n \n put(:modify_checks, { :id => subsection_01_2_3.id }, admin_session)\n assert_redirected_to(:action => 'add_first', :id => subsection_01_2_3.id)\n \n end",
"def test_appends\n\n # Try editing without logging in.\n put(:append, {}, {})\n assert_redirected_to(:controller => 'user', :action => 'login')\n\n # Try editing from a non-Admin account.\n post(:append, {}, rich_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n #assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n # Try editing from an Admin account\n post(:append, {:id => checks(:check_01).id}, cathy_admin_session)\n assert_response 200\n assert_equal(checks(:check_01).subsection_id, assigns(:new_check).subsection_id)\n assert_equal(checks(:check_01).check_type, assigns(:new_check).check_type)\n\n end",
"def test_add_set \n post :add_set, :id => 1\n assert_redirected_to :controller => :cart, :action => ''\n cart = get_anonymous_cart\n assert_equal(2, cart.cart_items.size)\n assert_equal(5, cart.cart_items.first.product.id)\n assert_equal(4, cart.cart_items.last.product.id)\n end",
"def test_should_show_list_root_if_invalid\n login_as :admin\n\n # Invalid name.\n get :list, :id => \"INVALID\"\n assert_response :success\n assert_template 'list'\n assert_equal assigns(:title), \"Manage Tags\"\n assert_not_nil assigns(:tags)\n assert_select \"div#flash\"\n end",
"def test_that_edit_requires_login\n assert_requires_login do |proxy|\n proxy.get :edit, :user_id => 11, :id => 1\n end\n end",
"def test_set_export_status\n name = names(:petigera)\n params = {\n :id => name.id,\n :type => 'name',\n :value => '1',\n }\n\n # Require login.\n get('set_export_status', params)\n assert_response(:controller => 'account', :action => 'login')\n\n # Require reviewer.\n login('dick')\n get('set_export_status', params)\n assert_flash_error\n logout\n\n # Require correct params.\n login('rolf')\n get('set_export_status', params.merge(:id => 9999))\n assert_flash_error\n get('set_export_status', params.merge(:type => 'bogus'))\n assert_flash_error\n get('set_export_status', params.merge(:value => 'true'))\n assert_flash_error\n\n # Now check *correct* usage.\n assert_equal(true, name.reload.ok_for_export)\n get('set_export_status', params.merge(:value => '0'))\n assert_response(:controller => 'name', :action => 'show_name', :id => name.id)\n assert_equal(false, name.reload.ok_for_export)\n get('set_export_status', params.merge(:value => '1'))\n assert_response(:controller => 'name', :action => 'show_name', :id => name.id)\n assert_equal(true, name.reload.ok_for_export)\n end",
"def test_set_export_status\n name = names(:petigera)\n params = {\n :id => name.id,\n :type => 'name',\n :value => '1',\n }\n\n # Require login.\n get('set_export_status', params)\n assert_response(:controller => 'account', :action => 'login')\n\n # Require reviewer.\n login('dick')\n get('set_export_status', params)\n assert_flash_error\n logout\n\n # Require correct params.\n login('rolf')\n get('set_export_status', params.merge(:id => 9999))\n assert_flash_error\n get('set_export_status', params.merge(:type => 'bogus'))\n assert_flash_error\n get('set_export_status', params.merge(:value => 'true'))\n assert_flash_error\n\n # Now check *correct* usage.\n assert_equal(true, name.reload.ok_for_export)\n get('set_export_status', params.merge(:value => '0'))\n assert_response(:controller => 'name', :action => 'show_name', :id => name.id)\n assert_equal(false, name.reload.ok_for_export)\n get('set_export_status', params.merge(:value => '1'))\n assert_response(:controller => 'name', :action => 'show_name', :id => name.id)\n assert_equal(true, name.reload.ok_for_export)\n end",
"def test_should_edit_with_clips\n login_as 'admin'\n get :edit, :board => 'ruby', :id => 3 \n assert_response :success\n assert_not_nil assigns(:post)\n end",
"def test_show_as_edit_as_specified_as_a_block\n @controller = SquirrelsController.new\n \n get \"show\", :id => @bob, :view => 'name_as_a_block' \n assert_equal(\"showing name\", @response.body)\n\n get \"edit\", :id => @bob, :view => 'name_as_a_block'\n assert_equal(\"editing name\", @response.body)\n end",
"def test_show\n #login_as(:john)\n #get :show, :id => @first_id\n\n #assert_response :success\n #assert_template 'show'\n\n #assert_not_nil assigns(:taverna_enactor)\n #assert assigns(:taverna_enactor).valid?\n \n assert true\n end",
"def test_admin_user_edit\n\n post(:login,\n { :user_login => \"cathy_m\", :user_password => \"test\"},\n {})\n assert_equal('Login successful', flash['notice'])\n \n post(:edit, { :id => @cathy_m.id }, cathy_admin_session)\n assert_template(\"user/edit\", \"Template should be 'user/edit'\")\n\n end",
"def test_update\n\n doc_one = document_types(:doc_one)\n document_type = DocumentType.find(doc_one.id)\n document_type.name = 'Test'\n\n get(:update, { :document_type => document_type.attributes }, cathy_admin_session)\n assert_equal('Update recorded', flash['notice'])\n assert_equal('Test', document_type.name)\n assert_redirected_to(:action => 'edit', :id => document_type.id)\n \n end",
"def test_update_valid\n #TODO: reenable this once we can figure out how to remove any_instance\n # Recipe.any_instance.stubs(:valid?).returns(true)\n put :update, :id => Factory.create(:recipe)\n assert_redirected_to recipe_url(assigns(:recipe))\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 test_update\r\n assert_equal \"review0\", @response.additional_comment\r\n @response.additional_comment = \"abcd\"\r\n @response.save\r\n @response.reload\r\n # verifying whether the update is done properly or not\r\n assert_equal @response.additional_comment, \"abcd\"\r\n end",
"def test_update\n\n post(:update, { :user => { :id => @rich_m.id } }, {})\n assert_redirected_to( :controller => 'tracker', :action => \"index\" )\n assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n assert_equal(2, @rich_m.roles.size)\n \n post(:update, \n { :user => { :id => @rich_m.id,\n :first_name => 'Richard',\n :last_name => 'Miller',\n :email => '' },\n :role => { '1' => '1',\n '2' => '1',\n '6' => '0',\n '9' => '1',\n '8' => '0' } },\n cathy_admin_session)\n\n assert_redirected_to(:controller => 'user',\n :action => 'edit',\n :id => @rich_m.id)\n #assert_equal('The user information for Richard Miller was updated',\n # flash['notice'])\n \n @rich_m.reload\n assert_equal(3, @rich_m.roles.size)\n\n end",
"def assert_valid_update_page(model, **opt)\n action = opt[:id] ? :edit : :edit_select\n assert_valid_action_page(model, action, **opt)\n end",
"def test_the_application_can_update_a_previous_item_title_on_our_to_do_list\n #Create an item to test\n #Send a PUT request to '/items/:id' that will update the item's title\n #Assert that the controller responds with a status of 200\n #Assert that the controller responds with a body of 'Item updated'\n #Assert that the item's title is the updated title and not the original title.\n end",
"def update\n @question_set = QuestionSet.find(params[:id])\n\n respond_to do |format|\n if @question_set.update_attributes(params[:question_set])\n format.html { redirect_to @question_set, notice: 'Question set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_add_first\n\n subsection_01_2_3 = subsections(:subsection_01_2_3)\n \n @request.session[:user] = nil\n @request.session[:active_role] = nil\n @request.session[:roles] = nil\n \n put(:add_first, { :id => subsection_01_2_3.id }, {})\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n put(:add_first, { :id => subsection_01_2_3.id }, cathy_admin_session)\n assert_response 200\n assert_equal(subsection_01_2_3.id, assigns(:new_check).subsection_id)\n assert_equal(subsection_01_2_3, assigns(:subsection))\n\n end",
"def test_designer_home\n\n post('index', {}, {})\n assert_response(:success)\n assert_template('tracker/index')\n\n post('index', {}, bob_designer_session)\n assert_response(:success)\n assert_template('tracker/designer_home')\n\n end",
"def test_startchangeset_invalid_wrong_user\n user = create(:user)\n user2 = create(:user)\n\n amf_content \"startchangeset\", \"/1\", [\"#{user.email}:test\", { \"source\" => \"new\" }, nil, \"new\", 1]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n cs_id = result[2].to_i\n\n assert_equal 3, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n\n cs = Changeset.find(cs_id)\n assert_equal true, cs.is_open?\n assert_equal({ \"comment\" => \"new\", \"source\" => \"new\" }, cs.tags)\n\n amf_content \"startchangeset\", \"/1\", [\"#{user2.email}:test\", {}, cs_id, \"delete\", 0]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 2, result.size\n assert_equal -2, result[0]\n assert_equal \"The user doesn't own that changeset\", result[1]\n\n cs = Changeset.find(cs_id)\n assert_equal true, cs.is_open?\n assert_equal({ \"comment\" => \"new\", \"source\" => \"new\" }, cs.tags)\n end",
"def test_edit_name_get\n name = names(:coprinus_comatus)\n params = { id: name.id.to_s }\n requires_login(:edit, params)\n assert_form_action(action: :update, id: name.id.to_s)\n assert_select(\"form #name_icn_id\", { count: 1 },\n \"Form is missing field for icn_id\")\n end",
"def test_should_get_new\n get :new\n assert_response :success\n assert_template \"new\"\n assert_select \"h1\", \"New post\"\n assert_select \"form\" do\n assert_select(\"input[type=text][id=post_title]\")\n assert_select(\"textarea[id=post_body]\")\n assert_select(\"input[type=checkbox][id=post_published]\")\n assert_select(\"input[type=submit][id=post_submit][value=Create]\")\n end\n end",
"def test_change_password\n\n post(:change_password, { :id => @rich_m.id }, {})\n assert_redirected_to( :controller => 'tracker', :action => \"index\" )\n assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n post(:change_password, { :id => @rich_m.id }, cathy_admin_session)\n\n assert_response 200\n assert(session['user_id'], \"User ID should be set\")\n assert_equal(@rich_m.last_name, assigns(:user).last_name)\n assert_template( \"change_password\", \"Template should be 'change_password'\")\n \n end",
"def test_update\n ## First test with no user credentials\n # try and update a node without authorisation\n # first try to delete node without auth\n private_user = create(:user, :data_public => false)\n private_node = create(:node, :changeset => create(:changeset, :user => private_user))\n user = create(:user)\n node = create(:node, :changeset => create(:changeset, :user => user))\n\n content node.to_xml\n put :update, :params => { :id => node.id }\n assert_response :unauthorized\n\n ## Second test with the private user\n\n # setup auth\n basic_authorization private_user.email, \"test\"\n\n ## trying to break changesets\n\n # try and update in someone else's changeset\n content update_changeset(private_node.to_xml,\n create(:changeset).id)\n put :update, :params => { :id => private_node.id }\n assert_require_public_data \"update with other user's changeset should be forbidden when data isn't public\"\n\n # try and update in a closed changeset\n content update_changeset(private_node.to_xml,\n create(:changeset, :closed, :user => private_user).id)\n put :update, :params => { :id => private_node.id }\n assert_require_public_data \"update with closed changeset should be forbidden, when data isn't public\"\n\n # try and update in a non-existant changeset\n content update_changeset(private_node.to_xml, 0)\n put :update, :params => { :id => private_node.id }\n assert_require_public_data \"update with changeset=0 should be forbidden, when data isn't public\"\n\n ## try and submit invalid updates\n content xml_attr_rewrite(private_node.to_xml, \"lat\", 91.0)\n put :update, :params => { :id => private_node.id }\n assert_require_public_data \"node at lat=91 should be forbidden, when data isn't public\"\n\n content xml_attr_rewrite(private_node.to_xml, \"lat\", -91.0)\n put :update, :params => { :id => private_node.id }\n assert_require_public_data \"node at lat=-91 should be forbidden, when data isn't public\"\n\n content xml_attr_rewrite(private_node.to_xml, \"lon\", 181.0)\n put :update, :params => { :id => private_node.id }\n assert_require_public_data \"node at lon=181 should be forbidden, when data isn't public\"\n\n content xml_attr_rewrite(private_node.to_xml, \"lon\", -181.0)\n put :update, :params => { :id => private_node.id }\n assert_require_public_data \"node at lon=-181 should be forbidden, when data isn't public\"\n\n ## finally, produce a good request which still won't work\n content private_node.to_xml\n put :update, :params => { :id => private_node.id }\n assert_require_public_data \"should have failed with a forbidden when data isn't public\"\n\n ## Finally test with the public user\n\n # try and update a node without authorisation\n # first try to update node without auth\n content node.to_xml\n put :update, :params => { :id => node.id }\n assert_response :forbidden\n\n # setup auth\n basic_authorization user.email, \"test\"\n\n ## trying to break changesets\n\n # try and update in someone else's changeset\n content update_changeset(node.to_xml,\n create(:changeset).id)\n put :update, :params => { :id => node.id }\n assert_response :conflict, \"update with other user's changeset should be rejected\"\n\n # try and update in a closed changeset\n content update_changeset(node.to_xml,\n create(:changeset, :closed, :user => user).id)\n put :update, :params => { :id => node.id }\n assert_response :conflict, \"update with closed changeset should be rejected\"\n\n # try and update in a non-existant changeset\n content update_changeset(node.to_xml, 0)\n put :update, :params => { :id => node.id }\n assert_response :conflict, \"update with changeset=0 should be rejected\"\n\n ## try and submit invalid updates\n content xml_attr_rewrite(node.to_xml, \"lat\", 91.0)\n put :update, :params => { :id => node.id }\n assert_response :bad_request, \"node at lat=91 should be rejected\"\n\n content xml_attr_rewrite(node.to_xml, \"lat\", -91.0)\n put :update, :params => { :id => node.id }\n assert_response :bad_request, \"node at lat=-91 should be rejected\"\n\n content xml_attr_rewrite(node.to_xml, \"lon\", 181.0)\n put :update, :params => { :id => node.id }\n assert_response :bad_request, \"node at lon=181 should be rejected\"\n\n content xml_attr_rewrite(node.to_xml, \"lon\", -181.0)\n put :update, :params => { :id => node.id }\n assert_response :bad_request, \"node at lon=-181 should be rejected\"\n\n ## next, attack the versioning\n current_node_version = node.version\n\n # try and submit a version behind\n content xml_attr_rewrite(node.to_xml,\n \"version\", current_node_version - 1)\n put :update, :params => { :id => node.id }\n assert_response :conflict, \"should have failed on old version number\"\n\n # try and submit a version ahead\n content xml_attr_rewrite(node.to_xml,\n \"version\", current_node_version + 1)\n put :update, :params => { :id => node.id }\n assert_response :conflict, \"should have failed on skipped version number\"\n\n # try and submit total crap in the version field\n content xml_attr_rewrite(node.to_xml,\n \"version\", \"p1r4t3s!\")\n put :update, :params => { :id => node.id }\n assert_response :conflict,\n \"should not be able to put 'p1r4at3s!' in the version field\"\n\n ## try an update with the wrong ID\n content create(:node).to_xml\n put :update, :params => { :id => node.id }\n assert_response :bad_request,\n \"should not be able to update a node with a different ID from the XML\"\n\n ## try an update with a minimal valid XML doc which isn't a well-formed OSM doc.\n content \"<update/>\"\n put :update, :params => { :id => node.id }\n assert_response :bad_request,\n \"should not be able to update a node with non-OSM XML doc.\"\n\n ## finally, produce a good request which should work\n content node.to_xml\n put :update, :params => { :id => node.id }\n assert_response :success, \"a valid update request failed\"\n end",
"def test_change_status\n expected = 200\n post_id = 1\n data = {\n status: 1\n }\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s+'/status')\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_show_if_contains_valid_transaction_id\n assert_equal @order.contains_valid_transaction_id?, false\n assert @order.update_attributes(:auth_transaction_id => 123)\n assert_equal @order.contains_valid_transaction_id?, true\n end",
"def test_should_show_index\n login_as :admin\n\n get :index\n assert_response :success\n assert_template 'list'\n end",
"def test_insert\n\n # Try inserting from a non-Admin account.\n post(:insert, { :id => subsections(:subsection_01_1_1).id }, rich_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n # Try inserting from an Admin account\n post(:insert, { :id => subsections(:subsection_01_1_1).id }, cathy_admin_session)\n assert_response 200\n assert_equal(subsections(:subsection_01_1_1).checklist.id,\n assigns(:new_subsection).checklist.id)\n assert_equal(subsections(:subsection_01_1_1).section_id,\n assigns(:new_subsection).section_id)\n\n\n end",
"def test_update_with_invalid_name\r\n @user = User.find(@testUser)\r\n # It will raise an error while execute render method in controller\r\n # Because the goldberg variables didn't been initialized in the test framework\r\n assert_raise (ActionView::TemplateError){\r\n post :update, :id => @testUser, :user => { :clear_password => \"\",\r\n :name => \"\" }\r\n }\r\n assert !assigns(:user).valid? \r\n assert_template 'users/edit'\r\n end",
"def test_show\n get :show,\n :id => posts(:by_quentin).id\n assert_response :success\n end",
"def test_should_not_update_invalid_tag\n login_as :admin\n\n parent_tags_count = Tag.find_ordered_parents.length\n a_tag = tags(:books)\n \n # Call the list action.\n get :list\n assert_response :success\n assert_template 'list'\n\n # Initially we should have all parent tags visible.\n assert_select \"ul#tag_list\" do\n assert_select \"li\", :count => parent_tags_count\n end\n\n # Tags should be updated using ajax calls.\n xhr(:post, :update, :id => a_tag.id, :name => \"\")\n #puts \"#{@response.body}\"\n \n # At this point, the call doesn't issue a rjs statement.\n\n # Test if it is in the database.\n assert_equal Tag.find_ordered_parents.length, parent_tags_count\n assert_equal Tag.find(a_tag.id).name, \"Books\"\n end",
"def test_index \n set = ResourceSet.new('SemanticExpression.new().spo(\\'<http://www.w3.org/2000/01/rdf-schema#Class>\\',\\'<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>\\',\\'<http://www.w3.org/2000/01/rdf-schema#Class>\\')') \n post :index , :setid => set.rsid\n assert_response :success\n assert_not_nil assigns[\"view\"] \n end",
"def test_edit_where\r\n #KS- make sure the place is what we expect it to be initially\r\n plan = plans(:first_plan)\r\n assert_equal places(:first_place), plan.place\r\n\r\n login users(:user_with_friends)\r\n\r\n @emails.clear\r\n post :edit_where, { :place_origin => PlansController::PLACE_FOUND_BY_NAME, :place_id => places(:another_place).id, :id => plan.id }\r\n plan = plans(:first_plan, :force)\r\n assert_equal places(:another_place).id, plan.place_id\r\n\r\n #KS- email notifications should have been sent out\r\n assert_equal 2, @emails.length\r\n\r\n #KS- try creating a new plan with no place, then editing the place to add a new place\r\n #(it should send out a proper notification email)\r\n plan_count = Plan.count\r\n @request.user_obj = nil\r\n post :create, :plan => { :name => \"test_plan123fark\" }\r\n assert_equal plan_count + 1, Plan.count\r\n test_plan = Plan.find(:first, :conditions => [\"name = :name\", {:name => 'test_plan123fark'}])\r\n\r\n #KS- invite someone so they will get a notification email\r\n post :edit_who, :id => test_plan.id, :plan_who => users(:existingbob).login\r\n\r\n #KS- have existingbob accept the invite\r\n users(:existingbob).planner.accept_plan(test_plan)\r\n\r\n #KS- do the place edit\r\n @emails.clear\r\n post :edit_where, { :place_origin => PlansController::PLACE_FOUND_BY_NAME, :place_id => places(:place_owned_by_bob).id, :id => test_plan.id }\r\n\r\n #KS- check to make sure the notification email went out\r\n assert_equal 1, @emails.length\r\n end",
"def test_should_update_tag\n login_as :admin\n\n parent_tags_count = Tag.find_ordered_parents.length\n a_tag = tags(:books)\n \n # Call the list action.\n get :list\n assert_response :success\n assert_template 'list'\n\n # Initially we should have all parent tags visible.\n assert_select \"ul#tag_list\" do\n assert_select \"li\", :count => parent_tags_count\n end\n\n # Tags should be updated using ajax calls.\n xhr(:post, :update, :id => a_tag.id, :name => \"Books and Magazines\")\n\n # We should have a piece of html modified using a rjs statement.\n assert_select_rjs \"tag_#{a_tag.id}\" do\n assert_select \"li\", :count => 1\n end\n\n # Test if it is in the database.\n assert_equal Tag.find_ordered_parents.length, parent_tags_count\n assert_equal Tag.find(a_tag.id).name, \"Books and Magazines\"\n end",
"def test_add_set_logged_in \n get :index\n session[:customer_id] = 1\n get_customer_cart.empty!\n\n post :add_set, :id => 1\n assert_redirected_to :controller => :cart, :action => ''\n cart = get_customer_cart\n assert_equal(2, cart.cart_items.size)\n assert_equal(cart.cart_items.map(&:product_id).sort, [4,5])\n end",
"def test_edit_course_with_invalid_title\r\n number_of_course = Course.count\r\n post :update_course,:id => 1, :course => { :title => ''}\r\n assert_equal Course.count, number_of_course\r\n assert Course.find(:all, :conditions => \"title = 'E-Commerce'\")\r\n assert !Course.find(:all, :conditions => \"title = ''\"),\r\n \"The blank title course save into database\" \r\n end",
"def edit\n @english = @semester.test_sets.find_english\n @spanish = @semester.test_sets.find_spanish\n end",
"def test_putpoi_delete_not_found\n changeset = create(:changeset)\n cs_id = changeset.id\n user = changeset.user\n\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, 1, 999999, 0, 0, {}, false]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 3, result.size\n assert_equal -4, result[0]\n assert_equal \"node\", result[1]\n assert_equal 999999, result[2]\n end",
"def test_list\n\n # Try editing from a non-Admin account.\n # VERIFY: The user is redirected.\n get :list, {}, rich_designer_session\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n # Try listing from an Admin account\n # VERIFY: The platform list data is retrieved\n post(:list, { :page => 1 }, cathy_admin_session)\n assert_equal(3, assigns(:design_directories).size)\n\n end",
"def test_edit_institution_with_valid_name\n number_of_institution = Institution.count\n post :update,:id => institutions(:institution1).id, :institution => { :name => 'Biomedical Engineer'}\n assert_equal flash[:notice], 'Institution was successfully updated.'\n assert_redirected_to :action => 'show', :id => institutions(:institution1).id\n assert_equal Institution.count, number_of_institution\n assert_equal 1, Institution.count(:all, :conditions => \"name = 'Biomedical Engineer'\");\n assert Institution.find(:all, :conditions => \"name = 'Computer Science'\").count == 0;\n end",
"def test_list\n\n # Try editing from a non-Admin account.\n # VERIFY: The user is redirected.\n get(:list, {}, rich_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n # Try listing from an Admin account\n # VERIFY: The platform list data is retrieved\n post(:list, { :page => 1 }, cathy_admin_session)\n assert_equal(5, assigns(:platforms).size)\n\n end",
"def update\n @questionset = Questionset.find(params[:id])\n\n respond_to do |format|\n if @questionset.update_attributes(params[:questionset])\n format.html { redirect_to @questionset, notice: 'Questionset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @questionset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_index \n post :index \n assert_response :success \n end",
"def test_add_book\n @d.add_book\n assert_equal @d.resources[\"books\"], 1\n @d.add_book\n assert_equal @d.resources[\"books\"], 2\n end",
"def test_should_update_link_via_API_XML\r\n get \"/logout\"\r\n put \"/links/1.xml\", :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response 401\r\n end",
"def test_update_valid\n ingredient = Factory.create(:ingredient)\n #TODO: reenable this once we can figure out how to remove any_instance\n # Ingredient.any_instance.stubs(:valid?).returns(true)\n put :update, :id => ingredient\n assert_redirected_to ingredient_url(assigns(:ingredient))\n end",
"def test_should_update_project_via_API_XML\r\n get \"/logout\"\r\n put \"/projects/1.xml\", :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response 401\r\n end",
"def browse_check(type, fixture) \n get type\n assert_response :not_found\n assert_template 'not_found'\n get type, {:id => -10} # we won't have an id that's negative\n assert_response :not_found\n assert_template 'not_found'\n get type, {:id => fixture.id}\n assert_response :success\n assert_template type\n end",
"def test_list\n\n # Try editing from a non-Admin account.\n # VERIFY: The user is redirected.\n get(:list, {}, rich_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n # Try listing from an Admin account\n # VERIFY: The project list data is retrieved\n get(:list, {:page => 1}, cathy_admin_session)\n assert_equal(8, assigns(:fab_houses).size)\n \n end",
"def test_put_success\n put \"/blah\", @test_obj do |response|\n assert response.ok?, \"Update test object failed\"\n end\n end",
"def test_add_resource_hillman\n @d.current_location = \"Hillman\"\n assert_equal @d.resources[\"books\"], 1\n end",
"def test_update\n\n section_01_1 = sections(:section_01_1)\n subsection_01_1_1 = subsections(:subsection_01_1_1)\n \n admin_session = cathy_admin_session\n\n total_checks = Check.count\n assert_equal(3, subsection_01_1_1.checks.size)\n\n check = Check.find(checks(:check_01).id)\n assert_equal(checks(:check_01).id, check.id)\n\n check.check_type = 'designer_only'\n \n get(:update, {:check => check.attributes}, admin_session)\n assert_equal('Check was successfully updated.', flash['notice'])\n assert_redirected_to(:action => 'modify_checks',\n :id => subsection_01_1_1.id)\n\n subsection_01_1_1.reload\n assert_equal(total_checks, Check.count)\n assert_equal(3, subsection_01_1_1.checks.size)\n\n checklist = subsection_01_1_1.checklist\n assert_equal(6, checklist.designer_only_count)\n assert_equal(5, checklist.designer_auditor_count)\n assert_equal(1, checklist.dc_designer_only_count)\n assert_equal(2, checklist.dc_designer_auditor_count)\n assert_equal(1, checklist.dr_designer_only_count)\n assert_equal(2, checklist.dr_designer_auditor_count)\n\n check.full_review = 1\n get(:update, { :check => check.attributes }, admin_session)\n checklist.reload\n assert_equal(7, checklist.designer_only_count)\n assert_equal(5, checklist.designer_auditor_count)\n assert_equal(1, checklist.dc_designer_only_count)\n assert_equal(2, checklist.dc_designer_auditor_count)\n assert_equal(1, checklist.dr_designer_only_count)\n assert_equal(2, checklist.dr_designer_auditor_count)\n\n check.date_code_check = 0\n get(:update, { :check => check.attributes }, admin_session)\n checklist.reload\n assert_equal(7, checklist.designer_only_count)\n assert_equal(5, checklist.designer_auditor_count)\n assert_equal(0, checklist.dc_designer_only_count)\n assert_equal(2, checklist.dc_designer_auditor_count)\n assert_equal(1, checklist.dr_designer_only_count)\n assert_equal(2, checklist.dr_designer_auditor_count)\n\n check.dot_rev_check = 0\n get(:update, { :check => check.attributes }, admin_session)\n checklist.reload\n assert_equal(7, checklist.designer_only_count)\n assert_equal(5, checklist.designer_auditor_count)\n assert_equal(0, checklist.dc_designer_only_count)\n assert_equal(2, checklist.dc_designer_auditor_count)\n assert_equal(0, checklist.dr_designer_only_count)\n assert_equal(2, checklist.dr_designer_auditor_count)\n\n check.full_review = 0\n get(:update, { :check => check.attributes }, admin_session)\n checklist.reload\n assert_equal(6, checklist.designer_only_count)\n assert_equal(5, checklist.designer_auditor_count)\n assert_equal(0, checklist.dc_designer_only_count)\n assert_equal(2, checklist.dc_designer_auditor_count)\n assert_equal(0, checklist.dr_designer_only_count)\n assert_equal(2, checklist.dr_designer_auditor_count)\n\n check.check_type = 'designer_auditor'\n check.date_code_check = 1\n get(:update, { :check => check.attributes }, admin_session)\n checklist.reload\n assert_equal(6, checklist.designer_only_count)\n assert_equal(5, checklist.designer_auditor_count)\n assert_equal(0, checklist.dc_designer_only_count)\n assert_equal(3, checklist.dc_designer_auditor_count)\n assert_equal(0, checklist.dr_designer_only_count)\n assert_equal(2, checklist.dr_designer_auditor_count)\n\n check.dot_rev_check = 1\n get(:update, { :check => check.attributes }, admin_session)\n checklist.reload\n assert_equal(6, checklist.designer_only_count)\n assert_equal(5, checklist.designer_auditor_count)\n assert_equal(0, checklist.dc_designer_only_count)\n assert_equal(3, checklist.dc_designer_auditor_count)\n assert_equal(0, checklist.dr_designer_only_count)\n assert_equal(3, checklist.dr_designer_auditor_count)\n\n\n subsection_01_1_1.reload\n assert_equal(total_checks, Check.count)\n assert_equal(3, subsection_01_1_1.checks.size)\n\n check = Check.find(checks(:check_14).id)\n assert_equal(checks(:check_14).id, check.id)\n\n check.check_type = 'designer_only'\n get(:update, { :check => check.attributes }, admin_session)\n #assert_equal('Check is locked. The parent checklist is released.', flash['notice'])\n\n end",
"def test_set\n req = c.set(\"/foo\", \"bar\", 123, &blk)\n\n assert_sent(req.tag, :verb => V::SET, :cas => 123, :path => \"/foo\", :value => \"bar\")\n assert_recv(reply(req.tag, :cas => 123))\n end",
"def test_index \n get :index \n assert_response :success \n end",
"def test_putrelation_update_valid\n relation = create(:relation)\n create(:relation_member, :relation => relation)\n user = relation.changeset.user\n cs_id = relation.changeset.id\n\n assert_not_equal({ \"test\" => \"ok\" }, relation.tags)\n amf_content \"putrelation\", \"/1\", [\"#{user.email}:test\", cs_id, relation.version, relation.id, { \"test\" => \"ok\" }, relation.members, true]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal relation.id, result[2]\n assert_equal relation.id, result[3]\n assert_equal relation.version + 1, result[4]\n\n new_relation = Relation.find(relation.id)\n assert_equal relation.version + 1, new_relation.version\n assert_equal relation.members, new_relation.members\n assert_equal({ \"test\" => \"ok\" }, new_relation.tags)\n assert_equal true, new_relation.visible\n end",
"def test_edit_admin_session\n # FIXME route exists but no action in controller, remove route?\n #get :edit, :locale => 'en'\n end",
"def test_section_selection\n \n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n get(:section_selection,\n { :id => @board_prep.id, :design_id => @mx234a.id },\n pat_dfm_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n # Verify that a Teradyne PCB Designer can access the list.\n post(:section_selection,\n {:id => @board_prep.id, :design_id => @mx234a.id},\n scott_designer_session)\n assert_response(:success)\n design = assigns(:design)\n assert_not_nil(design)\n assert_equal(@mx234a.id, design.id)\n assert_equal('252-234-a0 g', design.part_number.pcb_display_name)\n \n category = assigns(:category)\n assert_not_nil(category)\n assert_equal(@board_prep.id, category.id)\n assert_equal('Board Preparation', category.name)\n \n exp_sections = [oi_category_sections(:board_prep_1),\n oi_category_sections(:board_prep_2),\n oi_category_sections(:board_prep_3)]\n sections = assigns(:sections)\n \n exp_sections.each do |exp_section|\n actual_section = sections.shift\n assert_equal(exp_section.id, actual_section.id)\n assert_equal(exp_section.name, actual_section.name)\n assert_equal(exp_section.url1, actual_section.url1)\n assert_equal(exp_section.instructions, actual_section.instructions)\n assert_equal(exp_section.oi_category_id,\n actual_section.oi_category_id)\n assert_equal(exp_section.allegro_board_symbol,\n actual_section.allegro_board_symbol)\n assert_equal(exp_section.outline_drawing_link,\n actual_section.outline_drawing_link)\n end\n \n # Verify that a contractor PCB Designer can not access the list.\n get(:section_selection,\n {:id => @board_prep.id, :design_id => @mx234a.id},\n siva_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n #assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n end",
"def update\n @exercise_set = ExerciseSet.find(params[:id])\n\n respond_to do |format|\n if @exercise_set.update_attributes(params[:exercise_set])\n format.html { redirect_to @exercise_set.workout, notice: 'Exercise set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_should_get_index_as_admin\n login_as_admin\n get :index\n assert_response :success\n assert_not_nil assigns(:users)\n \n assigns(:users).each do |user|\n assert_tag :a, :content => \"Edit\", :attributes => {:href => edit_user_path(user)}\n assert_tag :a, :content => \"Destroy\", :attributes => {:href => user_path(user)}\n end\n \n assert_tag :a, :content => \"New member\", :attributes => {:href => new_user_path}\n end"
] | [
"0.72538406",
"0.7156685",
"0.706248",
"0.6941224",
"0.6919599",
"0.67562914",
"0.67562914",
"0.67412114",
"0.67276",
"0.67269933",
"0.6702522",
"0.66471887",
"0.6642055",
"0.66251284",
"0.660565",
"0.65889037",
"0.6584264",
"0.6564579",
"0.65137774",
"0.6513738",
"0.6501875",
"0.6494908",
"0.6442648",
"0.6439143",
"0.6424298",
"0.6398781",
"0.63814974",
"0.6323568",
"0.6321602",
"0.6307304",
"0.6277267",
"0.62665546",
"0.6253385",
"0.6243267",
"0.62194467",
"0.6212053",
"0.6201567",
"0.6196881",
"0.6196431",
"0.6184638",
"0.6181455",
"0.6181132",
"0.617939",
"0.61787254",
"0.61787254",
"0.6156438",
"0.6136347",
"0.6134365",
"0.6133714",
"0.61165774",
"0.6019471",
"0.5997538",
"0.5997538",
"0.5983126",
"0.5972012",
"0.5944716",
"0.5940038",
"0.59020275",
"0.58910024",
"0.5876188",
"0.5871218",
"0.5864567",
"0.586403",
"0.585651",
"0.58466065",
"0.5839675",
"0.583426",
"0.58334625",
"0.58288234",
"0.5827026",
"0.5824443",
"0.5823591",
"0.58206034",
"0.5815184",
"0.58121204",
"0.58041656",
"0.58014315",
"0.57982033",
"0.57945436",
"0.57848597",
"0.57821107",
"0.5777435",
"0.57772124",
"0.57724667",
"0.5768967",
"0.5757637",
"0.5752558",
"0.5750038",
"0.57482165",
"0.57362187",
"0.57296395",
"0.572911",
"0.572379",
"0.57077336",
"0.570637",
"0.5695278",
"0.56923395",
"0.569113",
"0.56865203",
"0.5677495"
] | 0.6869906 | 5 |
Show invalid properties with the reasons. Usually used together with valid? | def list_invalid_properties
invalid_properties = Array.new
invalid_properties
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n pattern = Regexp.new(/^$|^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/)\n if [email protected]? && @uuid !~ pattern\n invalid_properties.push(\"invalid value for \\\"uuid\\\", must conform to the pattern #{pattern}.\")\n end\n\n pattern = Regexp.new(/^$|^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/)\n if !@vdisk_id.nil? && @vdisk_id !~ pattern\n invalid_properties.push(\"invalid value for \\\"vdisk_id\\\", must conform to the pattern #{pattern}.\")\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @style.nil?\n invalid_properties.push('invalid value for \"style\", style cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n if [email protected]? && @name.to_s.length > 31\n invalid_properties.push('invalid value for \"name\", the character length must be smaller than or equal to 31.')\n end\n\n pattern = Regexp.new(/^[a-zA-Z0-9\\-\\._:]+$/)\n if [email protected]? && @name !~ pattern\n invalid_properties.push(\"invalid value for \\\"name\\\", must conform to the pattern #{pattern}.\")\n end\n\n pattern = Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n if !@static_wwpn_address.nil? && @static_wwpn_address !~ pattern\n invalid_properties.push(\"invalid value for \\\"static_wwpn_address\\\", must conform to the pattern #{pattern}.\")\n end\n\n pattern = Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n if [email protected]? && @wwpn !~ pattern\n invalid_properties.push(\"invalid value for \\\"wwpn\\\", must conform to the pattern #{pattern}.\")\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @is_object_icon.nil?\n invalid_properties.push('invalid value for \"is_object_icon\", is_object_icon cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n if @input_currency.nil?\n invalid_properties.push('invalid value for \"input_currency\", input_currency cannot be nil.')\n end\n\n if @sender.nil?\n invalid_properties.push('invalid value for \"sender\", sender cannot be nil.')\n end\n\n if @recipients.nil?\n invalid_properties.push('invalid value for \"recipients\", recipients cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @index.nil?\n invalid_properties.push('invalid value for \"index\", index cannot be nil.')\n end\n\n if @orientation.nil?\n invalid_properties.push('invalid value for \"orientation\", orientation cannot be nil.')\n end\n\n if @size.nil?\n invalid_properties.push('invalid value for \"size\", size cannot be nil.')\n end\n\n if @type.nil?\n invalid_properties.push('invalid value for \"type\", type cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @direction.nil?\n invalid_properties.push('invalid value for \"direction\", direction cannot be nil.')\n end\n\n if @shape.nil?\n invalid_properties.push('invalid value for \"shape\", shape cannot be nil.')\n end\n\n if @linear_angle.nil?\n invalid_properties.push('invalid value for \"linear_angle\", linear_angle cannot be nil.')\n end\n\n if @is_scaled.nil?\n invalid_properties.push('invalid value for \"is_scaled\", is_scaled cannot be nil.')\n end\n\n if @tile_flip.nil?\n invalid_properties.push('invalid value for \"tile_flip\", tile_flip cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n if @format.nil?\n invalid_properties.push('invalid value for \"format\", format cannot be nil.')\n end\n\n invalid_properties\n end"
] | [
"0.76497203",
"0.76497203",
"0.76497203",
"0.76497203",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7356452",
"0.7334807",
"0.72685325",
"0.7238964",
"0.7231359",
"0.72258264",
"0.7208294",
"0.71760833"
] | 0.7170241 | 84 |
Check to see if the all the properties in the model are valid | def valid?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_properties\n true\n end",
"def validate_properties\n true\n end",
"def validate\n super\n\n check_optional_property :collection, String\n check_optional_property :create, String\n check_optional_property :delete, String\n check_optional_property :flush, String\n check_optional_property :prefetch, String\n check_optional_property :request_to_query, String\n check_optional_property :resource_to_request_patch, String\n check_optional_property :return_if_object, String\n check_optional_property :self_link, String\n end",
"def valid_attributes?\n true\n end",
"def valid_attributes?\n attribute_errors.empty?\n end",
"def valid?\n return false if @property_code.nil?\n return false if @property_name.nil?\n return false if @location.nil?\n return false if @total_price.nil?\n return false if @min_daily_rate.nil?\n return true\n end",
"def validate_presence_of(klazz, properties)\r\n instance = klazz.new \r\n instance.should_not be_valid\r\n \r\n properties.each do |property| \r\n instance.errors.should be_invalid(property)\r\n err_properties = instance.errors[property]\r\n if err_properties.is_a? Array\r\n err_properties.include?(ActiveRecord::Errors.default_error_messages[:blank]).should be_true\r\n else\r\n err_properties.should == ActiveRecord::Errors.default_error_messages[:blank] \r\n end\r\n end \r\n end",
"def validate_attributes!(attributes)\n invalid_properties = attributes.keys.map(&:to_s) - self.attributes.keys\n raise UndefinedPropertyError, \"Undefined properties: #{invalid_properties.join(',')}\" if invalid_properties.size > 0\n end",
"def model_valid?\n true\n end",
"def model_valid?\n true\n end",
"def valid?\n self.errors = []\n self.content_type.fields.each do |field|\n if field.required\n if self.dynamic_getter(field.name).blank?\n self.errors << field.name\n end\n end\n end\n self.errors.blank?\n end",
"def valid?\n validate\n @model.errors.on(:preferences).blank?\n end",
"def validate_properties\n if @properties.keys.count > 0\n if @properties.key?(:label)\n unless @properties[:label] =~ /^[a-zA-Z][\\w|\\s]*$/\n raise 'property label validation error'\n end\n end\n\n if @properties.key?(:default_aggregate)\n unless @properties[:default_aggregate] =~ /^max$|^min$|^avg$|^count$/i\n raise 'property default_aggregate validation error'\n end\n end\n end\n end",
"def validate_properties\n @properties.each do |property, values|\n valid_values = validate_values(property, values)\n\n if valid_values.is_a?(Array) && valid_values == [] || valid_values.nil?\n @properties.delete(property)\n else\n @properties[property] = valid_values\n end\n end\n end",
"def validate\n valid?\n end",
"def validate_attributes!(attributes)\n return attributes if attributes.blank?\n invalid_properties = attributes.keys.map(&:to_s) - self.attributes.keys\n invalid_properties.reject! { |name| self.respond_to?(\"#{name}=\") }\n fail UndefinedPropertyError, \"Undefined properties: #{invalid_properties.join(',')}\" if !invalid_properties.empty?\n end",
"def is_valid; end",
"def valid?\n # TODO validate nested objects\n output = super\n errors.empty? && output\n end",
"def property_checks\n errors.add(:base, \"You can't have a Thing without properties\") if property_keys.empty?\n\n self.property_keys.each do |key|\n errors.add(:properties, \"'#{key}' is an invalid property for this List\") unless available_property_keys.include?(key)\n end\n end",
"def valid_for_attributes( model, attributes )\n unless model.valid?\n errors = model.errors\n our_errors = Array.new\n errors.each { |attr,error|\n if attributes.include? attr\n our_errors << [attr,error]\n end\n }\n errors.clear\n our_errors.each { |attr,error| errors.add(attr,error) }\n return false unless errors.empty?\n end\n return true\n end",
"def valid?\n type_validator = EnumAttributeValidator.new('String', [\"person\", \"business\"])\n return false unless type_validator.valid?(@type)\n return false if @country.nil?\n return false if @street.nil?\n return false if @postal_code.nil?\n return false if @city.nil?\n return false if @email.nil?\n return false if @ip.nil?\n identification_type_validator = EnumAttributeValidator.new('String', [\"DL\", \"PP\", \"ID\", \"OT\"])\n return false unless identification_type_validator.valid?(@identification_type)\n legal_entity_type_validator = EnumAttributeValidator.new('String', [\"sole_proprietorship\", \"partnership\", \"privately_owned_company\", \"publicly_owned_company\", \"government_owned_entity\", \"trust\", \"ngo\", \"club_and_society\", \"go\", \"other\", \"financial_institution\", \"mto\"])\n return false unless legal_entity_type_validator.valid?(@legal_entity_type)\n nature_of_business_validator = EnumAttributeValidator.new('String', [\"personal\", \"agriculture_and_hunting\", \"forestry\", \"fishing\", \"agricultural_by_products\", \"coal_mining\", \"oil_mining\", \"iron_ore_mining\", \"other_metal_and_diamond_mining\", \"other_mineral_mining\", \"manufacturing_of_food_drink_tobacco\", \"manufacturing_of_textiles_leather_fur_furniture\", \"manufacture_of_wooden_products_furniture\", \"manufacture_of_paper_pulp_allied_products\", \"manufacture_of_chemicals_medical_petroleum_rubber_plastic_products\", \"manufacture_of_pottery_china_glass_stone\", \"manufacture_of_iron_steel_non_ferrous_metals_basic_industries\", \"manufacture_of_metal_products_electrical_and_scientific_engineering\", \"manufacture_of_jewelry_musical_instruments_toys\", \"electricity_gas_and_water\", \"construction\", \"wholesale_trade\", \"retail_trade\", \"catering_incl_hotels\", \"transport_storage\", \"communications\", \"finance_and_holding_companies\", \"insurance\", \"business_services\", \"real_estate_development_investment\", \"central_state_governments\", \"community_services_defence_police_prisons_etc\", \"social_services_education_health_care\", \"personal_services_leisure_services\", \"personal_services_domestic_laundry_repairs\", \"personal_services_embassies_international_organisations\"])\n return false unless nature_of_business_validator.valid?(@nature_of_business)\n return false if @documents.nil?\n gender_validator = EnumAttributeValidator.new('String', [\"M\", \"F\", \"O\"])\n return false unless gender_validator.valid?(@gender)\n true\n end",
"def valid?\n return false if !super\n return false if @index.nil?\n return false if @orientation.nil?\n orientation_validator = EnumAttributeValidator.new('String', ['Horizontal', 'Vertical'])\n return false unless orientation_validator.valid?(@orientation)\n return false if @size.nil?\n size_validator = EnumAttributeValidator.new('String', ['Full', 'Half', 'Quarter'])\n return false unless size_validator.valid?(@size)\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', ['Title', 'Body', 'CenteredTitle', 'Subtitle', 'DateAndTime', 'SlideNumber', 'Footer', 'Header', 'Object', 'Chart', 'Table', 'ClipArt', 'Diagram', 'Media', 'SlideImage', 'Picture'])\n return false unless type_validator.valid?(@type)\n true\n end",
"def validate\n validate_string_attributes\n @relations.map(&:validate)\n end",
"def is_valid?\n end",
"def run_validations\n true\n end",
"def validate\n validate_params\n validate_colour\n validate_coordinates\n validate_dimension\n end",
"def checkAttributeRequirements\n if @valid_attributes.empty?\n @error_text = \"No valid attributes found\"\n return false\n elsif (@mandatory_attributes_from_db & @valid_attributes) != @mandatory_attributes_from_db\n missing_attr = @mandatory_attributes_from_db - (@mandatory_attributes_from_db & @valid_attributes)\n\n x_attr_txt = \"\"\n missing_attr.each {|x_attr| x_attr_txt += x_attr[:name] + \", \"}\n @error_text = \"Mandatory attributes #{x_attr_txt[0..-3]} is/are missing\"\n return false\n end\n\n return true\n end",
"def validations\n {}\n end",
"def validatable?\n true\n end",
"def validate\n validate_params\n validate_coordinates\n validate_colour\n validate_dimension\n end",
"def validate_required\n [\n :project_name,\n :status,\n :requester_id,\n :subject_expert_id,\n :sponsor_id,\n :vision,\n :goal,\n :description,\n :scope,\n :advice_required,\n :program_id,\n :train_id,\n :funding_method,\n :cost_center,\n :funding_status,\n :budget_allocated,\n :priority,\n :start_date,\n :end_date,\n :risk_rating,\n :risks,\n :projected_revenue,\n ].each do |field|\n if self.attributes[field.to_s].nil? || self.attributes[field.to_s].blank?\n # intentionally vague!\n add_validation 'All fields are required to perform further validations'\n return false\n end\n end\n true\n end",
"def validate\n validate_root\n validate_associated\n valid?\n end",
"def validate\n true\n end",
"def valid?\n return false if @id.nil?\n return false if @created.nil?\n return false if @modified.nil?\n return false if @company_name.nil?\n return false if @company_name.to_s.length < 1\n return false if @domain_name.nil?\n return false if @state.nil?\n state_validator = EnumAttributeValidator.new('String', [\"active\", \"deactivated\"])\n return false unless state_validator.valid?(@state)\n return false if @billing_email.nil?\n return false if @application_count.nil?\n return false if @user_count.nil?\n return false if @campaigns_active_count.nil?\n return false if @campaigns_inactive_count.nil?\n true\n end",
"def valid?\n _errors_before = self.errors.dup\n _s = super\n validate_attributes\n _errors_before.each { |e| append_error(_errors_before,e) }\n self.errors.empty?\n end",
"def valid?\n true\n end",
"def validate!\n expected_props, required_props = @properties.keys, @required\n\n unless is_a?(Dialect) || is_a?(Template)\n expected_props = expected_props + INHERITED_PROPERTIES.keys\n end\n\n # It has only expected properties (exclude metadata)\n keys = self.keys - [:\"@context\"]\n keys = keys.reject {|k| k.to_s.include?(':')} unless is_a?(Dialect)\n raise \"#{type} has unexpected keys: #{keys - expected_props}\" unless keys.all? {|k| expected_props.include?(k)}\n\n # It has required properties\n raise \"#{type} missing required keys: #{required_props & keys}\" unless (required_props & keys) == required_props\n\n # Every property is valid\n keys.each do |key|\n value = self[key]\n is_valid = case key\n when :columns\n column_names = value.map(&:name)\n value.is_a?(Array) &&\n value.all? {|v| v.is_a?(Column) && v.validate!} &&\n begin\n # The name properties of the column descriptions must be unique within a given table description.\n column_names = value.map(&:name)\n raise \"Columns must have unique names\" if column_names.uniq != column_names\n true\n end\n when :commentPrefix then value.is_a?(String) && value.length == 1\n when :datatype then value.is_a?(String) && DATATYPES.keys.map(&:to_s).include?(value)\n when :default then value.is_a?(String)\n when :delimiter then value.is_a?(String) && value.length == 1\n when :dialect then value.is_a?(Dialect) && value.validate!\n when :doubleQuote then %w(true false 1 0).include?(value.to_s.downcase)\n when :encoding then Encoding.find(value)\n when :foreignKeys\n # An array of foreign key definitions that define how the values from specified columns within this table link to rows within this table or other tables. A foreign key definition is a JSON object with the properties:\n value.is_a?(Array) && value.all? do |fk|\n raise \"Foreign key must be an object\" unless fk.is_a?(Hash)\n columns, reference = fk['columns'], fk['reference']\n raise \"Foreign key missing columns and reference\" unless columns && reference\n raise \"Foreign key has extra entries\" unless fk.keys.length == 2\n raise \"Foreign key must reference columns\" unless Array(columns).all? {|k| self.columns.any? {|c| c.name == k}}\n raise \"Foreign key reference must be an Object\" unless reference.is_a?(Hash)\n\n if reference.has_key?('resource')\n raise \"Foreign key having a resource reference, must not have a schema\" if reference.has_key?('schema')\n # FIXME resource is a URL of a specific resource (table) which must exist\n elsif reference.has_key?('schema')\n # FIXME schema is a URL of a specific schema which must exist\n end\n # FIXME: columns\n true\n end\n when :format then value.is_a?(String)\n when :header then %w(true false 1 0).include?(value.to_s.downcase)\n when :headerColumnCount, :headerRowCount\n value.is_a?(Numeric) && value.integer? && value > 0\n when :length\n # Applications must raise an error if length, maxLength or minLength are specified and the cell value is not a list (ie separator is not specified), a string or one of its subtypes, or a binary value.\n raise \"Use if minLength or maxLength with length requires separator\" if self[:minLength] || self[:maxLength] && !self[:separator]\n raise \"Use of both length and minLength requires they be equal\" unless self.fetch(:minLength, value) == value\n raise \"Use of both length and maxLength requires they be equal\" unless self.fetch(:maxLength, value) == value\n value.is_a?(Numeric) && value.integer? && value > 0\n when :language then BCP47::Language.identify(value)\n when :lineTerminator then value.is_a?(String)\n when :minimum, :maximum, :minInclusive, :maxInclusive, :minExclusive, :maxExclusive\n value.is_a?(Numeric) ||\n RDF::Literal::Date.new(value).valid? ||\n RDF::Literal::Time.new(value).valid? ||\n RDF::Literal::DateTime.new(value).valid?\n when :minLength, :maxLength\n value.is_a?(Numeric) && value.integer? && value > 0\n when :name then value.is_a?(String) && !name.start_with?(\"_\")\n when :notes then value.is_a?(Array) && value.all? {|v| v.is_a?(Hash)}\n when :null then value.is_a?(String)\n when :predicateUrl then Array(value).all? {|v| RDF::URI(v).valid?}\n when :primaryKey\n # A column reference property that holds either a single reference to a column description object or an array of references.\n Array(value).all? do |k|\n self.columns.any? {|c| c.name == k}\n end\n when :quoteChar then value.is_a?(String) && value.length == 1\n when :required then %w(true false 1 0).include?(value.to_s.downcase)\n when :resources then value.is_a?(Array) && value.all? {|v| v.is_a?(Table) && v.validate!}\n when :schema then value.is_a?(Schema) && value.validate!\n when :separator then value.nil? || value.is_a?(String) && value.length == 1\n when :skipInitialSpace then %w(true false 1 0).include?(value.to_s.downcase)\n when :skipBlankRows then %w(true false 1 0).include?(value.to_s.downcase)\n when :skipColumns then value.is_a?(Numeric) && value.integer? && value >= 0\n when :skipRows then value.is_a?(Numeric) && value.integer? && value >= 0\n when :source then %w(json rdf).include?(value)\n when :\"table-direction\" then %w(rtl ltr default).include?(value)\n when :targetFormat, :templateFormat then RDF::URI(value).valid?\n when :templates then value.is_a?(Array) && value.all? {|v| v.is_a?(Template) && v.validate!}\n when :\"text-direction\" then %w(rtl ltr).include?(value)\n when :title then valid_natural_language_property?(value)\n when :trim then %w(true false 1 0 start end).include?(value.to_s.downcase)\n when :urlTemplate then value.is_a?(String)\n when :@id then @id.valid?\n when :@type then value.to_sym == type\n else\n raise \"?!?! shouldn't get here for key #{key}\"\n end\n raise \"#{type} has invalid #{key}: #{value.inspect}\" unless is_valid\n end\n\n self\n end",
"def valid?\n return false if @subject_property.nil?\n return false if @proprietorship.nil?\n proprietorship_validator = EnumAttributeValidator.new('String', [\"Unknown\", \"Sole\", \"Joint\"])\n return false unless proprietorship_validator.valid?(@proprietorship)\n return false if @surname.nil?\n return false if @forename.nil?\n return false if @middle_name.nil?\n return true\n end",
"def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"cond.HclStatusDetail\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"cond.HclStatusDetail\"])\n return false unless object_type_validator.valid?(@object_type)\n hardware_status_validator = EnumAttributeValidator.new('String', [\"Missing-Os-Driver-Info\", \"Incompatible-Server-With-Component\", \"Incompatible-Processor\", \"Incompatible-Os-Info\", \"Incompatible-Component-Model\", \"Incompatible-Firmware\", \"Incompatible-Driver\", \"Incompatible-Firmware-Driver\", \"Service-Unavailable\", \"Service-Error\", \"Unrecognized-Protocol\", \"Not-Evaluated\", \"Compatible\"])\n return false unless hardware_status_validator.valid?(@hardware_status)\n reason_validator = EnumAttributeValidator.new('String', [\"Missing-Os-Driver-Info\", \"Incompatible-Server-With-Component\", \"Incompatible-Processor\", \"Incompatible-Os-Info\", \"Incompatible-Component-Model\", \"Incompatible-Firmware\", \"Incompatible-Driver\", \"Incompatible-Firmware-Driver\", \"Service-Unavailable\", \"Service-Error\", \"Unrecognized-Protocol\", \"Not-Evaluated\", \"Compatible\"])\n return false unless reason_validator.valid?(@reason)\n software_status_validator = EnumAttributeValidator.new('String', [\"Missing-Os-Driver-Info\", \"Incompatible-Server-With-Component\", \"Incompatible-Processor\", \"Incompatible-Os-Info\", \"Incompatible-Component-Model\", \"Incompatible-Firmware\", \"Incompatible-Driver\", \"Incompatible-Firmware-Driver\", \"Service-Unavailable\", \"Service-Error\", \"Unrecognized-Protocol\", \"Not-Evaluated\", \"Compatible\"])\n return false unless software_status_validator.valid?(@software_status)\n status_validator = EnumAttributeValidator.new('String', [\"Incomplete\", \"Not-Found\", \"Not-Listed\", \"Validated\", \"Not-Evaluated\"])\n return false unless status_validator.valid?(@status)\n true && super\n end",
"def core_attributes_valid\n core_attributes = [@rateable, @rater, @ratee, @rating_type]\n return if core_attributes.all? { |atr| atr.present? && atr.valid? }\n errors.add('message', 'Not all core attributes present and valid.')\n end",
"def valid?\n super\n errors.empty?\n end",
"def valid?\n \n if @account_id.nil?\n false\n elsif @campaign_id.nil?\n false\n elsif @csp_id.nil?\n false\n elsif @status.nil?\n false\n elsif @create_date.nil?\n false\n elsif @auto_renewal.nil?\n false\n elsif @brand_id.nil?\n false\n elsif @usecase.nil?\n false\n elsif @sub_usecases.nil?\n false\n elsif @description.nil?\n false\n elsif @embedded_link.nil?\n false\n elsif @embedded_phone.nil?\n false\n elsif @affiliate_marketing.nil?\n false\n elsif @number_pool.nil?\n false\n elsif @age_gated.nil?\n false\n elsif @direct_lending.nil?\n false\n elsif @subscriber_optin.nil?\n false\n elsif @subscriber_optout.nil?\n false\n elsif @subscriber_help.nil?\n false\n elsif @sample1.nil?\n false\n elsif @mock.nil?\n false\n else\n list_invalid_properties.length() == 0\n end\n end",
"def valid?(metadata)\n validate.each do |attr|\n return false if metadata[attr.to_sym].nil? || metadata[attr.to_sym].zero?\n end\n end",
"def is_valid\n return true\n end",
"def validate_attrs\n @target.present? && [email protected]? && @actor.present? && @action_key.present?\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n if [email protected]? && @name.to_s.length > 31\n invalid_properties.push('invalid value for \"name\", the character length must be smaller than or equal to 31.')\n end\n\n pattern = Regexp.new(/^[a-zA-Z0-9\\-\\._:]+$/)\n if [email protected]? && @name !~ pattern\n invalid_properties.push(\"invalid value for \\\"name\\\", must conform to the pattern #{pattern}.\")\n end\n\n pattern = Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n if !@static_wwpn_address.nil? && @static_wwpn_address !~ pattern\n invalid_properties.push(\"invalid value for \\\"static_wwpn_address\\\", must conform to the pattern #{pattern}.\")\n end\n\n pattern = Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n if [email protected]? && @wwpn !~ pattern\n invalid_properties.push(\"invalid value for \\\"wwpn\\\", must conform to the pattern #{pattern}.\")\n end\n\n invalid_properties\n end",
"def valid_save?\n valid = true\n\n if self.name.nil? || self.name == \"\"\n valid = false\n end\n\n if self.general_info.nil? || self.general_info == \"\"\n valid = false\n end\n\n if self.technical_specs.nil? || self.technical_specs == \"\"\n valid = false\n end\n\n if self.where_to_buy.nil? || self.where_to_buy == \"\"\n valid = false\n end\n\n return valid\n end",
"def valid?\n schema.validate(self)\n end",
"def valid?\n reset_errors\n valid_date?\n valid_user?\n valid_activity_type?\n self.errors.empty?\n end",
"def valid?\n validate\n end",
"def product_attributes_must_not_be_empty\n\n\t\t# Instance\n\t\tproduct = Product.new\n\n\t\tassert product.invalid?\n\t\tassert product.errors[:title].any?\n\t\tassert product.errors[:description].any?\n\t\tassert product.errors[:price].any?\n\t\tassert product.errors[:image_url].any?\n\tend",
"def valid?\n return false if @id.nil?\n return false if @id !~ Regexp.new(/^psc_[a-zA-Z0-9]+$/)\n carrier_validator = EnumAttributeValidator.new('String', [\"USPS\"])\n return false unless carrier_validator.valid?(@carrier)\n return false if !@front_template_id.nil? && @front_template_id !~ Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n return false if !@back_template_id.nil? && @back_template_id !~ Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n return false if !@front_template_version_id.nil? && @front_template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)\n return false if !@back_template_version_id.nil? && @back_template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)\n object_validator = EnumAttributeValidator.new('String', [\"postcard\"])\n return false unless object_validator.valid?(@object)\n return false if @url.nil?\n return false if @url !~ Regexp.new(/^https:\\/\\/(lob-assets|lob-assets-staging)\\.com\\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\\/[a-z]{3,4}_[a-z0-9]{15,16}(\\.pdf|_thumb_[a-z]+_[0-9]+\\.png)\\?(version=[a-z0-9-]*&)?expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+$/)\n return false if [email protected]? && @description.to_s.length > 255\n true\n end",
"def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"network.ElementSummary\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"network.ElementSummary\"])\n return false unless object_type_validator.valid?(@object_type)\n ethernet_switching_mode_validator = EnumAttributeValidator.new('String', [\"end-host\", \"switch\"])\n return false unless ethernet_switching_mode_validator.valid?(@ethernet_switching_mode)\n fc_switching_mode_validator = EnumAttributeValidator.new('String', [\"end-host\", \"switch\"])\n return false unless fc_switching_mode_validator.valid?(@fc_switching_mode)\n management_mode_validator = EnumAttributeValidator.new('String', [\"IntersightStandalone\", \"UCSM\", \"Intersight\"])\n return false unless management_mode_validator.valid?(@management_mode)\n thermal_validator = EnumAttributeValidator.new('String', [\"unknown\", \"ok\", \"upper-non-recoverable\", \"upper-critical\", \"upper-non-critical\", \"lower-non-critical\", \"lower-critical\", \"lower-non-recoverable\"])\n return false unless thermal_validator.valid?(@thermal)\n true && super\n end",
"def valid?\n\t\t\t\ttrue\n\t\t\tend",
"def validate\r\n validate! rescue false\r\n end",
"def validate\n validate_string_attributes\n end",
"def valid?\n self.errors = Mongomatic::Errors.new\n do_callback(:before_validate)\n check_required_fields\n validate\n do_callback(:after_validate)\n self.errors.empty?\n end",
"def valid\n @valid\n end",
"def valid_objects\n all_objects.select { |o| o.valid? }\n end",
"def valid?\n return false if @summary.nil?\n return false if @summary.to_s.length > 100\n record_type_validator = EnumAttributeValidator.new('String', [\"ServiceTicket\", \"ProjectTicket\", \"ProjectIssue\"])\n return false unless record_type_validator.valid?(@record_type)\n return false if !@wbs_code.nil? && @wbs_code.to_s.length > 50\n return false if @company.nil?\n return false if !@site_name.nil? && @site_name.to_s.length > 50\n return false if !@address_line1.nil? && @address_line1.to_s.length > 50\n return false if !@address_line2.nil? && @address_line2.to_s.length > 50\n return false if [email protected]? && @city.to_s.length > 50\n return false if !@state_identifier.nil? && @state_identifier.to_s.length > 50\n return false if [email protected]? && @zip.to_s.length > 12\n return false if !@contact_phone_number.nil? && @contact_phone_number.to_s.length > 20\n return false if !@contact_phone_extension.nil? && @contact_phone_extension.to_s.length > 15\n return false if !@contact_email_address.nil? && @contact_email_address.to_s.length > 250\n severity_validator = EnumAttributeValidator.new('String', [\"Low\", \"Medium\", \"High\"])\n return false unless severity_validator.valid?(@severity)\n impact_validator = EnumAttributeValidator.new('String', [\"Low\", \"Medium\", \"High\"])\n return false unless impact_validator.valid?(@impact)\n return false if !@external_x_ref.nil? && @external_x_ref.to_s.length > 100\n return false if !@po_number.nil? && @po_number.to_s.length > 50\n return false if !@automatic_email_cc.nil? && @automatic_email_cc.to_s.length > 1000\n sub_billing_method_validator = EnumAttributeValidator.new('String', [\"ActualRates\", \"FixedFee\", \"NotToExceed\", \"OverrideRate\"])\n return false unless sub_billing_method_validator.valid?(@sub_billing_method)\n knowledge_base_link_type_validator = EnumAttributeValidator.new('String', [\"ServiceTicket\", \"ProjectTicket\", \"ProjectIssue\", \"KnowledgeBaseArticle\", \"Time\", \"Activity\"])\n return false unless knowledge_base_link_type_validator.valid?(@knowledge_base_link_type)\n bill_time_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_time_validator.valid?(@bill_time)\n bill_expenses_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_expenses_validator.valid?(@bill_expenses)\n bill_products_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_products_validator.valid?(@bill_products)\n predecessor_type_validator = EnumAttributeValidator.new('String', [\"Ticket\", \"Phase\"])\n return false unless predecessor_type_validator.valid?(@predecessor_type)\n return true\n end",
"def validate!\n true\n end",
"def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"vnic.FcIf\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"vnic.FcIf\"])\n return false unless object_type_validator.valid?(@object_type)\n return false if [email protected]? && @name.to_s.length > 31\n return false if [email protected]? && @name !~ Regexp.new(/^[a-zA-Z0-9\\-\\._:]+$/)\n return false if !@static_wwpn_address.nil? && @static_wwpn_address !~ Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n type_validator = EnumAttributeValidator.new('String', [\"fc-initiator\", \"fc-nvme-initiator\", \"fc-nvme-target\", \"fc-target\"])\n return false unless type_validator.valid?(@type)\n return false if [email protected]? && @wwpn !~ Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n wwpn_address_type_validator = EnumAttributeValidator.new('String', [\"POOL\", \"STATIC\"])\n return false unless wwpn_address_type_validator.valid?(@wwpn_address_type)\n true && super\n end",
"def valid?\n validate_survivors and validate_items && validate_records\n end",
"def valid?\n return false if @id.nil?\n return false if @next_send.nil?\n return false if @rrule.nil?\n return false if @session.nil?\n return false if @last_sent.nil?\n return false if @contact_name.nil?\n return false if @parameters.nil?\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', ['Once', 'Hourly', 'Daily', 'Weekly', 'Monthly', 'Yearly'])\n return false unless type_validator.valid?(@type)\n return false if @summary.nil?\n return false if @text_parameters.nil?\n return false if @first_occurrence.nil?\n return false if @last_occurrence.nil?\n return false if @recipients_count.nil?\n return false if @timezone.nil?\n return false if @completed.nil?\n return false if @avatar.nil?\n return false if @created_at.nil?\n true\n end",
"def valid?\n return false if [email protected]? && @description.to_s.length > 255\n return false if @routing_number.nil?\n return false if @routing_number.to_s.length > 9\n return false if @routing_number.to_s.length < 9\n return false if @account_number.nil?\n return false if @account_number.to_s.length > 17\n return false if @account_type.nil?\n account_type_validator = EnumAttributeValidator.new('String', [\"company\", \"individual\"])\n return false unless account_type_validator.valid?(@account_type)\n return false if @signatory.nil?\n return false if @signatory.to_s.length > 30\n return false if @id.nil?\n return false if @id !~ Regexp.new(/^bank_[a-zA-Z0-9]+$/)\n return false if !@signature_url.nil? && @signature_url !~ Regexp.new(/^https:\\/\\/lob-assets\\.com\\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\\/[a-z]{3,4}_[a-z0-9]{15,16}(\\.pdf|_thumb_[a-z]+_[0-9]+\\.png)\\?(version=[a-z0-9-]*&)?expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+$/)\n return false if @date_created.nil?\n return false if @date_modified.nil?\n return false if @object.nil?\n object_validator = EnumAttributeValidator.new('String', [\"bank_account\"])\n return false unless object_validator.valid?(@object)\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n return false if @id.nil?\n return false if @account_id.nil?\n return false if @organization_id.nil?\n return false if @product_id.nil?\n return false if @product_rate_plan_id.nil?\n return false if @name.nil?\n type_validator = EnumAttributeValidator.new('String', [\"Subscription\", \"FixedTerm\", \"Trial\"])\n return false unless type_validator.valid?(@type)\n return false if @state.nil?\n state_validator = EnumAttributeValidator.new('String', [\"Trial\", \"Provisioned\", \"Paid\", \"AwaitingPayment\", \"Cancelled\", \"Failed\", \"Expired\"])\n return false unless state_validator.valid?(@state)\n return false if @initial_period_start.nil?\n return false if @trial_end.nil?\n managed_by_validator = EnumAttributeValidator.new('String', [\"BillForward\", \"Stripe\"])\n return false unless managed_by_validator.valid?(@managed_by)\n return false if @version_start.nil?\n return false if @version_number.nil?\n return false if @current_time.nil?\n failed_payment_behaviour_validator = EnumAttributeValidator.new('String', [\"CancelSubscription\", \"None\"])\n return false unless failed_payment_behaviour_validator.valid?(@failed_payment_behaviour)\n return true\n end",
"def validate_fields\n %w[email author].each do |field|\n value = self.send(field)\n abort \"Hoe #{field} value not set. aborting\" if value.nil? or value.empty?\n end\n end",
"def valid?\n return false if @name.nil?\n return false if @name.to_s.length < 1\n return false if @timezone.nil?\n return false if @timezone.to_s.length < 1\n return false if @currency.nil?\n return false if @currency.to_s.length < 1\n case_sensitivity_validator = EnumAttributeValidator.new('String', [\"sensitive\", \"insensitive-uppercase\", \"insensitive-lowercase\"])\n return false unless case_sensitivity_validator.valid?(@case_sensitivity)\n campaign_priority_validator = EnumAttributeValidator.new('String', [\"universal\", \"stackable\", \"exclusive\"])\n return false unless campaign_priority_validator.valid?(@campaign_priority)\n exclusive_campaigns_strategy_validator = EnumAttributeValidator.new('String', [\"listOrder\", \"lowestDiscount\", \"highestDiscount\"])\n return false unless exclusive_campaigns_strategy_validator.valid?(@exclusive_campaigns_strategy)\n default_discount_scope_validator = EnumAttributeValidator.new('String', [\"sessionTotal\", \"cartItems\", \"additionalCosts\"])\n return false unless default_discount_scope_validator.valid?(@default_discount_scope)\n default_discount_additional_cost_per_item_scope_validator = EnumAttributeValidator.new('String', [\"price\", \"itemTotal\", \"additionalCosts\"])\n return false unless default_discount_additional_cost_per_item_scope_validator.valid?(@default_discount_additional_cost_per_item_scope)\n true\n end",
"def valid?\n run_validation\n @errors.empty?\n end",
"def valid?\n MANDATORY_ATTRIBUTES.each{|a| return false unless self[a]}\n true\n end",
"def valid?\n return false if @id.nil?\n return false if @token.nil?\n return false if @tipo.nil?\n tipo_validator = EnumAttributeValidator.new('String', ['fatture', 'proforma', 'ordini', 'preventivi', 'ndc'])\n return false unless tipo_validator.valid?(@tipo)\n return false if @nome.nil?\n return false if @indirizzo_via.nil?\n return false if @indirizzo_cap.nil?\n return false if @indirizzo_citta.nil?\n return false if @indirizzo_provincia.nil?\n return false if @paese.nil?\n lingua_validator = EnumAttributeValidator.new('String', ['it', 'en', 'de'])\n return false unless lingua_validator.valid?(@lingua)\n return false if @piva.nil?\n return false if @cf.nil?\n return false if @numero.nil?\n return false if @valuta.nil?\n return false if @valuta_cambio.nil?\n return false if @prezzi_ivati.nil?\n return false if @importo_netto.nil?\n return false if @importo_iva.nil?\n return false if @importo_totale.nil?\n mostra_totali_validator = EnumAttributeValidator.new('String', ['tutti', 'netto', 'nessuno'])\n return false unless mostra_totali_validator.valid?(@mostra_totali)\n return false if @lista_articoli.nil?\n pa_tipo_cliente_validator = EnumAttributeValidator.new('String', ['PA', 'B2B'])\n return false unless pa_tipo_cliente_validator.valid?(@pa_tipo_cliente)\n pa_tipo_validator = EnumAttributeValidator.new('String', ['ordine', 'convenzione', 'contratto', 'nessuno'])\n return false unless pa_tipo_validator.valid?(@pa_tipo)\n pa_esigibilita_validator = EnumAttributeValidator.new('String', ['I', 'D', 'S', 'N'])\n return false unless pa_esigibilita_validator.valid?(@pa_esigibilita)\n true\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end",
"def valid?\n return false if @name.nil?\n return false if @name.to_s.length > 50\n return false if @prefix_suffix_option.nil?\n prefix_suffix_option_validator = EnumAttributeValidator.new('String', [\"Prefix\", \"Suffix\"])\n return false unless prefix_suffix_option_validator.valid?(@prefix_suffix_option)\n return false if !@invoice_pre_suffix.nil? && @invoice_pre_suffix.to_s.length > 5\n application_units_validator = EnumAttributeValidator.new('String', [\"Amount\", \"Hours\", \"Incidents\"])\n return false unless application_units_validator.valid?(@application_units)\n application_cycle_validator = EnumAttributeValidator.new('String', [\"Contract2Weeks\", \"Contract4Weeks\", \"ContractYear\", \"CalendarMonth\", \"CalendarQuarter\", \"CalendarWeek\", \"ContractQuarter\", \"CalendarYear\"])\n return false unless application_cycle_validator.valid?(@application_cycle)\n return false if @employee_comp_rate.nil?\n employee_comp_rate_validator = EnumAttributeValidator.new('String', [\"Actual\", \"Hourly\"])\n return false unless employee_comp_rate_validator.valid?(@employee_comp_rate)\n return false if @employee_comp_not_exceed.nil?\n employee_comp_not_exceed_validator = EnumAttributeValidator.new('String', [\"Billing\", \"Percent\", \"Amount\"])\n return false unless employee_comp_not_exceed_validator.valid?(@employee_comp_not_exceed)\n return false if @invoicing_cycle.nil?\n invoicing_cycle_validator = EnumAttributeValidator.new('String', [\"CalendarYear\", \"ContractYear\"])\n return false unless invoicing_cycle_validator.valid?(@invoicing_cycle)\n return false if !@invoice_description.nil? && @invoice_description.to_s.length > 4000\n return false if @bill_time.nil?\n bill_time_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_time_validator.valid?(@bill_time)\n return false if @bill_expenses.nil?\n bill_expenses_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_expenses_validator.valid?(@bill_expenses)\n return false if @bill_products.nil?\n bill_products_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_products_validator.valid?(@bill_products)\n return true\n end",
"def validate\n end",
"def valid?\n return false if @to.nil?\n return false if @from.nil?\n carrier_validator = EnumAttributeValidator.new('String', [\"USPS\"])\n return false unless carrier_validator.valid?(@carrier)\n return false if @date_created.nil?\n return false if @date_modified.nil?\n return false if @id.nil?\n return false if @id !~ Regexp.new(/^ltr_[a-zA-Z0-9]+$/)\n return false if !@template_id.nil? && @template_id !~ Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n return false if !@template_version_id.nil? && @template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)\n return false if [email protected]? && @url !~ Regexp.new(/^https:\\/\\/(lob-assets|lob-assets-staging)\\.com\\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\\/[a-z]{3,4}_[a-z0-9]{15,16}(\\.pdf|_thumb_[a-z]+_[0-9]+\\.png)\\?(version=[a-z0-9-]*&)?expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+$/)\n return false if @object.nil?\n object_validator = EnumAttributeValidator.new('String', [\"letter\"])\n return false unless object_validator.valid?(@object)\n return false if [email protected]? && @description.to_s.length > 255\n return false if !@tracking_events.nil? && @tracking_events.length > 0\n address_placement_validator = EnumAttributeValidator.new('String', [\"top_first_page\", \"insert_blank_page\", \"bottom_first_page_center\", \"bottom_first_page\"])\n return false unless address_placement_validator.valid?(@address_placement)\n true\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def supports_validations?\n true\n end",
"def valid?\n @errors = self.class.valid_against_schema?(self.class.json_schema, self)\n @errors.empty?\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n return false if @first_name.nil?\n return false if @first_name.to_s.length > 30\n return false if !@last_name.nil? && @last_name.to_s.length > 30\n return false if !@address_line1.nil? && @address_line1.to_s.length > 50\n return false if !@address_line2.nil? && @address_line2.to_s.length > 50\n return false if [email protected]? && @city.to_s.length > 50\n return false if [email protected]? && @state.to_s.length > 50\n return false if [email protected]? && @zip.to_s.length > 12\n return false if [email protected]? && @country.to_s.length > 50\n return false if !@security_identifier.nil? && @security_identifier.to_s.length > 184\n return false if [email protected]? && @title.to_s.length > 100\n return false if [email protected]? && @school.to_s.length > 50\n return false if !@nick_name.nil? && @nick_name.to_s.length > 30\n return false if !@significant_other.nil? && @significant_other.to_s.length > 30\n return false if !@portal_password.nil? && @portal_password.to_s.length > 15\n return false if !@portal_security_level.nil? && @portal_security_level > 6.0\n return false if !@portal_security_level.nil? && @portal_security_level < 1.0\n gender_validator = EnumAttributeValidator.new('String', [\"Male\", \"Female\"])\n return false unless gender_validator.valid?(@gender)\n presence_validator = EnumAttributeValidator.new('String', [\"Online\", \"DoNotDisturb\", \"Away\", \"Offline\", \"NoAgent\"])\n return false unless presence_validator.valid?(@presence)\n return true\n end",
"def validated?; end",
"def valid?\n return false if @name.nil?\n return false if @slug.nil?\n return false if @status.nil?\n status_validator = EnumAttributeValidator.new('String', ['enabled', 'disabled'])\n return false unless status_validator.valid?(@status)\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', ['digital', 'physical'])\n return false unless type_validator.valid?(@type)\n return false if @sku.nil?\n return false if @price.nil?\n availability_validator = EnumAttributeValidator.new('String', ['available', 'comingSoon', 'retired'])\n return false unless availability_validator.valid?(@availability)\n stock_status_validator = EnumAttributeValidator.new('String', ['available', 'alert', 'unavailable'])\n return false unless stock_status_validator.valid?(@stock_status)\n return false if @categories.nil?\n true\n end",
"def valid?\n self.valid\n end"
] | [
"0.78992486",
"0.78992486",
"0.70971805",
"0.70782334",
"0.7032205",
"0.7031276",
"0.69510347",
"0.6869891",
"0.6858077",
"0.6858077",
"0.68287027",
"0.6823878",
"0.6820306",
"0.68144894",
"0.6794656",
"0.6752167",
"0.66843414",
"0.6676546",
"0.6667755",
"0.66296124",
"0.66184515",
"0.6608204",
"0.6599208",
"0.6594276",
"0.6584302",
"0.6580472",
"0.6578095",
"0.6558585",
"0.6555879",
"0.6542414",
"0.6536983",
"0.6533884",
"0.65315515",
"0.65311855",
"0.65267456",
"0.65258855",
"0.6520786",
"0.65205675",
"0.6511026",
"0.6498394",
"0.64966303",
"0.64935124",
"0.6491113",
"0.64885867",
"0.6479024",
"0.6473706",
"0.64679337",
"0.6467217",
"0.6461245",
"0.64601135",
"0.64553183",
"0.64540446",
"0.6447954",
"0.64393955",
"0.6434162",
"0.64312094",
"0.6428205",
"0.6426148",
"0.6412439",
"0.64070046",
"0.64044213",
"0.6403482",
"0.6399368",
"0.63979715",
"0.63858813",
"0.63855004",
"0.63855004",
"0.63855004",
"0.63855004",
"0.63740236",
"0.6367379",
"0.63645166",
"0.6362151",
"0.63599974",
"0.6357385",
"0.63549066",
"0.63549066",
"0.63549066",
"0.63549066",
"0.6354845",
"0.6354207",
"0.6350302",
"0.6344303",
"0.6344303",
"0.6344303",
"0.6344303",
"0.6344303",
"0.6344303",
"0.6344303",
"0.6344303",
"0.63435715",
"0.63406414",
"0.63344824",
"0.6333158",
"0.63313466",
"0.63294095",
"0.6327076"
] | 0.0 | -1 |
Checks equality by comparing each attribute. | def ==(o)
return true if self.equal?(o)
self.class == o.class &&
allow_3rd_party_billing == o.allow_3rd_party_billing &&
allow_cod == o.allow_cod &&
allow_purchase_order == o.allow_purchase_order &&
billing_addresses == o.billing_addresses &&
credit_cards == o.credit_cards &&
customer_profile_oid == o.customer_profile_oid &&
dhl_account_number == o.dhl_account_number &&
dhl_duty_account_number == o.dhl_duty_account_number &&
email == o.email &&
fedex_account_number == o.fedex_account_number &&
free_shipping == o.free_shipping &&
free_shipping_minimum == o.free_shipping_minimum &&
maximum_item_count == o.maximum_item_count &&
minimum_item_count == o.minimum_item_count &&
minimum_subtotal == o.minimum_subtotal &&
no_coupons == o.no_coupons &&
no_free_shipping == o.no_free_shipping &&
no_realtime_charge == o.no_realtime_charge &&
pricing_tiers == o.pricing_tiers &&
shipping_addresses == o.shipping_addresses &&
signup_dts == o.signup_dts &&
tax_exempt == o.tax_exempt &&
ups_account_number == o.ups_account_number
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(other)\n attributes == other.attributes\n end",
"def ==(other) # :nodoc:\n @attrs == other.attrs\n end",
"def eql?(other)\n return true if self == other\n @@ATTRIBUTES.each do |att|\n return false unless self.send(att).eql?(other.send(att))\n end\n true\n end",
"def assert_equal_attributes(object, expected_attributes)\n expected_attributes.each do |index, value|\n assert_equal value, object[index], \"#{index}\"\n end\n end",
"def attr_equal?(o)\n self == o and\n self.instance_variables_compare(o).empty? and\n self.attributes == o.attributes\n end",
"def same_attributes?(spec)\n @@attributes.all? {|name, default| self.send(name) == spec.send(name) }\n end",
"def ==(other)\n self.class.valid_attrs.each do |attr|\n return false if read(attr) != other.read(attr)\n end\n true\n end",
"def ==(other)\n self.attributes == (other.respond(:attributes) || {} )\n end",
"def ==(other)\n other.present? && self.attributes == other.attributes\n end",
"def ==(other)\n return false if other.nil? || !other.respond_to?(:attributes)\n attributes == other.attributes\n end",
"def match?(attributes)\n attributes.each do |attr, val|\n return false if send(attr).to_s != val.to_s\n end\n true\n end",
"def ==(other)\n self.class == other.class &&\n self.attributes == other.attributes\n end",
"def ==(other)\n self.class == other.class &&\n attributes == other.attributes\n end",
"def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.send(name) }\n end",
"def changed?(comparison)\n attributes.any? do |attribute, value|\n next unless comparison.key?(attribute)\n comparison[attribute] != value\n end\n end",
"def ==(other)\n return false unless self.class == other.class\n self.attributes == other.attributes\n end",
"def ==(other)\n if other.kind_of? Details::Attribute\n self.name == other.name && self.value == other.value\n else\n self.value == other\n end\n end",
"def ==(other)\n return false unless other.instance_of? self.class\n attributes == other.attributes\n end",
"def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.attributes[name] }\n end",
"def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.attributes[name] }\n end",
"def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.attributes[name] }\n end",
"def ==(other)\n Attribute === other && \n !(Expression === other) &&\n relation == other.relation && \n name == other.name && \n self.alias == other.alias && \n original_relation == other.original_relation\n end",
"def ==(obj)\n if obj.instance_of?(self.class)\n compare_attributes = [\"category_id\", \"combo_item_id\", \"quantity\", \"sequence\"]\n compare_attributes.each do |field|\n if self.send(field) != obj.send(field)\n return false\n end\n end\n return true\n end\n return false\n end",
"def ==(other)\n return false if other.class != self.class\n attr_hash == other.attr_hash\n end",
"def ==(other)\n case other\n when Chair::Row\n @attributes == other.instance_variable_get('@attributes')\n when Array\n @attributes.values == other\n else false\n end\n end",
"def == other\n return false unless other.kind_of? self.class\n attribute_of.all? do |key, val|\n val.get == other.__send__(key)\n end\n end",
"def correct_combination?(attr1, attr2, attr3)\n result = false\n if attr1 == attr2 && attr2 == attr3\n result = true\n elsif attr1 != attr2 && attr2 != attr3 && attr1 != attr3\n result = true\n end\n return result\n end",
"def ==(other)\n return false if self.class != other.class\n return super if @_lazer_model.required_properties.empty?\n @_lazer_model.required_properties.each do |key_name|\n return false if read_attribute(key_name) != other.read_attribute(key_name)\n end\n true\n end",
"def eql?(other)\n other.is_a?(self.class) && !self.class.comparison_attrs.find{|a| send(a) != other.send(a)}\n end",
"def verify_attributes(hash, expected)\n return [] unless expected.attributes\n expected.attributes.map{ |a| verify_attribute_value(hash[a.name.to_s], a) }\n end",
"def assert_attributes obj, attr_hash\n default_attr_hash = {}\n if obj.respond_to? :default_attr_hash\n default_attr_hash = obj.default_attr_hash\n end\n default_attr_hash.merge(attr_hash).each_pair do |key, value|\n assert_equal value, obj.__send__(key), \"Attribute #{key} of #{obj}\"\n end\n end",
"def match_attributes(attrs)\n attrs = Saxxy::Helpers.stringify_keys(attrs)\n attributes.reduce(true) do |b, (k, v)|\n value = attrs[k]\n b && ((!value.nil? && match(v, value)) || (v.nil? && value.nil?))\n end\n end",
"def equal_set(expected)\n message = \"#{Helpers.inspect_records(@object)} has the same records as #{Helpers.inspect_records(expected)}\"\n \n left = @object.map(&:id).sort\n right = expected.map(&:id).sort\n \n test_case.assert(left != right, message)\n end",
"def ===(other)\n required = self.class.required_attributes\n\n other.respond_to?(:keys) && (common = other.keys & required) &&\n common.size == other.keys.size && common.size == required.size\n end",
"def bt_same_value?(other)\n bt_value_attributes == other.bt_value_attributes\n end",
"def ==(x)\n return true if object_id == x.object_id\n return false unless x.kind_of?(AttrArray)\n each_with_index do |a, n|\n return false unless a == x[n]\n end\n true\n end",
"def equal_set(expected)\n message = \"#{Helpers.inspect_records(@object)} does not have the same records as #{Helpers.inspect_records(expected)}\"\n \n left = @object.map(&:id).sort\n right = expected.map(&:id).sort\n \n test_case.assert(left == right, message)\n end",
"def compare_attributes(data_criteria, criteria)\n return false unless data_criteria['dataElementAttributes']&.any?\n\n data_criteria['dataElementAttributes'].map { |dc| dc.except('_id') }.include? criteria['dataElementAttributes'][attribute_index].except('_id')\n end",
"def ==(other)\n @klass == other.class && @attributes == strip_active_record(other)\n end",
"def ==(other)\n other.is_a?(self.class) &&\n other.attribute == attribute &&\n other.validation == validation &&\n other.expected == expected &&\n other.actual == actual\n end",
"def == other\n return false unless self.class == other.class\n [:unit, :frequency, :anchor, :weeks, :monthdays, :weekdays, :times].all? do |attribute|\n self.send(attribute) == other.send(attribute)\n end\n end",
"def compare_equal?(item, line_item)\n ![\n :ax_account_number,\n :ax_account_id,\n :ax_order_number,\n :ax_order_id,\n :email_address,\n :first_name,\n :last_name,\n :serial_number,\n :purch_order_form_num\n ].detect { |attr| item.send(attr) != line_item.send(attr) }\n end",
"def ==(b) # :nodoc:\n ( b.respond_to?(:result_attributes) &&\n result_attributes == b.result_attributes && \n @result_attributes.all?{ |k| send(k) == b.send(k) } )\n end",
"def validates_different(*attr_names)\n validates_with ValidatesAll::DifferenceValidator, _merge_attributes(attr_names)\n end",
"def identical?\n #Song.first.attributes.each { |v,k| Song.find(:all, :conditions => [\" #{v} like ?\", \"%blah%\"])}\n Song.find(:all, :conditions => [\"name = ? or length = ?\", \"#{self.name}\", self.length]) do |x| \n x.hash == self.hash\n end\n end",
"def diff?(model = self.class.find(id))\n self.class.diffable_attributes.each do |attribute|\n return true if send(attribute) != model.send(attribute)\n end\n return false\n end",
"def filter_attributes_match?(hash_one, hash_two)\n hash_one.all? do |key, value_one|\n value_two = hash_two[key]\n case\n when value_one == value_two\n true\n when value_one.is_a?(Hash) && value_two.is_a?(Hash)\n filter_attributes_match?(value_one, value_two)\n when hash_one[key].to_s == hash_two[key].to_s\n true\n when value_one.is_a?(String) && value_one.start_with?(\"eval:\")\n eval_attribute_value(value_one, value_two)\n else\n false\n end\n end\n end",
"def comparable_attributes\n#\t\tHashWithIndifferentAccess[attributes.select {|k,v| \n#\t\t\t!Abstract.incomparable_attribute_names.include?(k)}]\n\t\tHashWithIndifferentAccess[attributes.select {|k,v| db_fields.include?(k)}]\n\tend",
"def all_equal?\n a = self.first\n all? { |b| a == b }\n end",
"def check_attrs(attr_list)\r\n attrs = []\r\n attr_list.each do |attr_sym|\r\n attr = assigns(attr_sym.to_sym)\r\n assert_not_nil attr, \"Attribute @#{attr_sym} should not be nil\"\r\n assert !attr.new_record?, \"Should have saved the @#{attr_sym} obj\" if attr.class == ActiveRecord\r\n attrs << attr\r\n end\r\n attrs.length > 1 ? attrs : attrs[0]\r\n end",
"def check_attrs(attr_list)\r\n attrs = []\r\n attr_list.each do |attr_sym|\r\n attr = assigns(attr_sym.to_sym)\r\n assert_not_nil attr, \"Attribute @#{attr_sym} should not be nil\"\r\n assert !attr.new_record?, \"Should have saved the @#{attr_sym} obj\" if attr.class == ActiveRecord\r\n attrs << attr\r\n end\r\n attrs.length > 1 ? attrs : attrs[0]\r\n end",
"def attr_set?(cards, attr)\n array = []\n cards.each do |card|\n # evalutes the string 'attr' and returns the value\n array << card.send(attr)\n end\n\n # only return true if it's all the same or totally different\n return true if array.uniq.count == 1\n return true if array.uniq.count == 3\n return false\n end",
"def attribute_changed?(attribute_name)\n (self.diff['attributes']['new']||{})[attribute] != (self.diff['attributes']['old']||{})[attribute]\n end",
"def eql?(other)\n return false if (other.nil? or self.class != other.class)\n return false unless super(other)\n return false unless self.attributes == other.attributes\n return false unless self.nodes == other.nodes\n true\n end",
"def eql?(other)\n return false unless self.class == other.class\n self.key_attributes == other.key_attributes\n end",
"def eql?(object)\n self.class.equal?(object.class) && attributes == object.attributes\n end",
"def uniquify_attributes(attributes)\n attributes.each do |ka|\n oldval = send(ka)\n next unless String === oldval\n newval = UniquifierCache.instance.get(self, oldval)\n set_property_value(ka, newval)\n logger.debug { \"Reset #{qp} #{ka} from #{oldval} to unique value #{newval}.\" }\n end\n end",
"def equals(rule)\n element == rule.element && attributes == rule.attributes\n end",
"def multi_element_attr_check( elements )\n wanted = Array.new\n found = Array.new\n elements.each do |element|\n print \".\"\n e = $driver.find_element(element[0].to_sym, element[1])\n wanted << [ element[1], element[2], element[3] ]\n found << [ element[1], element[2], e.attribute(element[2]) ]\n end\n\n found.should == wanted\n end",
"def attr_reader(*args)\n super\n comparison_attrs.concat(args)\n end",
"def xml_nodes_match_attrs(xml_nodes, attrs, mismatches = [])\n attrs.each_with_index.each { |attr_set, idx|\n xn = xml_nodes[idx]\n attr_set.each { |(attr_key, attr_val)|\n # Either call method, or hash key, or recurse on children\n # p.name vs. p[:name]\n if :children == attr_key\n # recurse over children\n xml_nodes_match_attrs(xn.children, attr_val, mismatches)\n else\n # compare attrs\n xn_val = xn.methods.include?(attr_key) ? xn.send(attr_key) : xn[attr_key]\n if xn_val != attr_val\n mismatches << { node: xn.name_and_class_path, attr: \"#{ attr_key }: expected #{ attr_val.inspect }, got #{ xn_val.inspect }\" }\n end\n end\n }\n }\n mismatches\n end",
"def matches_state_attrs?\n @expected_attrs == state_attrs\n end",
"def equal_list(expected)\n message = \"#{Helpers.inspect_records(@object)} has the same records as #{Helpers.inspect_records(expected)}\"\n \n left = @object.map(&:id)\n right = expected.map(&:id)\n \n test_case.assert(left != right, message)\n end",
"def eql?(other)\n return false unless super(other)\n return false unless attributes == other.attributes\n return false unless content == other.content\n\n true\n end",
"def ==(other)\n return true if other.equal?(self)\n return false unless other.instance_of?(self.class)\n\n self.class.attributes.inject(true) do |memo, attribute|\n attribute_name = attribute.first\n attribute_type = attribute.last[:type]\n\n # Skip associations\n if attribute_type.include?(LazyResource::Resource) || (attribute_type.is_a?(::Array) && attribute_type.first.include?(LazyResource::Resource))\n memo\n else\n memo && self.send(:\"#{attribute_name}\") == other.send(:\"#{attribute_name}\")\n end\n end\n end",
"def matches? item, attributes\n\n attributes.map { |attribute, value|\n\n item.send(attribute) == value\n\n }.flatten == [true]\n\n end",
"def ==( other ) \n\t\t\tcomparison_attributes = lambda{ |area| [ area.area_desc, area.altitude, area.ceiling, area.circles, area.geocodes, area.polygons ]}\n\t\t\tcomparison_attributes.call( self ) == comparison_attributes.call( other )\n\t\tend",
"def all_obs_same_attr?(observations, attr)\n exemplar = observations.first.send(attr)\n observations.all? { |o| o.send(attr) == exemplar }\n end",
"def eql?(*) end",
"def eql?(other)\n return true if equal?(other)\n return false unless self == other\n [:id, :fide_id, :rating, :fide_rating, :title, :gender].each do |m|\n return false if self.send(m) && other.send(m) && self.send(m) != other.send(m)\n end\n true\n end",
"def match\n @matches = attributes_enumerator.map do |(type, value), index|\n attribute_name = self.class.names[index]\n attributes.store(\n attribute_name, type.match(value, context: @context.dup)\n )\n end\n return if (failures = @matches.select(&:invalid?)).empty?\n failures.unshift(failure).reduce(:merge!)\n end",
"def ==(val)\n if val.is_a?(Model)\n # Use normal comparison for a model\n super\n else\n # Compare to attributes otherwise\n attributes == val\n end\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n attribute == o.attribute &&\n statistics == o.statistics &&\n other == o.other &&\n total == o.total &&\n missing == o.missing &&\n term_count == o.term_count &&\n term_type == o.term_type &&\n terms == o.terms\n end",
"def ==(*several_variants)\n #This is a stub, used for indexing\n end",
"def is_equal?(a)\n @amount == a.amount && @code == a.code\n end",
"def equal_list(expected)\n message = \"#{Helpers.inspect_records(@object)} does not have the same records as #{Helpers.inspect_records(expected)}\"\n \n left = @object.map(&:id)\n right = expected.map(&:id)\n \n test_case.assert(left == right, message)\n end",
"def comparison_attributes\n except_list = ['id', 'updated_at', 'created_at', 'verified_at']\n except_list << 'alternative_phone' unless Spree::Config[:alternative_shipping_phone]\n except_list << 'company' unless Spree::Config[:company]\n\n a = attributes.except(*except_list)\n a.each{|k, v|\n if v.is_a?(String)\n v = v.downcase.strip.gsub(/\\s+/, ' ')\n a[k] = v.present? ? v : nil\n end\n }\n a['state_name'] = nil if a['state_name'].blank?\n a\n end",
"def xml_should_eql(actual, expected)\n same = xml_cmp(actual, expected)\n actual.should.== expected unless same \nend",
"def multi_element_attr_match( elements )\n elements.each do |element|\n print \".\"\n wait_for_element(element[0].to_sym, element[1])\n check_attribute_match(element[0].to_sym, element[1], element[2], element[3])\n end\n end",
"def test_equality_simple\n value1_ = ::Versionomy.create(:major => 2, :minor => 0, :release_type => :alpha, :alpha_version => 5)\n value2_ = ::Versionomy.create(:major => 2, :release_type => :alpha, :alpha_version => 5)\n assert_equal(value2_, value1_)\n assert_equal(value2_.hash, value1_.hash)\n end",
"def ==(other)\n other.is_a?(self.class) &&\n name == other.name &&\n attributes == other.attributes\n end",
"def changes(attrs1, attrs2)\n old_attrs = attrs1.slice(*GENERATED_ATTRS)\n new_attrs = attrs2.slice(*GENERATED_ATTRS)\n\n return if old_attrs == new_attrs\n old_attrs.each do |k, v|\n next if new_attrs[k] == v\n @changes << Change.new(nil, k, v, new_attrs[k]) \n end\n end",
"def tdiff_equal(node)\n if (self.class == node.class)\n case node\n when Nokogiri::XML::Attr\n (self.name == node.name && self.value == node.value)\n when Nokogiri::XML::Element, Nokogiri::XML::DTD\n self.name == node.name\n when Nokogiri::XML::Text, Nokogiri::XML::Comment\n self.text == node.text\n when Nokogiri::XML::ProcessingInstruction\n (self.name == node.name && self.content = self.content)\n else\n false\n end\n else\n false\n end\n end",
"def ==(other)\n name == other.name &&\n color == other.color &&\n age == other.age\n end",
"def more_desirable?(attribute_id1, attribute_id2)\n attribute_id1 < attribute_id2\n end",
"def isSame(tab)\n for x in 0..3\n for y in 0..3\n return(false) if (self.val(x,y) != tab.val(x,y)) ;\n end\n end\n return true ;\n end",
"def ==(other)\n # If the classes don't match, they cannot possibly be equal.\n if self.class != other.class\n return false\n end\n\n # If the persisted state doesn't match, they also can never be equal.\n if persisted? != other.persisted?\n return false\n end\n\n # When persisted, check the other's id to see if it's the same,\n # cannot possible be equals if they have different ids.\n if persisted? && id != other.id\n return false\n end\n\n # Finally, compare the attributes hash. If all key/values match,\n # they are considered equal.\n attributes == other.attributes\n end",
"def ==(other)\n self.class == other.class &&\n attributes[\"_id\"] == other.attributes[\"_id\"]\n end",
"def assert_same_values(expected, actual)\n actual.each_pair do |k,v|\n next unless expected[k]\n assert_equal expected[k], v, \"Values for #{k} are not matching\"\n end\n end",
"def assert_equivalent_xml(expected, actual)\n expected_xml = Nokogiri::XML(\"<test-xml>\\n#{expected}\\n</test-xml>\")\n actual_xml = Nokogiri::XML(\"<test-xml>\\n#{actual}\\n</test-xml>\")\n ignored_attributes = %w(style data-disable-with)\n\n equivalent = EquivalentXml.equivalent?(expected_xml, actual_xml, {\n ignore_attr_values: ignored_attributes\n }) do |a, b, result|\n if result === false && b.is_a?(Nokogiri::XML::Element)\n if b.attr('name') == 'utf8'\n # Handle wrapped utf8 hidden field for Rails 4.2+\n result = EquivalentXml.equivalent?(a.child, b)\n end\n if b.delete('data-disable-with')\n # Remove data-disable-with for Rails 5+\n # Workaround because ignoring in EquivalentXml doesn't work\n result = EquivalentXml.equivalent?(a, b)\n end\n if a.attr('type') == 'datetime' && b.attr('type') == 'datetime-local'\n a.delete('type')\n b.delete('type')\n # Handle new datetime type for Rails 5+\n result = EquivalentXml.equivalent?(a, b)\n end\n end\n result\n end\n\n assert equivalent, lambda {\n # using a lambda because diffing is expensive\n Diffy::Diff.new(\n sort_attributes(expected_xml.root),\n sort_attributes(actual_xml.root)\n ).to_s(:color)\n }\n end",
"def sync_duplicate_obj_attributes(obj1, obj2)\n duplicate_keys.each do |key|\n unless obj1[key].blank? && obj2[key].blank?\n if obj1[key].blank?\n obj1.send(\"#{key}=\", obj2[key])\n elsif obj2[key].blank?\n obj2.send(\"#{key}=\", obj1[key])\n else # Each obj has a value\n if obj1[key] != obj2[key]\n raise ArgumentError, \"#{key} attribute values on the two objects don't match: #{obj1[key]} vs #{obj2[key]}\"\n end\n end\n end\n end\n end",
"def eql?(other)\n return true if equal?(other)\n\n # two instances for different models cannot be equivalent\n return false unless other.kind_of?(model)\n\n # two instances with different keys cannot be equivalent\n return false if key != other.key\n\n # neither object has changed since loaded, so they are equivalent\n return true if repository == other.repository && !dirty? && !other.dirty?\n\n # get all the loaded and non-loaded properties that are not keys,\n # since the key comparison was performed earlier\n loaded, not_loaded = properties.select { |p| !p.key? }.partition do |property|\n attribute_loaded?(property.name) && other.attribute_loaded?(property.name)\n end\n\n # check all loaded properties, and then all unloaded properties\n (loaded + not_loaded).all? { |p| p.get(self) == p.get(other) }\n end",
"def assert_event_are_light_equal e1, e2\n return false if e1.class != e2.class\n\n [:subject, :event, :moodid,\n :mood, :music, :location, :taglist, :pickeyword,\n :preformatted, :backdated, :comments, :security, :allowmask,\n :screening,].each do |attr|\n return false if e1.send(attr) != e2.send(attr)\n end\n\n e1.compare_time(e2)\n end",
"def eql(expected)\n set_relativity(:eql, expected)\n end",
"def modified?( original )\n DATA_ATTRIBUTES.any? { |e| send( e ) != original.send( e )}\n end",
"def ==(other)\n @name == other.name && @amount == other.amount\n end",
"def ==(other)\n other.kind_of?(self.class) &&\n @name == other.name && @columns == other.columns && @unique == other.unique?\n end",
"def match_same_name_attributes(*options)\n\n options = options.extract_options!\n same_name_attributes = @from_table.columns.map(&:name) & @to_table.columns.map(&:name)\n\n if same_name_attributes\n same_name_attributes = columns_from_options(same_name_attributes, options)\n same_name_attributes.each do |same_name_attribute|\n from same_name_attribute, :to => same_name_attribute\n end\n end\n end",
"def equal_pair(key, request)\n if @event[\"required\"][key] == request[\"object_attributes\"][key] || event[\"required\"][key] == \"\"\n true\n else\n false\n end\n end",
"def assert_equal(att, value, error = [att, :not_equal])\n assert value === send(att), error\n end",
"def validate\n matched = {}\n duplicated_attributes = []\n attributes.each do |attribute|\n if matched.has_key?(attribute.name) && matched[attribute.name] == attribute.name_format\n duplicated_attributes << attribute.name unless duplicated_attributes.include?(attribute.name)\n else\n matched[attribute.name] = attribute.name_format\n end\n end\n if !duplicated_attributes.empty?\n raise ValidationError, \"An attribute with the same name and name format may only be specified once. The following attributes were specified multiple times: #{duplicated_attributes.join(',')}\"\n end\n end"
] | [
"0.72932124",
"0.7189842",
"0.70406866",
"0.7007727",
"0.68881786",
"0.68621296",
"0.67085785",
"0.66622394",
"0.661674",
"0.6586541",
"0.65844727",
"0.65818226",
"0.65561724",
"0.6545535",
"0.6508076",
"0.64813215",
"0.64577025",
"0.64179385",
"0.6414028",
"0.6414028",
"0.6414028",
"0.6413171",
"0.6381426",
"0.63794506",
"0.6261132",
"0.6248216",
"0.62396336",
"0.62170404",
"0.62027985",
"0.6185393",
"0.6183358",
"0.61645603",
"0.6130997",
"0.6116409",
"0.60984176",
"0.6085103",
"0.60793746",
"0.60665256",
"0.6007008",
"0.59990627",
"0.59962237",
"0.5992054",
"0.59861875",
"0.59839666",
"0.59775484",
"0.59522015",
"0.5942759",
"0.59304726",
"0.5926056",
"0.5919373",
"0.5919373",
"0.59087664",
"0.58807796",
"0.58804125",
"0.5872191",
"0.5858762",
"0.58584523",
"0.5856515",
"0.58547515",
"0.5848128",
"0.584702",
"0.5838001",
"0.580043",
"0.57966435",
"0.5789952",
"0.5782547",
"0.57804406",
"0.5776911",
"0.5768212",
"0.5760853",
"0.57585114",
"0.5754842",
"0.57537735",
"0.5751662",
"0.5739966",
"0.57313424",
"0.57282376",
"0.57258046",
"0.57248116",
"0.57227004",
"0.57146037",
"0.57104737",
"0.5706446",
"0.57053125",
"0.5702263",
"0.56904846",
"0.56762695",
"0.5645565",
"0.5641733",
"0.56226075",
"0.56152636",
"0.55932444",
"0.5588176",
"0.5585386",
"0.55700636",
"0.55527586",
"0.55477995",
"0.5546062",
"0.5543475",
"0.55395126",
"0.55284184"
] | 0.0 | -1 |
Calculates hash code according to all attributes. | def hash
[allow_3rd_party_billing, allow_cod, allow_purchase_order, billing_addresses, credit_cards, customer_profile_oid, dhl_account_number, dhl_duty_account_number, email, fedex_account_number, free_shipping, free_shipping_minimum, maximum_item_count, minimum_item_count, minimum_subtotal, no_coupons, no_free_shipping, no_realtime_charge, pricing_tiers, shipping_addresses, signup_dts, tax_exempt, ups_account_number].hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash\n code = 17\n code = 37*code + @x.hash\n code = 37*code + @y.hash\n # Add lines like this for each significant instance variable\n code # Return the resulting code\n end",
"def hash(*) end",
"def hash\n code = 17\n code = 37 * code\n self.instance_variables.each do |v|\n code += self.instance_variable_get(v).hash\n end\n code\n end",
"def hash_code; end",
"def calculate_hash!\n prefix = PREFIX_NAME_LOOKUP[self.type]\n # add special cases for refs\n self.hash_id = NodeId.sha1(\"#{prefix} #{self.size}\\0#{self.content}\")\n end",
"def hash() #:nodoc:\n prime = 31;\n result = 1;\n result = prime * result + @amount.to_i\n result = prime * result + @new_balance.to_i\n result = prime * result + (@date.nil? ? 0 : Bankjob.date_time_to_ofx(@date).hash);\n result = prime * result + (@raw_description.nil? ? 0 : @raw_description.hash);\n result = prime * result + (@type.nil? ? 0 : @type.hash);\n # don't use value date\n return result;\n end",
"def hash\n prime = 31\n result = 1\n result = result * prime + (@decision_target == nil ? 0 : @decision_target.hash)\n result = prime * result + (@string_id == nil ? 0 : @string_id.hash)\n result\n end",
"def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end",
"def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end",
"def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end",
"def hash\r\n a = 0\r\n @id.each_byte {|c| a += c.to_i}\r\n (a + @paired.to_i) * HASH_PRIME\r\n end",
"def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end",
"def hash\n size.hash ^ rank.hash\n end",
"def hash\n \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end",
"def hash\n @hash || calculate_hash!\n end",
"def hash\n return name.hash ^ direction.hash ^ lhs.hash ^ rhs.hash\n end",
"def hash\n value = 0\n my_rows = @rows\n r_size = my_rows.size\n for i in 0..r_size-1 do\n a_row = my_rows[i]\n a_size = a_row.size\n for j in 0..a_size-1 do\n value ^= a_row[j].hash\n end\n end\n return value\n end",
"def hash\n id.hash + 32 * bs_request.hash\n end",
"def do_hash(input)\n a = OpenSSL::Digest.hexdigest(\"SHA224\", input).to_i % 19\n b = OpenSSL::Digest.hexdigest(\"SHA512\", input).to_i % 19\n [a, b]\n end",
"def hash\n type.hash ^ (id.hash >> 1)\n end",
"def hash\n [self.class, self.val, self.attribute].hash\n end",
"def hash\n 0\n end",
"def hash # :nodoc:\n identifier.hash ^ requirement.hash\n end",
"def hash\n self.class.hash ^ key_attributes.hash\n end",
"def hash\n return super unless has_size?\n\n res = 0\n each do |el|\n res += el.hash\n end\n return res\n end",
"def hash\n h = @e.nil? ? 0 : @e\n h = (h << 1) ^ @r.hash\n h = (h << 1) ^ @v.hash\n end",
"def hash() source.hash ^ (target.hash+1); end",
"def hash() source.hash ^ (target.hash+1); end",
"def hash\n\t\t\"#{@x}#{@y}\".hash\n\tend",
"def hash #:nodoc:\n __getobj__.hash ^ self.class.hash\n end",
"def hash\n Zlib.crc32(to_a.map(&:to_s).sort.to_s)\n end",
"def hash_code\n prime = 31\n result = 1\n result = prime * result + x\n result = prime * result + y\n return result;\n end",
"def hash\n self.class.hash ^ operand.hash\n end",
"def hash!\n\t\t@@email.downcase!\n\t\thash = Digest::MD5.hexdigest(@@email)\n\t\treturn hash\n\tend",
"def hash\n [anchor, cv, nullifier, proof, rk, spend_auth_sig].hash\n end",
"def hash\n ([self.class] + self.class.comparison_attrs.map{|x| send(x)}).hash\n end",
"def hash\n @symbols.hash + 37*positive?.hash\n end",
"def calculate_unique_hash\n unique = ''\n unique += self.content if self.content.present?\n unique += self.summary if self.summary.present?\n unique += self.title if self.title.present?\n self.unique_hash = Digest::MD5.hexdigest unique\n end",
"def hash()\n #This is a stub, used for indexing\n end",
"def hash\n # Memoizing such a simple hash value seems silly, however the\n # profiler showed the Card#hash method as having 22% of the runtime. My\n # memoizing the hash value that was reduced to 12%.\n return @hash unless @hash.nil?\n @hash = @value.hash ^ @suit.hash\n end",
"def hash=(_arg0); end",
"def block_hash\n\t\tdigest = Digest::SHA2.new\n\n\t\tdigest << '%d' % [ self.index ]\n\t\tdigest << self.timestamp.strftime( '%s%N' )\n\t\tdigest << self.payload\n\t\tdigest << self.payload_hash\n\t\tdigest << self.proof.to_s\n\t\tdigest << self.previous_hash\n\t\t\n\t\treturn digest.hexdigest\n\tend",
"def hash\n num = 0\n self.each do |k,v|\n if k.is_a?(Integer) && v.is_a?(Integer)\n num += k * 26 + v\n elsif k.is_a?(Integer) && !v.is_a?(Integer)\n num += k * 26 + ALPHA_NUMBERS[v.to_s.downcase]\n elsif v.is_a?(Integer) && !k.is_a?(Integer)\n num += v * 26 + ALPHA_NUMBERS[k.to_s.downcase]\n elsif !k.nil? && !v.nil?\n num += ALPHA_NUMBERS[k.to_s.downcase] * ALPHA_NUMBERS[v.to_s.downcase]\n end\n end\n num\n end",
"def hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend",
"def hash\n return @hash_code if defined? @hash_code\n @hash_code = usual_equal_object.hash\n end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash\n [oct, pc].hash\n end",
"def hash\n excl = @excl ? 1 : 0\n hash = excl\n hash ^= @begin.hash << 1\n hash ^= @end.hash << 9\n hash ^= excl << 24;\n # Are we throwing away too much here for a good hash value distribution?\n return hash & Fixnum::MAX\n end",
"def hash\n code.hash\n end",
"def hash # :nodoc:\n name.hash ^ type.hash ^ requirement.hash\n end",
"def hash\n @vbits.hash\n end",
"def hash\n Digest::SHA256.hexdigest( \"#{nonce}#{time}#{difficulty}#{prev}#{data}\" )\n end",
"def hash\n if @sha512hash != nil\n return @sha512hash.to_i(16)\n else\n super\n end\n end",
"def calc_hash(pass)\n salt_cost = SCrypt::Engine.autodetect_cost(self[:salt])\n SCrypt::Engine.scrypt(pass, self[:salt], salt_cost, 32).unpack('H*').first\n end",
"def hash\n [lac, cid, radio, mcc, mnc, signal, psc, asu, ta].hash\n end",
"def calculate_checksum\n last_checksum = previous_event&.checksum\n attrs = attributes.except(\"checksum\", \"id\", \"updated_at\").merge(last_checksum: last_checksum)\n cs = Digest::SHA256.hexdigest(attrs.to_s)\n puts \"#{id} calculate_checksum: #{cs} <- #{attrs} \" if Rails.env.development?\n Rails.logger.info(\"#{id} calculate_checksum: #{cs} <- #{attrs} \")\n return cs\n end",
"def hash\n code.hash\n end",
"def hash\n\t\t[@a, @b, self.class::D].hash\n\tend",
"def consistent_hash\n Zlib.crc32(self.to_yaml, 0)\n end",
"def hash\n @hash[:perm_type].hash ^\n @hash[:perms].hash ^\n @hash[:inheritance].hash ^\n @hash[:target].hash\n end",
"def hash( *strs )\n return Digest::MD5.hexdigest( strs.join )\n end",
"def hash\n @rank.hash ^ @suit.hash\n end",
"def hash\n return Digest::MD5.hexdigest(self.describe(' '))\n end",
"def hash\n @real.hash ^ @image.hash\n end",
"def to_hash() end",
"def hash_length\n super\n end",
"def hash_hash(h)\n require 'digest/md5'\n Digest::MD5.hexdigest(Marshal::dump(h.sort))\n end",
"def hash() source.hash ^ target.hash; end",
"def hash\n [first_name, last_name, address_one, address_two, city, state, zip, phone, email, country_code].hash\n end",
"def calculate_hash(input, prep_hashes)\n result = 0\n input.unpack('U*').each do |x|\n result += prep_hashes.hash(x)\n end\n (result % MOD_VALUE).to_s(HEX)\nend",
"def c_hash\n sha256 = Digest::SHA256.new\n token = @code.token.token\n hashed_token = sha256.digest(token)\n first_half = hashed_token[0...hashed_token.length / 2]\n Base64.urlsafe_encode64(first_half).tr('=', '')\n end",
"def hash(block)\n Digest::SHA256.hexdigest(block.to_s.encode)\n end",
"def calculate_hash\n\t\toptions = {:firstname => firstname, :email => email, :phone => phone, :txnid => txnid, :surl => surl, :furl => furl, :productinfo => productinfo, :amount => amount}\n\t\tservice = PayuIndia::Helper.new(payment_gateway_key, payment_gateway_salt, options)\n\t\tself.hast = service.generate_checksum\n\tend",
"def hash\n [rank, suit].hash\n end",
"def hash\n self.class.hash ^ left.hash ^ right.hash\n end",
"def generate_hash(*args)\n Digest::SHA3.hexdigest(args.join(''))\n end",
"def hash_code\n hash_code = {}\n self.seq.each do |letter|\n hash_code.keys.include?(letter) ? hash_code[letter] += 1 : hash_code[letter] = 1\n end\n hash_code\n end",
"def hashify_attributes(attrs)\n Hash.new.tap{ |h| attrs.each{|a| h[a] = self.send(a)} }\n end",
"def hash\n\n self.h.fei.hash\n end",
"def hash\n shasum.hash\n end",
"def hash\n shasum.hash\n end",
"def hash\n shasum.hash\n end",
"def hash\n attributes.hash\n end",
"def hash\n attributes.hash\n end"
] | [
"0.7118691",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.68960655",
"0.67847186",
"0.6707762",
"0.670052",
"0.6688737",
"0.66705376",
"0.6489735",
"0.6462376",
"0.6462376",
"0.64444333",
"0.6413127",
"0.6395483",
"0.63898623",
"0.6372129",
"0.635671",
"0.63370055",
"0.62682766",
"0.62533766",
"0.6246914",
"0.6230963",
"0.62173444",
"0.6214272",
"0.6214131",
"0.61962456",
"0.619165",
"0.61866295",
"0.6185355",
"0.6185355",
"0.6153702",
"0.6145376",
"0.6144877",
"0.6139152",
"0.6128312",
"0.61224943",
"0.61217207",
"0.61205214",
"0.61041045",
"0.61000645",
"0.60937095",
"0.60931146",
"0.60818595",
"0.60811466",
"0.60500103",
"0.60322344",
"0.6022704",
"0.6020012",
"0.6020012",
"0.6020012",
"0.6020012",
"0.6020012",
"0.6020012",
"0.6020012",
"0.6020012",
"0.6020012",
"0.6020012",
"0.60178953",
"0.6014942",
"0.5997442",
"0.59880185",
"0.598736",
"0.59799886",
"0.5972682",
"0.5969595",
"0.5969411",
"0.59594935",
"0.5957466",
"0.59423596",
"0.5942144",
"0.59245354",
"0.5924357",
"0.5904946",
"0.59025365",
"0.58536685",
"0.5847055",
"0.58454466",
"0.5845053",
"0.58447546",
"0.5844059",
"0.5842638",
"0.5840575",
"0.58391696",
"0.5825819",
"0.5824118",
"0.5823615",
"0.58184344",
"0.5815284",
"0.58124787",
"0.5810309",
"0.5808056",
"0.5808056",
"0.5808056",
"0.5806852",
"0.5806852"
] | 0.0 | -1 |
Builds the object from hash | def build_from_hash(attributes)
return nil unless attributes.is_a?(Hash)
self.class.swagger_types.each_pair do |key, type|
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the attribute
# is documented as an array but the input is not
if attributes[self.class.attribute_map[key]].is_a?(Array)
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
end
elsif !attributes[self.class.attribute_map[key]].nil?
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
end # or else data not found in attributes(hash), not an issue as the data can be optional
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(hash)\n obj = new\n hash.each_pair do |k,v|\n obj[k] = v if variables[k]\n end\n return obj\n end",
"def build_from_hash(attributes)\n\n end",
"def build_from_hash(hash)\n instance = self.new\n\n # Add the instance attributes dynamically from the hash. If the attribute\n # does not already exist, then don't re-add the attribute class and\n # variable, just set it with the value from the hash\n hash.keys.each do |key|\n class_eval { attr_accessor key } unless instance.methods.include?(key.to_sym)\n instance.instance_variable_set \"@#{key}\", hash[key]\n end\n\n instance\n end",
"def build(hash, track_changes = true)\n resource = fields.each_with_object(new) do |field, r|\n value = hash.fetch(field.to_s, hash[field.to_sym])\n r.send(\"#{field}=\", value)\n end\n resource.clear_changes! unless track_changes\n resource\n end",
"def initialize hash\n @hash = hash\n end",
"def build(params)\n return new(params) if params.is_a?(Hash)\n raise(\"unexpected parameter, expected Hash, received #{params.class}\")\n end",
"def initialize( hash )\n\t\t\t@hash = hash.dup\n\t\t\t@dirty = false\n\t\tend",
"def initialize(a_hash)\n from_h(a_hash)\n end",
"def initialize\n\t\t\t@hash = {}\n\t\tend",
"def initialize(hash)\n @hash = hash\n @converted = {}\n end",
"def initialize(hash)\n @short_code = hash[\"short_code\"]\n @name = hash[\"name\"]\n @id = hash[\"id\"]\n end",
"def initialize(hash)\n super(hash)\n end",
"def initialize\n @h = new_hash\n end",
"def new_from_hash(hash)\n if hash == nil\n self.class.new.assign(self)\n else\n hash_obj = hash\n if hash.instance_of?(Hash)\n hash_obj = self.class.new\n merge_hash_into_object(hash, hash_obj)\n end\n instance = self.class.new\n object_assign(instance, hash_obj)\n end\n end",
"def initialize(hash={})\n @hash = hash\n end",
"def initialize\n @hash = {}\n end",
"def initialize\n @hash = {}\n end",
"def initialize(hash)\r\n hash.each { |k, v|\r\n # Create getters and setters\r\n self.class.attr_accessor(k)\r\n # Set value for created variable\r\n self.send(\"#{k}=\", v)\r\n }\r\n self.class.all.push(self)\r\n end",
"def build!(hash)\n hash.must(::Hash) { raise ArgumentError, \"#{self} expects Hash, but got #{hash.class}\" }\n\n if hash.size != variables.size\n keys1 = variables.keys\n keys2 = hash.keys.map(&:to_s)\n minus = (keys1 - keys2).map{|i| \"-#{i}\"}\n plus = (keys2 - keys1).map{|i| \"+#{i}\"}\n \n msg = \"#{self} expects #{variables.size}, but got #{hash.size} (%s)\" % (minus + plus).join(\",\")\n raise Typed::SizeMismatch, msg\n end\n\n # 'build' just ignore unknown fields, but 'build!' raise errors\n obj = new\n hash.each_pair do |k,v|\n obj[k] = v\n end\n return obj\n end",
"def initialize(hash)\n @cw_id = hash[\"cw_id\"]\n @cik = hash[\"cik\"]\n @name = hash[\"company_name\"]\n @irs_number = hash[\"irs_number\"]\n @sic_code = hash[\"sic_code\"]\n @industry = hash[\"industry_name\"]\n @sic_sector = hash[\"sic_sector\"]\n @sector_name = hash[\"sector_name\"]\n @source_type = hash[\"source_type\"]\n @address = hash[\"raw_address\"]\n @country = hash[\"country_code\"]\n @state = hash[\"subdiv_code\"]\n @top_parent_id = hash[\"top_parent_id\"]\n @num_parents = hash[\"num_parents\"]\n @num_children = hash[\"num_children\"]\n @max_year = hash[\"max_year\"]\n @min_year = hash[\"min_year\"]\n end",
"def from_hash(hash)\n instance = allocate\n instance.instance_variable_set :@attributes, hash.freeze\n instance\n end",
"def from_hash(hash)\n hash = DEFAULTS.merge(hash)\n hash['spdx_id'] = hash.delete('spdx-id')\n ordered_array = hash.values_at(*members.map(&:to_s))\n new(*ordered_array)\n end",
"def initialize(hash=nil)\n @table = HashWithIndifferentAccess.new\n\n for k,v in hash\n @table[k] = v\n new_ostruct_member(k)\n end if hash\n end",
"def from_hash(hash)\n hash.each_pair do |key, value|\n\n # We need to catch hashes representing child objects\n # If the hash key:value is a of a Hash/BSON:Ordered hash\n if hash[key].class == Hash || hash[key].class == BSON::OrderedHash\n # If we have a classname we know we need to return to an object\n if hash[key][\"@classname\"]\n self.instance_variable_set(key, ::Object::full_const_get(hash[key][\"@classname\"]).new(hash[key])) unless key.to_s.start_with?(\"_\")\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n end\n end",
"def from_hash(hash)\n hash.each_pair do |key, value|\n\n # We need to catch hashes representing child objects\n # If the hash key:value is a of a Hash/BSON:Ordered hash\n if hash[key].class == Hash || hash[key].class == BSON::OrderedHash\n # If we have a classname we know we need to return to an object\n if hash[key][\"@classname\"]\n self.instance_variable_set(key, ::Object::full_const_get(hash[key][\"@classname\"]).new(hash[key])) unless key.to_s.start_with?(\"_\")\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n end\n end",
"def initialize(hash)\n @hash = hash\n @data = resourcify_data\n end",
"def from_hash hash\n @id= hash['id']\n\n @admin= hash['admin']\n @username= hash['username']\n @timezone= hash['timezone']\n @email_address= hash['email_address']\n\n @password = nil\n\n @created_at= DateTime.parse(hash['created_at'])\n @updated_at= DateTime.parse(hash['updated_at'])\n end",
"def hash_to_obj hash\n OpenStruct.new(hash) rescue raise ConfigError, \"Can't convert setup to object\"\n end",
"def initialize(hash)\n load_hash(hash)\n end",
"def from_hash( h)\n\t\th.each { |name,attributes|\n\t\t\tklass = Klass.new\n\t\t\tklass.from_hash( { name => attributes } )\n\t\t\tself.add_class( klass)\n\t\t}\n\n\t\t# this is an experiment in handling \"through\" attributes\n\t\t# i.e. enriching the model with the join classes\n\tend",
"def initialize(*args)\n super\n # hash = {}\n end",
"def build_object(resp)\n return resp unless resp.respond_to?(:merge)\n @build_object ||= final_object_class.new(resp.merge(additional_hash_to_serialize_after_response))\n end",
"def from_hash(hash)\n ordered_array = hash.values_at(*members.map(&:to_s))\n new(*ordered_array)\n end",
"def __convert hash #:nodoc:\n instance = self.class.new\n hash.each do |k, v|\n k = k.to_s if !k.respond_to?(:to_sym) && k.respond_to?(:to_s)\n instance.new_ostruct_member k\n if v.is_a?(Hash)\n v = v[\"type\"] == \"hash\" ? v[\"contents\"] : __convert(v)\n elsif v.is_a?(Array)\n v = v.map{|e| e.instance_of?(Hash) ? __convert(e) : e}\n end\n instance.send \"#{k}=\".to_sym, v\n end\n instance\n end",
"def initialize(hash)\n\t\t@id = hash['id']\n\t\t@first_name = hash['first_name']\n\t\t@last_name = hash['last_name']\n\t\t@mentor = hash['mentor']\n\tend",
"def initialize(hash={})\n @name = validate_name(hash[:name])\n @description = hash[:description]\n @snmp_opts = hash[:snmp_opts]\n\n save # Save a copy of self to Redis on creation\n end",
"def initialize\n @hash_dict = {}\n end",
"def initialize(hash=nil)\n @attributes = hash\n @attributes ||= {}\n end",
"def initialize(hash={})\n self.init_attrs_from_hash(hash)\n end",
"def from_hash(hash)\n apply_nested_hash(hash)\n end",
"def initialize(hash)\n # @id = hash[\"id\"]\n # @street_address = hash[\"street_address\"]\n # @city = hash[\"city\"]\n # @state = hash[\"state\"]\n # @zipcode = hash[\"zipcode\"]\n # @country = hash[\"country\"]\n\n #add in correct details\n end",
"def from_hash(hash)\n @data_object.user_acc_name = hash['user_acc_name']\n @data_object.user_affiliate = hash['user_affiliate']\n @user_over_13 = hash['user_over_13']\n\n contact.from_hash(hash)\n end",
"def initialize(hash)\n @name = hash[\"campaign\"] #decided to change it to \"name\" since this is the campaign class\n date_elements = hash[\"date\"].split(\"/\") #date is being passed in as a string, need this array to create the Date object in the next line\n @date = Date.new(date_elements[2].to_i + 2000, date_elements[0].to_i, date_elements[1].to_i) #added 2000 to year since the program was considering it as the year 15; this creates the date object\n @spend = hash[\"spend\"].to_f #use .to_f to make sure spend comes in as a float instead of a string\n @impressions = hash[\"impressions\"].to_i #need it as an integer for counting purposes later\n @actions = JSON.parse(hash[\"actions\"])#ensures that each action comes in as an array instead of a string\n @@all << self #shovels it into the all array\n end",
"def initialize(hash)\n hash.each do |k, v|\n self.send(\"#{k}=\", v) if self.respond_to?(\"#{k}=\")\n end\n @id = hash[\"id\"]\n end",
"def initialize (hash)\n hash.each {|key, value|\n self.class.attr_accessor(key)\n self.send((\"#{key}=\"), value)\n }\n @@all << self\n end",
"def initialize(hash={})\n @data = Hash.new\n hash.each do |key, value|\n self[key] = value\n end\n end",
"def create_from_hash(hash, opts={})\n create_opts = update_or_create_options(hash, opts)\n create { |instance| instance.set(create_opts) }\n end",
"def initialize(hash={})\n # assign the attributes here (???)\n hash.each do |k, v| # name = id, name, etc.\n self.send(\"#{k}=\", v)\n # self.k = v # there's no '.k' method\n #binding.pry\n end\n end",
"def initialize(hash) #.new\n @name = hash[:name][0]\n @region = hash[:region]\n @population = hash[:population]\n @capital = hash[:capital]\n @flag_link = hash[:flag_link]\n @@all << self\n #binding.pry\n end",
"def initialize(hash = {})\n super(hash)\n\n @action = extract_value(hash, :action)\n @clientId = extract_value(hash, :clientId)\n @clientIdAlias = extract_value(hash, :clientIdAlias)\n @clientIdAliasUsed = extract_boolean_value(hash, :clientIdAliasUsed)\n @expiresAt = extract_integer_value(hash, :expiresAt)\n @subject = extract_value(hash, :subject)\n @scopes = extract_value(hash, :scopes)\n @existent = extract_boolean_value(hash, :existent)\n @usable = extract_boolean_value(hash, :usable)\n @sufficient = extract_boolean_value(hash, :sufficient)\n @refreshable = extract_boolean_value(hash, :refreshable)\n @responseContent = extract_value(hash, :responseContent)\n @properties = extract_array_value(hash, :scopes) do |element|\n Authlete::Model::Property.parse(element)\n end\n end",
"def initialize( hash )\n\t\t@object_classes = self.parse_objectclasses( hash['objectClasses'] || [] )\n\t\t@attribute_types = self.parse_attribute_types( hash['attributeTypes'] || [] )\n\t\t@ldap_syntaxes = self.parse_ldap_syntaxes( hash['ldapSyntaxes'] || [] )\n\t\t@matching_rules = self.parse_matching_rules( hash['matchingRules'] || [] )\n\t\t@matching_rule_uses = self.parse_matching_rule_uses( hash['matchingRuleUse'] || [] )\n\tend",
"def from_hash(hash)\n super(hash)\n verify\n end",
"def objects_from_serialized_hash(hash) # :nodoc:\n klass, attributes = Helpers.to_class_and_attributes(hash)\n klass.from_seedable_attributes(attributes)\n end",
"def initialize (hash)\n @name = hash [:name]\n @color = hash [:color]\n @robots = hash [:robots]\n @moon_count = hash [:moon_count]\n @cats = hash [:cats]\n #@solar_rotation = solar_rotation .....I dont really understand what a solar rotation is.... it's confusing.....\n @distance_from_the_sun = hash [:distance_from_the_sun]\n end",
"def initialize(hash = nil)\n @arguments = 0\n return if hash.nil?\n @name = hash['name']\n @arguments = hash['arguments']\n end",
"def _from_hash(hsh)\n hsh.each do |k, v|\n v = restore_hash(v)\n v = v.map { |iv| restore_hash(iv) } if v.is_a?(Array)\n send(:\"#{k}=\", v)\n end\n self\n end",
"def from_hash(hash)\n struct = SparkleStruct.new\n struct._camel_keys_set(:auto_discovery)\n struct._load(hash)\n struct._camel_keys_set(nil)\n struct\n end",
"def from_hash(hash)\n struct = SparkleStruct.new\n struct._camel_keys_set(:auto_discovery)\n struct._load(hash)\n struct._camel_keys_set(nil)\n struct\n end",
"def initialize(hash={})\n self.attributes = hash\n end",
"def initialize(raw_hash)\n if valid_hash?(raw_hash)\n self.replace(raw_hash)\n @version, @cost, @salt, @checksum = split_hash(self)\n else\n raise Errors::InvalidHash.new(\"invalid hash\")\n end\n end",
"def initialize(raw_hash)\n if valid_hash?(raw_hash)\n self.replace(raw_hash)\n @version, @cost, @salt, @checksum = split_hash(self)\n else\n raise Errors::InvalidHash.new(\"invalid hash\")\n end\n end",
"def build(base, object, type = nil, selected_fields = nil)\n return object unless object.is_a?(Hash)\n if _loading?\n Factory.from_db(klass, object, nil, selected_fields)\n else\n Factory.build(klass, object)\n end\n end",
"def initialize(hash)\n super(hash)\n @size = hash[\"size\"]\n end",
"def initialize(raw_hash)\n if valid_hash?(raw_hash)\n self.replace(raw_hash)\n @cost, @salt, @digest = split_hash(self.to_s)\n else\n raise Errors::InvalidHash.new(\"invalid hash\")\n end\n end",
"def instantiate hash, extra_attributes={}\n return hash unless hash.kind_of? Hash\n# init = hash.values_at(*@singulars).compact.first\n init = hash[@singular]\n inits = hash[@plural]\n if init\n new init.merge extra_attributes\n elsif inits\n inits.map {|each| new each.merge extra_attributes}\n else\n hash\n end\n end",
"def from_hash(values)\n @data_object.team_challenge = values['team_challenge']\n @data_object.team_level = values['team_level']\n @data_object.team_name = values['team_name']\n\n# @mgr_email = values['mgr_email']\n\n names = values['tm_name']\n\n TeamMember::MEMBERS_PER_TEAM.times do |i|\n if names[i].empty?\n @members[i].clear\n else\n @members[i].tm_name = names[i]\n @members[i].tm_grade = values['tm_grade'][i].to_i\n @members[i].tm_dob_mon = values['tm_dob_mon'][i]\n @members[i].tm_dob_day = values['tm_dob_day'][i]\n @members[i].tm_dob_year = values['tm_dob_year'][i]\n @members[i].tm_sex = values['tm_sex'][i]\n end\n end\n end",
"def hash\n { hash: @hash, hashType: @hash_type }\n end",
"def initialize(raw_hash)\n raise Errors::InvalidHash, 'invalid hash' unless valid_hash?(raw_hash)\n\n replace(raw_hash)\n\n @cost, @salt, @digest = split_hash(to_s)\n end",
"def initialize( confighash={} )\n\t\tihash = internify_keys( untaint_values(confighash) )\n\t\tmergedhash = DEFAULTS.merge( ihash, &HashMergeFunction )\n\n\t\t@struct = ConfigStruct.new( mergedhash )\n\t\t@create_time = Time.now\n\t\t@name = nil\n\t\t@loader = nil\n\n\t\tsuper()\n\tend",
"def initialize(*args)\n @hash = HashWithIndifferentAccess.new(*args)\n end",
"def create(hash={})\n model = self.new(hash)\n model.save\n model\n end",
"def from_hash(hash:, klass:)\n validate_class_kit(klass)\n\n @hash_helper.indifferent!(hash)\n entity = klass.new\n attributes = @attribute_helper.get_attributes(klass)\n attributes.each do |attribute|\n key = attribute[:name]\n type = attribute[:type]\n\n #if the hash value is nil skip it\n next if hash[key].nil?\n\n value = if is_class_kit?(type)\n from_hash(hash: hash[key], klass: type)\n elsif type == Array\n hash[key].map do |array_element|\n if attribute[:collection_type].nil?\n array_element\n else\n if is_class_kit?(attribute[:collection_type])\n from_hash(hash: array_element, klass: attribute[:collection_type])\n else\n @value_helper.parse(type: attribute[:collection_type], value: array_element)\n end\n end\n end\n else\n hash[key]\n end\n\n entity.public_send(:\"#{key}=\", value)\n end\n\n entity\n end",
"def from_h(hash, converter = nil)\n instance = new\n\n hash.each do |k, v|\n v = convert(v, k, converter) if converter\n instance.instance_variable_set(:\"@#{k}\", v)\n end\n\n instance\n end",
"def initialize(hash_that_represents_json)\n\t\t@data = hash_that_represents_json\n\tend",
"def hash_for_merging(hash)\n new_hash = { id: hash['message_id'].to_i,\n date: Time.at(hash['date'].to_i),\n from: User.new(hash['from'], @bot),\n chat: Chat.new(hash['chat'], @bot) }\n\n type = TYPES.find { |t| hash[t.to_s] }\n new_hash[type] = hash[type.to_s] # TODO: fail if type not found\n\n new_hash\n end",
"def initialize(hash)\n @header = Msg::Header.new(hash)\n @body = Msg::Body.new(content_is_json?, hash)\n end",
"def build_resource(hash = {})\n self.resource = resource_class.new(hash)\n end",
"def initialize()\n @hash = {}\n @values = []\n end",
"def build\n fail \"Please provide a value for key, currently: #{key}\" if key.nil?\n\n if in_key\n { in_key.to_sym => { key => data } }\n else\n process_data\n transform_to_hash\n end\n end",
"def initialize(build)\n @build = build\n @hash = {}\n @already_run = []\n end",
"def new_from_hash_marketplace(h)\n self.url = h\n h=h.split('/')\n h=h[h.size-2]\n self.original_id = h\n return self\n end",
"def initialize(hash, type, dump)\n self.hash = hash\n self.type = type.to_sym\n self.dump = dump\n end",
"def initialize(hash_data, opts: {})\n @hsh = hash_data\n @opts = opts\n\n @title = @hsh[:title]\n @body = @hsh[:body_hash]\n end",
"def initialize(hash)\n @color = hash[:color]\n @scent = hash[:scent]\n end",
"def initialize(hash = nil)\n hash.each { |key, value| self[key] = value } if !hash.nil? && hash.is_a?(Hash)\n end",
"def create(hash)\n NotImplementedError\n end",
"def from_h(hash, converter = nil)\n instance = new\n\n hash.each do |k, v|\n v = instance.convert(v, k, converter) if converter\n instance.send(:\"#{k}=\", v)\n end\n\n instance\n end",
"def init_jaxb_json_hash(_o)\n super _o\n @id = String.from_json(_o['id']) unless _o['id'].nil?\n @version = String.from_json(_o['version']) unless _o['version'].nil?\n @description = String.from_json(_o['description']) unless _o['description'].nil?\n @url = String.from_json(_o['url']) unless _o['url'].nil?\n @name = String.from_json(_o['name']) unless _o['name'].nil?\n @organization = Org::Apache::Archiva::Metadata::Model::Organization.from_json(_o['organization']) unless _o['organization'].nil?\n @issueManagement = Org::Apache::Archiva::Metadata::Model::IssueManagement.from_json(_o['issueManagement']) unless _o['issueManagement'].nil?\n @scm = Org::Apache::Archiva::Metadata::Model::Scm.from_json(_o['scm']) unless _o['scm'].nil?\n @ciManagement = Org::Apache::Archiva::Metadata::Model::CiManagement.from_json(_o['ciManagement']) unless _o['ciManagement'].nil?\n if !_o['licenses'].nil?\n @licenses = Array.new\n _oa = _o['licenses']\n _oa.each { | _item | @licenses.push Org::Apache::Archiva::Metadata::Model::License.from_json(_item) }\n end\n if !_o['mailingLists'].nil?\n @mailingLists = Array.new\n _oa = _o['mailingLists']\n _oa.each { | _item | @mailingLists.push Org::Apache::Archiva::Metadata::Model::MailingList.from_json(_item) }\n end\n if !_o['dependencies'].nil?\n @dependencies = Array.new\n _oa = _o['dependencies']\n _oa.each { | _item | @dependencies.push Org::Apache::Archiva::Metadata::Model::Dependency.from_json(_item) }\n end\n @incomplete = Boolean.from_json(_o['incomplete']) unless _o['incomplete'].nil?\n end",
"def create_version_hash\n new_version = {}\n new_version['created'] = ''\n new_version['message'] = ''\n new_version['user'] = {}\n # user is #name, # address.\n new_version['user']['name'] = ''\n new_version['user']['address'] = ''\n new_version['state'] = {}\n new_version\n end",
"def create_from_hash hash\n values = values_from_hash hash\n unless obj = find(:first, :conditions => values)\n return nil if values[:id]\n obj = create!(values)\n raise ArgumentError, \"#{obj.errors.to_s}\" unless obj.errors.empty?\n end\n obj\n end",
"def initialize result_hash={}\n @result_hash = result_hash\n end",
"def create_hash(&block); end",
"def create_hash(&block); end",
"def initialize(attrs={})\n from_hash(attrs)\n end",
"def build_request_data(hash)\n {\n :attributes! => {\n addressinfo: { \"xsi:type\" => \"ns2:Map\" },\n },\n username: @username,\n password: @password,\n addressinfo: {\n item: [\n { key: 'name', value: hash[:name] },\n { key: 'address1', value: hash[:address1] },\n { key: 'address2', value: hash[:address2] },\n { key: 'city', value: hash[:city] },\n { key: 'state', value: hash[:state] },\n { key: 'zip', value: hash[:zip] },\n { key: 'fflno', value: hash[:fflno] },\n { key: 'fflexp', value: hash[:fflexp] }\n ]\n },\n testing: @testing\n }\n end",
"def init_jaxb_json_hash(_o)\n @groupId = String.from_json(_o['groupId']) unless _o['groupId'].nil?\n @artifactId = String.from_json(_o['artifactId']) unless _o['artifactId'].nil?\n @version = String.from_json(_o['version']) unless _o['version'].nil?\n @packaging = String.from_json(_o['packaging']) unless _o['packaging'].nil?\n @className = String.from_json(_o['className']) unless _o['className'].nil?\n if !_o['repositories'].nil?\n @repositories = Array.new\n _oa = _o['repositories']\n _oa.each { | _item | @repositories.push String.from_json(_item) }\n end\n @bundleVersion = String.from_json(_o['bundleVersion']) unless _o['bundleVersion'].nil?\n @bundleSymbolicName = String.from_json(_o['bundleSymbolicName']) unless _o['bundleSymbolicName'].nil?\n @bundleExportPackage = String.from_json(_o['bundleExportPackage']) unless _o['bundleExportPackage'].nil?\n @bundleExportService = String.from_json(_o['bundleExportService']) unless _o['bundleExportService'].nil?\n @classifier = String.from_json(_o['classifier']) unless _o['classifier'].nil?\n @includePomArtifacts = Boolean.from_json(_o['includePomArtifacts']) unless _o['includePomArtifacts'].nil?\n @queryTerms = String.from_json(_o['queryTerms']) unless _o['queryTerms'].nil?\n @bundleImportPackage = String.from_json(_o['bundleImportPackage']) unless _o['bundleImportPackage'].nil?\n @bundleRequireBundle = String.from_json(_o['bundleRequireBundle']) unless _o['bundleRequireBundle'].nil?\n @pageSize = Fixnum.from_json(_o['pageSize']) unless _o['pageSize'].nil?\n @selectedPage = Fixnum.from_json(_o['selectedPage']) unless _o['selectedPage'].nil?\n end",
"def initialize(order_hash)\n @id = order_hash['id']\n @number = order_hash['number']\n @special_instructions = order_hash['special_instructions']\n @total = order_hash['total']\n @total_quantity = order_hash['total_quantity']\n @created_at = order_hash['created_at']\n @updated_at = order_hash['updated_at']\n end",
"def from_db_hash *args\n from_hash *args\n end",
"def build_from_hash(attributes)\n return nil unless attributes.is_a?(Hash)\n self.class.swagger_types.each_pair do |key, type|\n if type =~ /^Array<(.*)>/i\n if attributes[self.class.attribute_map[key]].is_a?(Array)\n self.send(\"#{key}=\", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )\n else\n #TODO show warning in debug mode\n end\n elsif !attributes[self.class.attribute_map[key]].nil?\n self.send(\"#{key}=\", _deserialize(type, attributes[self.class.attribute_map[key]]))\n else\n # data not found in attributes(hash), not an issue as the data can be optional\n end\n end\n\n self\n end",
"def build_from_hash(attributes)\n return nil unless attributes.is_a?(Hash)\n self.class.swagger_types.each_pair do |key, type|\n if type =~ /^Array<(.*)>/i\n if attributes[self.class.attribute_map[key]].is_a?(Array)\n self.send(\"#{key}=\", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )\n else\n #TODO show warning in debug mode\n end\n elsif !attributes[self.class.attribute_map[key]].nil?\n self.send(\"#{key}=\", _deserialize(type, attributes[self.class.attribute_map[key]]))\n else\n # data not found in attributes(hash), not an issue as the data can be optional\n end\n end\n\n self\n end",
"def build_from_hash(attributes)\n return nil unless attributes.is_a?(Hash)\n self.class.swagger_types.each_pair do |key, type|\n if type =~ /^Array<(.*)>/i\n if attributes[self.class.attribute_map[key]].is_a?(Array)\n self.send(\"#{key}=\", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )\n else\n #TODO show warning in debug mode\n end\n elsif !attributes[self.class.attribute_map[key]].nil?\n self.send(\"#{key}=\", _deserialize(type, attributes[self.class.attribute_map[key]]))\n else\n # data not found in attributes(hash), not an issue as the data can be optional\n end\n end\n\n self\n end"
] | [
"0.8011074",
"0.7470833",
"0.7457607",
"0.7256629",
"0.72455454",
"0.70060325",
"0.6973257",
"0.6955014",
"0.69459796",
"0.69398683",
"0.69363195",
"0.6917627",
"0.6872358",
"0.6796184",
"0.6783521",
"0.67575246",
"0.67575246",
"0.67560464",
"0.67514306",
"0.67136854",
"0.66667664",
"0.6623634",
"0.661206",
"0.66098964",
"0.66098964",
"0.6591922",
"0.65713006",
"0.6547411",
"0.6524743",
"0.6524143",
"0.6513636",
"0.650189",
"0.6498057",
"0.6485853",
"0.6483371",
"0.6475685",
"0.6459916",
"0.6454491",
"0.6440182",
"0.6434778",
"0.6401363",
"0.63977015",
"0.6396885",
"0.63910425",
"0.63720834",
"0.6363958",
"0.63597506",
"0.6313429",
"0.6295958",
"0.62923384",
"0.62915224",
"0.62704456",
"0.62703115",
"0.62622243",
"0.62515473",
"0.6249854",
"0.6242987",
"0.6242987",
"0.62426233",
"0.62408733",
"0.62407595",
"0.62321323",
"0.62298346",
"0.622897",
"0.622756",
"0.62245685",
"0.62217826",
"0.6218501",
"0.6210329",
"0.62091905",
"0.620342",
"0.6201614",
"0.6178616",
"0.6166234",
"0.61611027",
"0.6140086",
"0.6126761",
"0.61154264",
"0.61059844",
"0.60980254",
"0.60971874",
"0.6090533",
"0.6064119",
"0.6061236",
"0.6060324",
"0.60599816",
"0.60420287",
"0.6039776",
"0.603712",
"0.6033585",
"0.6030829",
"0.6023582",
"0.6023582",
"0.6016123",
"0.60155296",
"0.6014705",
"0.6008574",
"0.60031897",
"0.60024095",
"0.60024095",
"0.60024095"
] | 0.0 | -1 |
Deserializes the data based on type | def _deserialize(type, value)
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
temp_model = UltracartClient.const_get(type).new
temp_model.build_from_hash(value)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Telstra_Messaging.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = FattureInCloud.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = IFClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = WineShipping.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n DearInventoryRuby.const_get(type).build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Mooncard.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Aimastering.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Harbor1Client.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = WellsFargoAchClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ArtikCloud.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Dkron.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n MailSlurpClient.const_get(type).build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n MailSlurpClient.const_get(type).build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Esi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Esi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Esi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = Fastly.const_get(type)\n klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = Fastly.const_get(type)\n klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = Fastly.const_get(type)\n klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = Fastly.const_get(type)\n klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n ::DateTime.parse(value)\n when :Date\n ::Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Models.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n ::DateTime.parse(value)\n when :Date\n ::Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Models.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = Hubspot::Cms::Performance.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = SmoochApi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Tradenity.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Tradenity.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = SamplifyAPIClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = OpsgenieClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = LemonWayClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = BudgeaClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = BudgeaClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n Nodeum.const_get(type).build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TextMagic.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TextMagic.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TextMagic.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n Date.parse value\n when :Date\n Date.parse value\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else\n # model\n temp_model = GroupDocsViewerCloud.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n Date.parse value\n when :Date\n Date.parse value\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else\n # model\n temp_model = GroupDocsViewerCloud.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n Date.parse value\n when :Date\n Date.parse value\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else\n # model\n temp_model = GroupDocsViewerCloud.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = NSXT.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = NSXT.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = NSXT.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TreezorClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TreezorClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TreezorClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = SwiftApi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = SwiftApi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TripletexApi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = unwiredClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Quandoo.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end"
] | [
"0.7330926",
"0.7274019",
"0.72504056",
"0.7245751",
"0.7218884",
"0.7213926",
"0.71909",
"0.7183136",
"0.71796805",
"0.71796805",
"0.71796805",
"0.71796805",
"0.71796805",
"0.71796805",
"0.71796805",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71712995",
"0.71712995",
"0.71712995",
"0.71712995",
"0.71712995",
"0.71632504",
"0.71549904",
"0.71473306",
"0.71413666",
"0.71413666",
"0.7141116",
"0.7141116",
"0.7141116",
"0.7133874",
"0.7133874",
"0.7133874",
"0.7133874",
"0.71333444",
"0.71333444",
"0.7127688",
"0.7125744",
"0.71210617",
"0.71210617",
"0.71190786",
"0.71184087",
"0.711393",
"0.7113519",
"0.7113519",
"0.7113516",
"0.71119875",
"0.71119875",
"0.71119875",
"0.7105169",
"0.7105169",
"0.7105169",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7102596",
"0.7102596",
"0.7102596",
"0.7101596",
"0.7101596",
"0.7101596",
"0.70996517",
"0.70996517",
"0.7097952",
"0.7097185",
"0.70965225"
] | 0.72291344 | 12 |
Returns the string representation of the object | def to_s
to_hash.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n @object.to_s\n end",
"def to_s\n object.to_s\n end",
"def serialize(object)\n object.to_s\n end",
"def to_s\n self.inspect\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"def to_s\n \"#<#{self.class.name}:#{object_id} #{info}>\"\n end",
"def to_s\n \"#<#{self.class.name}:#{object_id}> @names=#{names}>\"\n end",
"def to_s\n self.inspect\n end",
"def to_s\n toString()\n end",
"def to_s\r\n dump\r\n end",
"def to_s\n inspect\n end",
"def to_s\n toString\n end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def to_s\n\t\t\t@string\n\t\tend",
"def to_s\n stringify\n end",
"def to_s\n to_h.to_s\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def inspect\n serialize.to_s\n end",
"def inspect\n to_s\n end",
"def to_s\n @string ||= Builder::ToString.new(self).string\n end",
"def to_s\n self\n end",
"def to_s()\n serialize.to_s()\n end",
"def to_s()\n serialize.to_s()\n end",
"def to_s\n string\n end",
"def to_s\n inspect\n end",
"def to_s\n inspect\n end",
"def inspect\n to_s\n end",
"def inspect\n to_s\n end",
"def inspect\n to_s\n end",
"def inspect\n to_s\n end",
"def inspect\n to_s\n end",
"def inspect\n to_s\n end",
"def inspect\n to_s\n end",
"def inspect\n self.to_s\n end",
"def inspect\n self.to_s\n end",
"def inspect\n to_s\n end",
"def inspect\n to_s\n end",
"def to_s\n end",
"def to_s\n end",
"def to_s\n end",
"def to_s\n end",
"def inspect\n to_s.inspect\n end",
"def inspect()\n serialize.to_s()\n end",
"def inspect()\n serialize.to_s()\n end",
"def inspect\n return self.to_s\n end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end"
] | [
"0.901102",
"0.8951408",
"0.847116",
"0.83399886",
"0.8337297",
"0.8337297",
"0.8332112",
"0.82551175",
"0.8145114",
"0.8143849",
"0.8134524",
"0.8126343",
"0.8092803",
"0.80863005",
"0.8072428",
"0.80386686",
"0.80304825",
"0.80054814",
"0.80054814",
"0.80054814",
"0.80054814",
"0.79618967",
"0.79618967",
"0.79618967",
"0.79618967",
"0.79538035",
"0.7944262",
"0.7918815",
"0.79082245",
"0.7883917",
"0.7883917",
"0.7883481",
"0.7882636",
"0.7882636",
"0.78753656",
"0.78753656",
"0.78753656",
"0.78753656",
"0.78753656",
"0.78753656",
"0.78753656",
"0.78664535",
"0.78664535",
"0.78655005",
"0.78655005",
"0.78498703",
"0.78498703",
"0.78498703",
"0.78498703",
"0.7807684",
"0.7784341",
"0.7784341",
"0.77672994",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334",
"0.7760334"
] | 0.0 | -1 |
to_body is an alias to to_hash (backward compatibility) | def to_body
to_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_body\r\n to_hash\r\n end",
"def to_body\n to_hash\nend",
"def to_body\n to_hash\nend"
] | [
"0.84283537",
"0.8347048",
"0.8347048"
] | 0.0 | -1 |
Returns the object in the form of hash | def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_hash\n object\n end",
"def hash\r\n return to_s.hash\r\n end",
"def hash\n to_a.hash\n end",
"def hash\n [_hash, name, owner].hash\n end",
"def hash\n return to_s.hash\n end",
"def hash\n @hash\n end",
"def hash\n @hash.hash\n end",
"def hash\n @hash ||= self.to_a.hash\n end",
"def to_hash\n @hash\n end",
"def to_hash\n @hash\n end",
"def hash\n to_s.hash\n end",
"def to_hash\n @hash\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @hash\n end",
"def to_h\n @hash\n end",
"def hash\n to_h.hash ^ self.class.hash\n end",
"def as_hash\n @hash\n end",
"def __getobj__\n @hashobj\n end",
"def to_hash() end",
"def hash\n to_s.hash\n end",
"def hash\n to_s.hash\n end",
"def hash\n object_id\n end",
"def to_hash\n @_hash_\n end",
"def hash\n\t\treturn self.name.to_s.hash\n\tend",
"def to_hash\n to_a.hash\n end",
"def hash\n { hash: @hash, hashType: @hash_type }\n end",
"def hash\n data.hash\n end",
"def hash\n [self.class, to_h].hash\n end",
"def hash\n [self.class, to_h].hash\n end",
"def hash\n [self.class, to_h].hash\n end",
"def hash\r\n id.hash\r\n end",
"def hash\n \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end",
"def hash\n attributes.hash\n end",
"def hash\n attributes.hash\n end",
"def hash\n attributes.hash\n end",
"def hash #:nodoc:\n __getobj__.hash ^ self.class.hash\n end",
"def hash\n self.to_f.hash\n end",
"def hash\n end",
"def hash\n end",
"def hash\n end",
"def to_hash\n return self\n end",
"def to_hash(object)\n validate_class_kit(object.class)\n\n @hash_helper.to_hash(object)\n end",
"def hash\n return @id.hash\n end",
"def to_h\n Hash[ self ]\n end",
"def to_hash\n Hash[self]\n end",
"def to_h\n @hash.dup\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def to_h\n @hash.dup\n end",
"def hash\n model.hash + key.hash\n end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def hash\n [self.class, to_s].hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n self.atoms.hash\n end",
"def to_h\n Hash[self]\n end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash\n\t\tvalue.hash\n\tend",
"def hash\n [description, routing_number, account_number, account_type, signatory, metadata, id, signature_url, bank_name, verified, date_created, date_modified, deleted, object].hash\n end",
"def hash\n @id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n self.class.name.hash\n end",
"def to_h\n @_hash.dup\n end",
"def hash\n\t\t[@id].hash\n\tend",
"def hash\n [self.class, to_s].hash\n end",
"def __hash\n @hash\n end"
] | [
"0.8270299",
"0.78767854",
"0.78726953",
"0.7802364",
"0.7789188",
"0.77806795",
"0.7775915",
"0.7767511",
"0.7760525",
"0.7760525",
"0.77559966",
"0.7731286",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7647042",
"0.7647042",
"0.7626769",
"0.760354",
"0.7595938",
"0.7582562",
"0.7579971",
"0.7579971",
"0.7535553",
"0.7495252",
"0.7433835",
"0.7411177",
"0.73843014",
"0.73661345",
"0.73658615",
"0.73658615",
"0.73658615",
"0.73600674",
"0.7359121",
"0.73590857",
"0.73590857",
"0.73590857",
"0.7340058",
"0.73356754",
"0.7329828",
"0.7329828",
"0.7329828",
"0.73170114",
"0.730566",
"0.73028016",
"0.7294603",
"0.72854036",
"0.72643596",
"0.72637254",
"0.72620076",
"0.72620076",
"0.72620076",
"0.72620076",
"0.72620076",
"0.72620076",
"0.72620076",
"0.72620076",
"0.72620076",
"0.726188",
"0.72524244",
"0.72511965",
"0.72511965",
"0.72511965",
"0.72511965",
"0.72511965",
"0.72511965",
"0.72479564",
"0.72474235",
"0.72474235",
"0.7241066",
"0.7229342",
"0.7228758",
"0.7228758",
"0.7228758",
"0.7228758",
"0.7228758",
"0.7228758",
"0.7228758",
"0.7228758",
"0.7228758",
"0.7228758",
"0.7224175",
"0.72185695",
"0.72126305",
"0.72116995",
"0.71945405",
"0.71828544",
"0.7181684",
"0.7171822",
"0.71657544"
] | 0.0 | -1 |
Outputs nonarray value in the form of hash For object, use to_hash. Otherwise, just return the value | def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [value].hash\n end",
"def hash\n [value].hash\n end",
"def hash\n\t\tvalue.hash\n\tend",
"def hash\n value.hash\n end",
"def hash\n @value.hash\n end",
"def hash\r\n return to_s.hash\r\n end",
"def to_hash\n @value\n end",
"def to_hash\n @value\n end",
"def hash\n @hash || @hash = (value.hash * -1)\n end",
"def output_hash; end",
"def to_hash() end",
"def hash\n return to_s.hash\n end",
"def hash\n value_id.hash\n end",
"def to_hash\n call\n @hash = @value\n @hash\n end",
"def hash\n to_s.hash\n end",
"def hash\n to_s.hash\n end",
"def hash\n self.to_f.hash\n end",
"def hash\n to_s.hash\n end",
"def to_hash(obj = T.unsafe(nil)); end",
"def to_h\n @value\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def value_to_hash(value, options = T.unsafe(nil)); end",
"def to_s\r\n to_hash.to_s\r\n end",
"def _to_hash(value)\r\n if value.is_a?(Array)\r\n value.compact.map{ |v| _to_hash(v) }\r\n elsif value.is_a?(Hash)\r\n {}.tap do |hash|\r\n value.each { |k, v| hash[k] = _to_hash(v) }\r\n end\r\n elsif value.respond_to? :to_hash\r\n value.to_hash\r\n else\r\n value\r\n end\r\n end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def to_s\n to_hash.to_s\nend",
"def to_s\n to_hash.to_s\nend",
"def to_h(value)\n return value unless @to_h\n @to_h.call value\n end",
"def to_hash\n Hash[to_a]\n end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end"
] | [
"0.6719518",
"0.6719518",
"0.666832",
"0.66565555",
"0.6586841",
"0.6452931",
"0.6414911",
"0.6414911",
"0.6382046",
"0.6346188",
"0.6302933",
"0.62237245",
"0.6151989",
"0.6101756",
"0.60795677",
"0.60795677",
"0.60717124",
"0.6035991",
"0.6021168",
"0.5936472",
"0.5903488",
"0.5903488",
"0.5903488",
"0.5903488",
"0.5903488",
"0.5890367",
"0.5890367",
"0.5884459",
"0.5884459",
"0.58669275",
"0.58533067",
"0.58355993",
"0.58215266",
"0.58215266",
"0.58215266",
"0.58215266",
"0.58215266",
"0.58215266",
"0.58215266",
"0.58215266",
"0.58215266",
"0.58215266",
"0.5803003",
"0.5803003",
"0.57983655",
"0.578115",
"0.577359",
"0.577359",
"0.577359",
"0.577359",
"0.577359",
"0.577359",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771"
] | 0.0 | -1 |
Create a new userhashtag link. Create the hashtag if it doesn't exist | def create
if session[:user]
@userhashtag = Userhashtag.new()
@userhashtag.user_id = session[:user].id
#Strip the '#' if the user put it
hashtag_name = params[:userhashtag][:name]
if hashtag_name[0] == '#'
hashtag_name[0] = ''
end
#Get the hashtag ID from the name, create if doesn't exist
@hashtag = Hashtag.find(:first, conditions:["name = ?",hashtag_name])
if (!@hashtag)
h = Hashtag.new()
h.name = params[:userhashtag][:name]
h.save
#Now get the hashtag
@hashtag = Hashtag.find(:first, conditions:["name = ?",hashtag_name])
end
@userhashtag.hashtag_id = @hashtag.id
@userhashtag.save
#Set the name of the new element
@userhashtag.name = params[:userhashtag][:name]
@userhashtag["name"] = params[:userhashtag][:name]
render json: @userhashtag, status: :created
#render json: @post, status: :created
#redirect_to :back
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @message_hashtag = MessageHashtag.new(message_hashtag_params)\n\n respond_to do |format|\n if @message_hashtag.save\n format.html { redirect_to @message_hashtag, notice: 'Message hashtag was successfully created.' }\n format.json { render :show, status: :created, location: @message_hashtag }\n else\n format.html { render :new }\n format.json { render json: @message_hashtag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_hashtag\n @hashtag = Hashtag.find(params[:id])\n end",
"def set_hashtag\n @hashtag = Hashtag.find(params[:id])\n end",
"def auto_link_hashtags(text, options = {}) # :yields: hashtag_text\n options = options.dup\n options[:url_class] ||= DEFAULT_URL_CLASS\n options[:hashtag_class] ||= DEFAULT_HASHTAG_CLASS\n options[:hashtag_url_base] ||= \"http://twitter.com/search?q=%23\"\n options[:target] ||= DEFAULT_TARGET\n extra_html = HTML_ATTR_NO_FOLLOW unless options[:suppress_no_follow]\n\n Twitter::Rewriter.rewrite_hashtags(text) do |hash, hashtag|\n hashtag = yield(hashtag) if block_given?\n href = if options[:hashtag_url_block]\n options[:hashtag_url_block].call(hashtag)\n else\n \"#{options[:hashtag_url_base]}#{html_escape(hashtag)}\"\n end\n %(<a href=\"#{href}\" title=\"##{html_escape(hashtag)}\" #{target_tag(options)}class=\"#{options[:url_class]} #{options[:hashtag_class]}\"#{extra_html}>#{html_escape(hash)}#{html_escape(hashtag)}</a>)\n end\n end",
"def create_links(tweet)\n # NOTE: URLs before Users, otherwise we'll double escape the URLs\n link_users(link_hashtags(link_urls(html_escape(tweet))))\n #link_users(link_urls(html_escape(tweet)))\n end",
"def create_link_for(u)\r\n l = links.build(:url => u)\r\n if l.save\r\n @link_url = nil\r\n return true\r\n end\r\n \r\n errors.add(:link_url, \"#{u} is not a valid URL, or is not responding\") and return false\r\n end",
"def generateHashtag(string)\n hashtag = string.split.map(&:capitalize).join\n return false if hashtag.size > 139 || hashtag.size == 0\n hashtag.insert(0, \"#\")\nend",
"def set_post_hashtag\n @post_hashtag = PostHashtag.find(params[:id])\n end",
"def create\n \n #user = current_user\n if params[:user].nil?\n user = current_user\n else\n user = User.find(params[:user])\n end\n \n email = params[:email].to_s\n\n unless params[:source].nil? || params[:source].empty?\n params[:link] = Hash.new\n\n params[:link][:source] = Hash.new\n params[:link][:source] = params[:source]\n end\n\n \t\tlink = Mechanize.new { |agent| agent.user_agent_alias = 'Mac Safari'}\n\t\tlink.get \"http://img.bitpixels.com/getthumbnail?code=27543&size=200&url=\" + Link.makeAbsolute(params[:link][:source])\n\t\tlink.get(Link.makeAbsolute(params[:link][:source]))\n title = link.page.title \n\n if User.where(:email => /#{email}/).any?\n reciever_id = User.where(:email => /#{email}/i).first.id\n else\n u = User.create!(\n :name => \"Temp User\", \n :email => email, \n :password => \"temppass\", \n :password_confirmation => \"temppass\",\n :isTemp => true \n )\n reciever_id = u.id\n end\n \n @link = user.links.new(params[:link].merge({\n :reciever_id => reciever_id, \n :title => title, \n :source => Link.makeAbsolute(params[:link][:source]),\n }))\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to :back, notice: 'Link was successfully created.' }\n format.json { render json: @link, status: :created, location: @link }\n else\n format.html { render action: \"new\" }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_link(auth)\n\t\texp = auth['credentials']['expires_at']\n\t\texp = DateTime.strptime(\"#{exp}\",'%s') if exp\n\t\tlinks.create(\n\t\t\tprovider: auth['provider'],\n\t\t\tuid: auth['uid'],\n\t\t\taccess_token: auth['credentials']['token'],\n\t\t\taccess_token_secret: auth['credentials']['secret'],\n\t\t\trefresh_token: auth['credentials']['refresh_token'],\n\t\t\ttoken_expires_at: exp\n\t\t)\n\tend",
"def create\n @link = Link.new(link_params)\n\n respond_to do |format|\n if @link.save\n if @link.shortened.nil? or @link.shortened.empty?\n @link.assign_unique_shortened_string\n @link.save\n end\n current_user.links << @link\n current_user.save\n\n format.html { redirect_to @link, notice: 'Link was successfully created.' }\n format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n auth_hash = request.env['omniauth.auth']\n user = User.find_or_create_by(uid: auth_hash[\"uid\"], provider: auth_hash['provider'])\n user.update_attributes(\n name: auth_hash.info['name'],\n nickname: auth_hash.info['nickname'],\n email: auth_hash.info['email'],\n image: auth_hash.info['image'],\n access_token: auth_hash.credentials['token'])\n sign_in user\n if user\n redirect_to :gem_notes\n else\n render 'home/index'\n end\n end",
"def set_message_hashtag\n @message_hashtag = MessageHashtag.find(params[:id])\n end",
"def create\n url = params[:short_url][:url]\n\n # regex to validate url\n is_url = url.match(/^(http|https):\\/\\/[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(:[0-9]{1,5})?(\\/.*)?$/ix).present?\n \n if is_url == true\n surl = Digest::MD5.hexdigest(url+\"in salt we trust\").slice(0..6) \n short_url = \"http://\" + surl\n\n @short_url = ShortUrl.create(title: params[:short_url][:title], url: params[:short_url][:url] , short_url: short_url, jmp_url: \"\", clicks: 0)\n redirect_to @short_url, notice: 'Short url was successfully created.'\n else \n redirect_to short_urls_path, notice: 'Invalid Url.'\n end \n\n \n end",
"def link_with_omniauth!(auth)\n link_with_omniauth(auth)\n save\n end",
"def add_new_user()\n new_user_link.click\n end",
"def create\n \n\t# Cria o hash MD5 da string do link\n params[:link][:token] = Digest::MD5.hexdigest(params[:link][:link]).encode('UTF-8')\n\t\n\t# Obtem o ID do usuario\n\tparams[:link][:user_id] = session[:user_id]\n\t\n\t# Verifica se este hash ja nao existe no banco. MD5 gera conflitos, mas como sao \n\t# poucos links, isto nao sera problema.\n\t@link = Link.find_by_token params[:link][:token]\n\t\n\t# Variavel de verificacao para saber se o link foi salvo\n\tsave = 0\n\t\n\t# Se o link nao existir no banco...\n\tif @link.nil? then\n\t\n\t\t# Obtem os dados do usuario (IP e user agent)\n\t params[:link][:ip] = request.env[\"REMOTE_ADDR\"].encode('UTF-8')\n\t params[:link][:user_agent] = request.env[\"HTTP_USER_AGENT\"].encode('UTF-8')\n\t \n\t # Cria o registro\n\t @link = Link.new(params[:link]) \n\t \n\t # Salva, verifica o salvamento e atualiza a variavel para verificacao do salvamento\n\t save = @link.save ? 1 : 0\n\tend\n \t\n respond_to do |format|\n if save == 1\n format.html { redirect_to @link, notice: 'Link adicionado com sucesso!' }\n format.json { render json: @link, status: :created, location: @link }\n else\n format.html { redirect_to @link, notice: 'Link ja adicionado anteriormente!' }\n format.json { render json: @link, status: :created, location: @link }\n end\n end\n end",
"def create\n @link = Link.new(url: link_params[:url])\n @link = UniqueAttributesAssigner.ensure_unique(@link)\n\n if @link.save\n flash[:success] = 'Shorty was successfully created!'\n redirect_to @link\n else\n if @link.errors.any?\n flash[:error] = collect_errors\n end\n redirect_to root_path\n end\n end",
"def create\n puts '---------------'\n puts params\n puts '---------------'\n # We made users, and urls need a user_id\n # so for demo we are going to generature the URL for\n # our First user in our database....\n url = User.first.urls.new(url_params)\n url.save\n redirect_to '/urls'\n end",
"def create\n @link = current_user.links.new link_params\n create_and_respond(@link)\n end",
"def auto_link_hashtags(text, options = {}, &block) # :yields: hashtag_text\n auto_link_entities(text, Extractor.extract_hashtags_with_indices(text), options, &block)\n end",
"def create\n # decide if link url already exists in db\n @potentialLink = Link.find_by(url: links_params[:url])\n @link = current_user.links.new(title: links_params[:title], url: links_params[:url])\n # cleans up link so that it always has http://\n if @link.url.include?('http://')\n @link.save\n else\n @link.url.insert(0, 'http://')\n @link.save\n end\n # @keyword = self.keywords\n\n # captures string of tags\n @inputtedtags = (links_params[:link_tags_attributes]['0'][:tag_attributes][:name]).gsub(/,/, '').downcase.split(' ').flatten\n\n # Decide if tag is already in the database\n @inputtedtags.each do |tag|\n potentialTag = Tag.find_by(name: tag)\n # if tag is already in db, create a new association between new link and old tag\n if potentialTag\n @link_tag = @link.link_tags.build(link_id: @link.id, tag_id: potentialTag.id)\n @link_tag.save\n # otherwise, save new tag\n else\n @link.tags.build(name: tag)\n @link.save\n end\n end\n # render tags dynamically without reloading page\n respond_to do |format|\n if @link.save\n format.json { render json: @link, include: :tags, status: :created }\n else\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @link = current_user.links.build(link_params)\n \n @link.num = 2\n @link.user_name = current_user.nickname\n @link.description = current_user.description\n @link.description_permission = current_user.description_permission\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to @link, notice: '투표안건이 성공적으로 작성되었습니다.' }\n format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @useful_link = UsefulLink.new(params[:useful_link])\n\n respond_to do |format|\n if @useful_link.save\n format.html { redirect_to @useful_link, notice: 'Useful link was successfully created.' }\n format.json { render json: @useful_link, status: :created, location: @useful_link }\n else\n format.html { render action: \"new\" }\n format.json { render json: @useful_link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\trandom_str = SecureRandom.urlsafe_base64(10)\n\t\tlink = Link.create(url: params[\"link\"][\"url\"], random_string: random_str)\n\t\tredirect_to link_path(link.random_string)\n\tend",
"def hashtag_params\n params.require(:hashtag).permit(:content)\n end",
"def create\n @link = Link.new(params[:link])\n logger.debug \"url: \" << @link.url\n if not Link.url(@link.url).nil?\n logger.debug 'URL: ' << @link.url << ' already exists'\n @link = Link.url(@link.url)\n respond_to do |format|\n flash[:notice] = 'Your URL is a lot cooler now!'\n format.html { redirect_to :action => \"link\", :id => Base32::Crockford.encode(@link.id).downcase }\n end \n else\n respond_to do |format|\n if @link.save\n flash[:notice] = 'Your URL is a lot cooler now!'\n format.html { redirect_to :action => \"link\", :id => Base32::Crockford.encode(@link.id).downcase }\n \n else\n format.html { render :action => \"new\" }\n end\n end\n end\n end",
"def create\n\t\tlink = current_user.links.new(link_params)\n\n\t\trespond_to do | format |\n\t\t\tif link.save\n\t\t\t\tformat.html{\n\t\t\t\t\tredirect_to link\n\t\t\t\t}\n\t\t\telse\n\t\t\t\tformat.html{\n\t\t\t\t\trender action: \"new\"\n\t\t\t\t}\n\t\t\tend\n\t\tend \n\t\t\n\tend",
"def generate_hashtag(string)\n return false if string.empty? || string.gsub(' ', '').size >= 140\n capitalized_words = string.gsub(/#/, '').split.map(&:capitalize).join('')\n\n '#' << capitalized_words\nend",
"def create\n if params[:nickname].present?\n send_token params[:nickname]\n redirect_to \\\n user_session_path,\n notice: \"link is sent to verify you! please check WeirdSlack!\"\n else\n redirect_to user_session_path\n end\n end",
"def generateHashtag(str)\n return false if str.empty?\n return false if str.length > 140\n \"#\" + str.split.join(\" \").split.map(&:capitalize).join\nend",
"def hashtag_params\n params.require(:hashtag).permit(:name, :mana)\n end",
"def tweet (user_id)\n \n #generate a new tweet\n body = \"This is a new tweet being written to the DB!\"\n \n IBM_DB.exec(@conn, \"INSERT INTO tweets(tweet, user_id) VALUES( '#{body.gsub(/'/,'')}', #{user_id} );\")\n new_id = getSimpleValue(@conn, \"SELECT IDENTITY_VAL_LOCAL() FROM users\").to_i\n \n #insert 0-2 hashtags per tweet\n rand(2).times do\n new_tag = rand(@max_hash - @min_hash + 1) + @min_hash\n IBM_DB.exec(@conn, \"INSERT INTO hashtags_tweets(tweet_id, hashtag_id) VALUES ( #{ new_id }, #{ new_tag })\")\n end\n \n debug \"wrote new tweet for user: \" + user_id.to_s\n end",
"def create_by_omniauth(auth)\n User.create do |user|\n user.assign_attributes(name: auth.info.name, email: auth.info.email,\n password: Devise.friendly_token[0, 20])\n user.skip_confirmation! if user.email\n user.link_with_omniauth(auth)\n end\n end",
"def create\n @link = Link.find_by_slug(params[:format])\n @link.upvotes.create!(user: current_user)\n calculate_points_for(current_user, 1)\n redirect_to root_path\n end",
"def create_short_url\n if self.short_url.nil?\n self.short_url = self.id\n self.save\n end\n end",
"def create\n bookmark = Bookmark.find_or_create_by_URL(params[:bookmark][:URL])\n\n @user_bookmark = UserBookmark.new(:bookmark_id => bookmark.id, :user_id => current_user.id)\n\n respond_to do |format|\n if @user_bookmark.save\n format.html { redirect_to(bookmark, :notice => 'Bookmark was successfully created.') }\n format.xml { render :xml => @user_bookmark, :status => :created, :location => @bookmark }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user_bookmark.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_new_user\r\n touch(\"* id:'#{add}'\")\r\n end",
"def create\n if session[:user_id]\n user = User.find(session[:user_id])\n params[:bookmark][:user] = user\n @bookmark = Bookmark.new(params[:bookmark])\n if params[:tag]\n @tags = params[:tag]\n @tags.each do |tag|\n objTag = Tag.find(tag)\n @bookmark.tags << objTag\n end\n end\n if @bookmark.url.include?(\"http://\")\n else\n @bookmark.url = \"http://\" + @bookmark.url\n end\n \n respond_to do |format|\n if @bookmark.save\n format.html { redirect_to(@bookmark, :notice => 'Bookmark was successfully created.') }\n format.xml { render :xml => @bookmark, :status => :created, :location => @bookmark }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @bookmark.errors, :status => :unprocessable_entity }\n end\n end\n else\n redirect_to \"/login\"\n end\n end",
"def new_link\n @link = Link.new\n end",
"def create\n auth_hash = request.env['omniauth.auth']\n redirect to login_failure_path unless auth_hash['uid']\n\n @user = User.find_by(uid: auth_hash[:uid], provider: 'github')\n if @user.nil?\n # User doesn't match anything in the DB.\n # Attempt to create a new user.\n @user = User.build_from_github(auth_hash)\n unless @user.save\n render :creation_failure\n end\n # Save the user ID in the session\n end\n session[:user_id] = @user.id\n redirect_to user_path(@user.id)\n end",
"def create\n auth = request.env[\"omniauth.auth\"] \n user = User.find_by_fb_id(auth[\"uid\"]) || User.create_with_omniauth(auth) \n #for those update from feeds\n if user.access_token.empty?\n user.access_token = auth[\"credentials\"][\"token\"]\n user.save\n end\n redirect_to FB_APP_URL \n end",
"def create_links\n end",
"def create_links\n end",
"def facebook_create\n @new_user = User.find_or_create_by(uid: auth['uid']) do |u|\n u.name = auth['info']['name']\n u.email = auth['info']['email']\n u.image = auth['info']['image']\n u.password = User.generic_password\n end\n @new_user.save\n session[:user_id] = @new_user.id \n redirect_to home_path(@new_user)\n end",
"def create\n tags = params[:bookmark][:tags].split(',').map do |tag|\n Tag.new(:name => tag.strip)\n end\n # use find_or_create\n @bookmark = Bookmark.find_or_create_by_user_id_and_url(:url => params[:bookmark][:url], :title => params[:bookmark][:title], :desc => params[:bookmark][:desc], :private => params[:bookmark][:private], :user_id => params[:bookmark][:user_id], :hashed_url => Digest::MD5.hexdigest(params[:bookmark][:url]) )\n \n respond_to do |format|\n if @bookmark.save\n # add bookmark id to each tag we created\n tags.each { |t| t.bookmark_id = @bookmark.id; t.save}\n if params[:bookmark][:is_popup]\n format.html { redirect_to(@bookmark, :notice => 'Close the Window!', :locals => {:close_window => 1}) }\n else \n format.html { redirect_to(@bookmark, :notice => 'Bookmark was successfully created.') }\n format.xml { render :xml => @bookmark, :status => :created, :location => @bookmark }\n end\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @bookmark.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def hashtag_validator\n context[:hashtag_validator] || ->(_hashtag) { true }\n end",
"def create\n # First, remove any duplicates and verify we have at least\n # one recipient who is not the submitter.\n # TODO: Validate recipients before submission with JS.\n emails = params[:recipients]\n emails = [] if emails.nil?\n emails.map! { |e| e.strip }\n emails.map! { |e| e.downcase }\n emails.uniq!\n emails.delete(@current_user.email.downcase)\n\n if emails.length == 0\n # TODO: Fill in the form with the data the user has already entered.\n redirect_to new_link_path\n flash[:error] = 'You need at least one recipient.'\n\n else\n @link = @current_user.submissions.new(params[:link])\n \n # Swap the URL and title if we think the user accidentally swapped them\n if [email protected]_url?(:url) && @link.is_url?(:title)\n @link.url, @link.title = @link.title, @link.url\n end\n \n if @link.save\n emails.each do |email|\n # Find the user or create a \"placeholder\" user.\n recipient = User.find_by_email(email)\n\n if recipient.nil?\n # We do not yet have an account associated with this email.\n # We will create a placeholder account to associate the shares with.\n # Authlogic requires all users have a password,\n # so we'll generate a random one.\n password = Digest::SHA1.hexdigest(rand(1000000).to_s)\n recipient = User.new(:email => email, :password => password,\n :password_confirmation => password,\n :perishable_token => \"\")\n recipient.reset_perishable_token!\n end\n\n if recipient.save\n share = recipient.shares.create(:link => @link)\n\n if recipient.share_notifications # || !recipient.activated\n # TODO:\n # Possibly distinguish between these three cases:\n # - Non-Activated User receiving first ever email from us\n # - Non-Activated User receiving not first email\n # - Activated User with email notifications on\n share.email_recipient\n end\n\n # Create friendships between submitter and recipient,\n # if they don't already exist.\n if !@current_user.friends.find_by_id(recipient)\n @current_user.friends.push(recipient)\n recipient.friends.push(@current_user)\n @current_user.save\n recipient.save\n end\n \n end # End if recipient.save\n end # End emails.each\n\n self_share = @current_user.shares.create(:link => @link)\n redirect_to share_path(self_share)\n\n else\n flash[:error] = 'The link could not be saved. Please wait a while then try again.'\n end # End if link saved\n \n end # End if emails.length\n end",
"def create\n @user = User.where(url_name: params[:user][:url_name]).first_or_initialize\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to user_path(@user.url_name), notice: 'User was successfully created.' }\n else\n format.html { redirect_to root_path }\n end\n end\n end",
"def create\n @battle = Battle.new\n @battle.user = current_user\n\n params[:battle][:hashtags_attributes].each do |i, hashtag|\n next if hashtag[:name].blank?\n @battle.hashtags << Hashtag.find_or_create_by(name: hashtag[:name])\n end\n\n # At least 2 valid hashtags - maximum 5\n if @battle.save\n redirect_to @battle\n else\n render new_battle_path(@battle), alert: @battle.errors\n end\n end",
"def create\n\t\tnew_rlink = params.require(:rlink).permit(:link, :random_string)\n\t\trlink = Rlink.create(new_rlink)\n \tredirect_to rlink\n\tend",
"def create\n incomplete = true\n error = false\n if ((params[:url] != nil) &&( (params[:description] != nil ) || (params[:bookmark][\"title\"] != nil )))\n incomplete = false\n url = nil\n if params[:url][:url]\n url = params[:url][:url]\n else\n url = params[:url]\n end\n if not ((url =~ /^http:\\/\\//) || (url =~ /^https:\\/\\//))\n url = \"http://\" + url\n end\n link = Link.find_by_url(url) || Link.new(:url => url)\n link.save\n if link.users.include?(current_user)\n flash[:message] = \"Already in\"\n else\n datetime = nil\n datetime = params[:dt] if params[:dt]\n description = params['description'] || params[:bookmark]['title']\n\n new_bookmark = Bookmark.new(:title => description, :link_id => link.id, :user_id => current_user.id, :bookmarked_at => (datetime || Time.now))\n new_bookmark.private = 1 if ((params[:shared] && (params[:shared] == \"no\")))\n new_bookmark.private = params[:bookmark][\"private\"] if params[:bookmark][\"private\"]\n new_bookmark.tag_list = params['tags'] || params[:bookmark]['tags']\n current_user.bookmarks_update_at = Time.now\n if new_bookmark.save\n current_user.save\n logger.info(\"bookmark for #{url} added\")\n else\n error = true\n logger.warn(\"Error : could not save the new bookmark\")\n end\n end\n end\n respond_to do |format|\n format.xml do\n if incomplete || error\n render :xml => \"<?xml version='1.0' standalone='yes'?>\\n<result code=\\\"something went wrong\\\" />\"\n else\n render :xml => \"<?xml version='1.0' standalone='yes'?>\\n<result code=\\\"done\\\" />\"\n end\n end\n end\n end",
"def save_link(params,user)\n # post_type_select(type)\n @post = Post.create(:user_id => user.id,\n :post_type_id => 2,\n :body_text => params[:title],\n :star_count => params[:star1])\n end",
"def post_hashtag_params\n params.require(:post_hashtag).permit(:post_id, :hashtag_id)\n end",
"def create\n @link = current_user.links.build(link_params)\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to @link, notice: 'Link was successfully created.' }\n format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generateHashtag(string)\n return false if string.gsub(/ /, \"\").empty?\n \n capitalized_string = string.split(\" \").map do |word|\n word.capitalize\n end\n \n hash_tag_str = capitalized_string.join(\"\").prepend(\"#\")\n \n if hash_tag_str.size <= 140\n return hash_tag_str\n else\n return false\n end\nend",
"def create\n @link = @question.links.new(params[:link])\n @link.user_id = current_user.id\n\n respond_to do |format|\n if @link.save\n flash[:notice] = 'link was successfully created.'\n format.html { redirect_to(@question) }\n format.xml { render :xml => @link, :status => :created, :location => @link }\n else\n format.html { redirect_to @question }\n flash[:notice] = 'Link must start with \"http://\"'\n format.xml { render :xml => @link.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @url = params[:url]\n token = SecureRandom.hex(4)\n @tiny_token = Url.create(\n url: @url,\n token: token,\n domain: \"#{ENV['HOSTNAME']}/#{token}\" \n )\n redirect_to url_path(token)\n \n end",
"def create\n name = params[\"name\"]\n linkedin_connections = params[\"linkedin_connections\"].to_i\n facebook_connections = params[\"facebook_connections\"].to_i\n twitter_followers = params[\"twitter_followers\"].to_i\n\n\n newuser = User.create(\n name: name, \n linkedin_connections: linkedin_connections,\n facebook_connections: facebook_connections, \n twitter_followers: twitter_followers,\n social_connection_index: User.compute_social_connection(\n linkedin_connections,\n facebook_connections,\n twitter_followers\n )\n )\n end",
"def create\n @link = Link.new(link_params)\n @link.user_id = session[:user_id]\n respond_to do |format|\n if @link.save\n format.html do\n redirect_to root_path,\n notice: \"Short Url is '#{@link.display_slug}'\"\n end\n format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_url_markup(text)\n urls = []\n users =[]\n text.split.each{|a| a=~/(http\\:\\/\\/\\S+)/; urls << $1}\n text.split.each{|a| a=~/(\\@\\S+)/; users << $1}\n users.compact.each{|user| text.gsub!(user, \"<a href='http://twitter.com/#{user.gsub('@','')}' target='_new'>#{user}</a>\")}\n urls.compact.each{|url| text.gsub!(url, \"<a href='#{url}' target='_new'>#{url}</a>\")}\n text\n end",
"def create\n if current_user.id == @user.id\n @shorturl = @user.shorturls.build(shorturl_params)\n respond_to do |format|\n if @shorturl.save\n format.html { redirect_to user_shorturl_path(@user, @shorturl), notice: 'Shorturl was successfully created.' }\n format.json { render :show, status: :created, location: @shorturl }\n else\n format.html { render :new }\n format.json { render json: @shorturl.errors, status: :unprocessable_entity }\n end\n end\n else\n flash[:error] = \"Not authorized!.\"\n redirect_to root_path\n end\n end",
"def create_new_user(github)\n user = User.new\n user.github_id = github.user.id\n user.email = github.user.email\n user.plan = 'basic'\n user.created_at = Time.now\n user.updated_at = Time.now\n user.token = github.access_token\n user.save\n flash[:info] = \"Hi friend! Let's start you out by creating your first book.\"\nend",
"def new_bookmark(username, password, uri, short_description)\n representation = form_encoded({ \"bookmark[uri]\" => uri,\n \"bookmark[short_description]\" => \n short_description })\n begin\n dest = \"#{@service_root}/users/#{URI.encode(username)}/bookmarks\"\n response = open(dest, :method => :post, :body => representation,\n :http_basic_authentication => [username, password])\n puts \"Bookmark posted to #{response.meta['location']}\"\n rescue OpenURI::HTTPError => e\n response_code = e.io.status[0].to_i\n if response_code == 401 # Unauthorized\n puts \"It looks like you gave me a bad password.\"\n elsif response_code == 409 # Conflict\n puts \"It looks like you already posted that bookmark.\"\n else\n raise e\n end\n end \n end",
"def create\n omniauth = request.env['omniauth.auth']\n authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])\n if authentication\n flash[:notice] = \"Signed in successfully\"\n sign_in_and_redirect(:user, authentication.user)\n else\n user = User.new\n user.apply_omniauth(omniauth)\n user.email = omniauth['extra'] && omniauth['extra']['user_hash'] && omniauth['extra']['user_hash']['email']\n if user.save\n flash[:notice] = \"Successfully registered\"\n sign_in_and_redirect(:user, user)\n else\n session[:omniauth] = omniauth.except('extra')\n session[:omniauth_email] = omniauth['extra'] && omniauth['extra']['user_hash'] && omniauth['extra']['user_hash']['email']\n\n # Check if email already taken. If so, ask user to link_accounts\n if user.errors[:email][0] =~ /has already been taken/ # omniauth? TBD\n # fetch the user with this email id!\n user = User.find_by_email(user.email)\n return redirect_to link_accounts_url(user.id)\n end\n redirect_to new_user_registration_url\n end\n end\n end",
"def create_skeleton\n email = params[:user][:email]\n\n if email.present? && user_already_exists(email)\n flash[:error] = \"This email already has a user\"\n render action: 'new_skeleton'\n else\n @user = User.create_unfinished(email, params[:user][:registration_attributes][:ticket_type_old], params[:user][:name])\n @user.company = params[:user][:company]\n @user.save!(:validate => false)\n\n flash[:notice] = \"Skeleton user created - creation link is #{user_from_reference_url(@user.registration.unique_reference)}\"\n redirect_to new_skeleton_user_path\n\n end\n end",
"def create\n @link = current_user.links.build(link_params)\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to @link, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_from_omniauth\n auth_hash = request.env[\"omniauth.auth\"]\n authentication = Authentication.find_by_provider_and_uid(auth_hash[\"provider\"], auth_hash[\"uid\"]) || Authentication.create_with_omniauth(auth_hash)\n\n # if: previously already logged in with OAuth\n if authentication.user\n user = authentication.user\n authentication.update_token(auth_hash)\n @next = root_url\n @notice = \"Signed in!\"\n # else: user logs in with OAuth for the first time\n else\n user = User.create_with_auth_and_hash(authentication, auth_hash)\n # you are expected to have a path that leads to a page for editing user details\n @next = edit_user_path(user)\n @notice = \"User created. Please confirm or edit details\"\n end\n\n sign_in(user)\n redirect_to @next, :notice => @notice\n end",
"def create\n\n @url = Url.new(url_params)\n @url.user = current_user\n @url.unique_key = @url.generate_unique_key\n\n #save data\n if @url.save\n response = {:status => 'success',\n :mgs => short_url(@url.unique_key)}\n else\n response = {:status => 'fail',\n :mgs => 'Not a valid URL.'}\n end\n\n #send response\n respond_to do |format|\n format.json { render json: response }\n end\n end",
"def create\n @users_interests_link = UsersInterestsLink.new(users_interests_link_params)\n\n respond_to do |format|\n if @users_interests_link.save\n format.html { redirect_to @users_interests_link, notice: 'Users interests link was successfully created.' }\n format.json { render :show, status: :created, location: @users_interests_link }\n else\n format.html { render :new }\n format.json { render json: @users_interests_link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n long_url = params.include?(:long_url) ? params[:long_url] : params[:link][:long_url]\n domain_id = params.include?(:domain_id) ? params[:domain_id] : params[:link][:domain_id]\n @link = Link.find_or_create_by_long_url_and_domain_id( long_url, domain_id )\n @link.ip_address = request.remote_ip\n @link.user_id = current_user.id\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to(@link, :notice => 'Link was successfully created.') }\n format.xml { render :xml => @link, :status => :created, :location => @link }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @link.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\tif params[:email].nil?\n\t\t@user = @current_user\n\telse\n\t\t@user = User.find_by_email(params[:email])\n\t\t\n\t\t# Create a new user with this email address...if one hasn't be found of course.\n\t\tif @user.nil? \n\t\t\t@user = User.new(:email => params[:email])\n\t\t\[email protected]\n\t\tend\n\tend\n\t\n\t# Need to generate a new hash code.\t\n\t@hashcode = @user.hashcodes.new(:hash => generate_hash, params[:inital_value], :current_value => params[:initial_value])\n\n respond_to do |format|\n if @hashcode.save\n format.html { redirect_to(@hashcode, :notice => 'Hashcode was successfully created.') }\n format.xml { render :xml => @hashcode, :status => :created, :location => @hashcode }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @hashcode.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_valid_tweet(user: nil)\n user = create_valid_user if user.nil?\n user.tweets.create(content: 'I’m really tilting today!')\n end",
"def create\n # decode url to remove duplicacy in case of same url encoded and decoded\n url = URI.decode(params[:url])\n # check if url already exists in db\n mini_url = MiniUrlHelper.check_existing_url(url, current_user)\n unless mini_url\n mini_url = MiniUrl.new\n mini_url.url = url\n # a check to handle invalid expiry time\n begin\n mini_url.expiry = DateTime.parse(params[:expiry])\n rescue ArgumentError => e\n logger.error \"Invalid expiry time.\"\n end\n mini_url.user = current_user if current_user\n # call method to generate unique code and save into db\n # raise exception in case of some error\n unless mini_url.generate_unique_code\n raise Exceptions::SavingError.new(mini_url.errors)\n end\n end\n short_url = \"#{BASE_URL}/#{mini_url.url_code}\"\n render json: {short_url: short_url}, status: 201\n rescue Exceptions::SavingError => e\n render json: {error: e}, status: 400\n end",
"def create\n auth = request.env[\"omniauth.auth\"]\n user = User.find_by_provider_and_uid(auth[\"provider\"], auth[\"uid\"]) || User.create_with_omniauth(auth)\n User.update(user.id, :fb_nickname => auth[\"info\"][\"nickname\"])\n session[:user_id] = user.id\n redirect_to root_url\n end",
"def create\n original_url = params[:short_url][:url]\n sanity_url = get_sanity_url(original_url)[0]\n @short_url = ShortUrl.find_by(sanity_url: sanity_url)\n if !@short_url.present?\n short_url = create_short_url\n while ShortUrl.find_by(short: short_url).present?\n short_url = create_short_url\n end\n @short_url = ShortUrl.new(original: original_url, short: short_url, sanity_url: sanity_url)\n @short_url.save\n end\n redirect_to @short_url, notice: 'Short url was successfully created.'\n end",
"def create_user(field_hash)\n field_hash[:id] = \"user/new\"\n payload = compose(field_hash)\n resp = @site['user/new/edit'].post payload\n new_id = resp.match(/User\\s*(\\d+)/)\n if new_id.class == MatchData\n new_user = new_id[1]\n else\n new_user = resp\n end\n new_user # return the new user id or the full REST response\n end",
"def create_referral_code\n referral_code = SecureRandom.hex(3)\n @collision = User.find_by_referral_code(referral_code)\n\n while [email protected]?\n referral_code = SecureRandom.hex(3)\n @collision = User.find_by_referral_code(referral_code)\n end\n\n self.referral_code = referral_code\n end",
"def create(sha, name)\n Ref.new(@repo, sha, name).save\n end",
"def create\n @vote = current_user.votes.where(:link_id => params[:vote][:link_id]).first || current_user.votes.create(params[:vote])\n @vote.update_attributes(:up => params[:vote][:up])\n\n @link = Link.where(:id => @vote.link_id).first\n\n if @vote.up\n @link.voteCount += 1\n @link.save\n else\n @link.voteCount -= 1\n @link.save\n end\n redirect_to :back\n end",
"def create\n data = request.env[\"omniauth.auth\"][:extra][:raw_info]\n attributes = { :github_data => data, :github_access_token => request.env[\"omniauth.auth\"][:credentials][:token] }\n user = User.find_or_create_by_username(data[:login], attributes)\n \n session[:user_id] = user.id\n redirect_to root_url, :notice => 'Successfully signed in via Github!'\n end",
"def create\n normalized_url = Link.normalize_url(params[:url])\n if normalized_url.nil?\n flash[:error] = \"Invalid URL\"\n redirect_to root_path\n else\n begin\n link = Link.find_or_create(normalized_url, params[:type])\n redirect_to root_path(code: link.code)\n rescue => error\n flash[:error] = ERROR_DB_CONNECTION\n redirect_to root_path\n end\n end\n end",
"def generateHashtag(string)\r\n return false if string.empty?\r\n words = string.split(\" \")\r\n capitals = words.map do |element|\r\n element.capitalize\r\n end\r\n joined = capitals.join\r\n hashed = joined.prepend(\"#\")\r\n \r\n if hashed.length > 140\r\n return false\r\n end\r\n return false if hashed == \"#\"\r\n hashed\r\nend",
"def amniauth_create\n user = User.find_or_create_by(:provider => auth_hash[:provider], :uid => auth_hash[:uid]) do |user|\n user.name = auth_hash[:info][:name]\n end\n\n session[:user_id] = user.id\n redirect_to user_path(user)\n end",
"def create(clean_url)\n key = generate_unique_key\n @@urls[key] = clean_url\n key\n end",
"def create\n @short_url = ShortUrl.new(params[:short_url])\n @short_url.user_id = current_user.id if signed_in?\n if @short_url.save\n redirect_to @short_url\n else\n render 'new'\n end\n end",
"def create_url\n\t\tif self.url.blank?\n\t\t\tself.url = self.title.downcase.gsub(/[^a-zA-Z0-9]+/, \"-\").chomp(\"-\")\n\t\tend\t\n\tend",
"def newpost(params,userid)\r\n db = connect_non_hash()\r\n db.execute(\"SELECT userid FROM users\")\r\n db.execute(\"INSERT INTO posts(title, text, userid) VALUES (?, ?, ?)\", params[\"title\"], params[\"text\"], userid)\r\n end",
"def create\n omniauth = request.env['omniauth.auth']\n authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])\n if authentication\n flash[:notice] = \"Signed in successfully\"\n sign_in_and_redirect(:user, authentication.user)\n else\n user = User.new\n user.apply_omniauth(omniauth)\n user.login = omniauth['info'] && omniauth['info']['nickname']\n if user.save\n flash[:notice] = \"Successfully registered\"\n sign_in_and_redirect(:user, user)\n else\n session[:omniauth] = omniauth.except('extra')\n session[:omniauth_login] = user.login\n\n # Check if login already taken. If so, ask user to link_accounts\n if user.errors[:login][0] =~ /has already been taken/ # omniauth? TBD\n # fetch the user with this login id!\n user = User.find_by_login(user.login)\n return redirect_to link_accounts_url(user.id)\n end\n redirect_to new_user_registration_url\n end\n end\n end",
"def create_skeleton\n email = params[:user][:email]\n\n if email.present? && user_already_exists(email)\n flash[:error] = \"This email already has a user\"\n render action: 'new_skeleton'\n else\n @user = User.create_unfinished(email, params[:user][:registration_attributes][:ticket_type_old], params[:user][:first_name], params[:user][:last_name])\n @user.company = params[:user][:company]\n @user.save!(:validate => false)\n\n flash[:notice] = \"Skeleton user created - creation link is #{user_from_reference_url(@user.registration.unique_reference)}\"\n redirect_to new_skeleton_user_path\n\n end\n end",
"def create_unique_id\n\t\tself.unique_id = loop do\n\t\t\trandom_token = SecureRandom.urlsafe_base64\n\t\t\tbreak random_token unless User.exists?(unique_id: random_token)\n\t\tend\n\tend",
"def create\n self.current_user = User.from_omniauth(request.env['omniauth.auth'])\n\n if current_user\n omniauth_params = request.env[\"omniauth.params\"]\n\n # if there is an invite token\n if omniauth_params && omniauth_params[\"workingtitle_invite_token\"]\n token = omniauth_params[\"workingtitle_invite_token\"]\n\n # Fetch the invite from the token\n invite = Invite.find_by(token: token)\n\n invite.accept(current_user)\n end\n\n redirect_to profile_path\n else\n redirect_to auth_path(provider: 'github')\n end\n end",
"def create\n @user = User.find(params[:user_id])\n @tweet = @user.tweets.create(tweet_params)\n redirect_to user_tweets_path\n end",
"def ensure_unique_url_for!(instance)\n instance.send :ensure_unique_url\n instance.save\n end",
"def create\n # You have to use Tweet.create instead of Tweet.new because you need @tweet to create the id to be able to use it wehn we connect the associaiton between tags and tweet through Tweet_tag. The association can be formed without an id from @tweet \n @tweet = Tweet.create(tweet_params)\n # We make a new array to hold each word of our tweet\n message_arr = Array.new \n message_arr = @tweet.message.split \n\n #This will parse through the indiviual words in that tweet \n message_arr.each_with_index do |word,index|\n #If the first letter is a hashtag in the word \n #We will either add it in our Tag model, or if it wasn't created yet we create a new instance of it \n if word[0] == \"#\"\n #Pluck is a method that returns an array of attributes that matches the column's name \n #With that being said we are looking if that array includes the word \n #If it does then there is already a record of it in our database if not we will add it in \n if Tag.pluck(:phrase).include?(word)\n tag = Tag.find_by(phrase: word)\n else \n tag = Tag.create(phrase: word)\n end\n # So after we create a new instance of Tag or found it in the database we can use both tag and @tweet to set up the association by passing it into TweetTag \n tweet_tag = TweetTag.create(tweet_id: @tweet.id, tag_id: tag.id)\n #message_arr[index] will return the word that includes the #hashtag, then we will change that #hashtag word into a link\n message_arr[index] = \"<a href='/tag_tweets?id=#{tag.id}'>#{word}</a>\"\n end\n end\n #After We are do with parsing through the tweet and checking if there is a #hashtag or not we then join the tweet back together because it was split and assign \n @tweet.update(message: message_arr.join(\" \"))\n\n\n # get_tag(@tweet)\n\n respond_to do |format|\n if @tweet.save\n format.html { redirect_to @tweet, notice: 'Tweet was successfully created.' }\n format.json { render :show, status: :created, location: @tweet }\n else\n format.html { render :new }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_link\n if request.post?\n @link = @semester.links.build(params[:link])\n @link.user_id = @current_user.id\n if @link.save\n flash[:notice] = \"#{@link.title} created\"\n redirect_to :action => :index\n else\n render :action => :new\n end\n end\n end",
"def create\n result = Feed.add_new_feed_and_subscribe(feed_params[:link], current_user)\n if result\n flash[:success] = 'Feed was successfully created.'\n redirect_to root_path\n else\n flash[:danger] = \"Incorrect url!\"\n render :new\n end\n end",
"def create\n self.current_user = User.from_omniauth(request.env['omniauth.auth'])\n\n if current_user\n # Send the email notifying the user!\n NotificationsMailer.signup(@user).deliver_later\n # byebug\n redirect_to request.referer\n else\n redirect_to auth_path(provider: 'github')\n end\n end",
"def create\n @url = current_user.urls.new(params[:url])\n\n respond_to do |format|\n if @url.save\n format.html { redirect_to urls_path, notice: 'Url was successfully created.' }\n format.json { render json: @url, status: :created, location: @url }\n else\n format.html { render action: \"new\" }\n format.json { render json: @url.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @link = current_user.links.new( link_params )\n # @link = Link.new( link_params )\n # @link.user = current_user\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to @link, notice: 'Link was successfully created.' }\n format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6276606",
"0.6202676",
"0.61001676",
"0.59725183",
"0.596226",
"0.5920033",
"0.58886516",
"0.5843941",
"0.5832488",
"0.57839763",
"0.577944",
"0.5753665",
"0.57100356",
"0.56897473",
"0.5648748",
"0.5622995",
"0.5612145",
"0.56117785",
"0.559029",
"0.5563605",
"0.5550096",
"0.55438614",
"0.55100703",
"0.55024594",
"0.550124",
"0.54963624",
"0.5494061",
"0.5485316",
"0.5484066",
"0.54718566",
"0.54646504",
"0.5462955",
"0.5462927",
"0.5454095",
"0.5418401",
"0.5418322",
"0.5412426",
"0.54107326",
"0.5410604",
"0.5391093",
"0.5381131",
"0.53794885",
"0.5377349",
"0.5377349",
"0.53694934",
"0.53651536",
"0.5356682",
"0.5351129",
"0.5348961",
"0.5348332",
"0.5345888",
"0.5341306",
"0.5335281",
"0.5327228",
"0.53224134",
"0.53142893",
"0.53103244",
"0.5306179",
"0.5292571",
"0.52917254",
"0.52857554",
"0.527837",
"0.5263809",
"0.5258857",
"0.5254375",
"0.5252128",
"0.5248923",
"0.52478117",
"0.5244356",
"0.52420706",
"0.5241937",
"0.52313983",
"0.52294093",
"0.522782",
"0.52257204",
"0.5223883",
"0.52215415",
"0.5211887",
"0.5202227",
"0.5201361",
"0.5198634",
"0.51884377",
"0.51868755",
"0.518567",
"0.5181935",
"0.51812375",
"0.5180001",
"0.51764303",
"0.51743096",
"0.5173691",
"0.5161842",
"0.5159228",
"0.51540184",
"0.5146257",
"0.5131626",
"0.51247734",
"0.5120239",
"0.51130116",
"0.51116675",
"0.5108935"
] | 0.71317446 | 0 |
Destroy the userhashtag link. | def destroy
if session[:user]
logger.debug "Poop: #{params[:id]}"
@userhashtag = Userhashtag.find(params[:id])
#Verify that the user isn't sneaky and tried to delete someone else's hashtag
if @userhashtag.user_id == session[:user].id
@userhashtag.destroy
render json: @userhashtag
end
else
render json: {}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @message_hashtag.destroy\n respond_to do |format|\n format.html { redirect_to message_hashtags_url, notice: 'Message hashtag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @link = UserLink.find(params[:id])\n @link.destroy\n\n redirect_to links_url\n end",
"def destroy\n @users_interests_link.destroy\n respond_to do |format|\n format.html { redirect_to users_interests_links_url, notice: 'Users interests link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @twitter_crawler_hash_tag = TwitterCrawlerHashTag.find(params[:id])\n @twitter_crawler_hash_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to(twitter_crawler_hash_tags_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n @linked_user.delete(@uri)\n end",
"def destroy\n #@user.email_links.destroy_all\n @user&.destroy\n respond_to do |format|\n format.html { redirect_back fallback_location: users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @social_media_link.destroy\n\n head :no_content\n end",
"def destroy\n @users_hacktag = UsersHacktag.find(params[:id])\n @users_hacktag.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_hacktags_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @hash_tag = HashTag.find(params[:id])\n @hash_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to(hash_tags_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n if current_user.id == @user.id\n @shorturl.destroy\n\n respond_to do |format|\n format.html { redirect_to user_shorturls_path(@user), notice: 'Shorturl was successfully destroyed.' }\n format.json { head :no_content }\n end\n else\n flash[:error] = \"Not authorized!.\"\n redirect_to root_path\n end\n end",
"def destroy\n @useful_link = UsefulLink.find(params[:id])\n @useful_link.destroy\n\n respond_to do |format|\n format.html { redirect_to useful_links_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n destroy_and_respond(@link)\n end",
"def destroy\n @user.destroy\n head :no_content\n end",
"def destroy\n @user.destroy\n\n head :no_content\n end",
"def destroy\n @user.destroy\n\n head :no_content\n end",
"def destroy\n @user.destroy\n redirect_to(home_path)\n end",
"def destroy\n\t\tlink = current_user.links.find(params[:id])\n\t\trespond_to do | format |\n\t\t\tif link.destroy\n\t\t\t\tformat.html{\n\t\t\t\t\tredirect_to links_url\n\t\t\t\t}\n\t\t\telse\n\t\t\t\tformat.html{\n\t\t\t\t\tredirect_to link\n\t\t\t\t}\n\t\t\tend\n\t\tend \n\tend",
"def destroy\n @user_agent.destroy\n\n head :no_content\n end",
"def destroy\n @bb_auth_user = BbAuthUser.find(params[:id])\n @bb_auth_user.destroy\n\n respond_to do |format|\n format.html { redirect_to(bb_auth_users_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @test_link.destroy\n end",
"def destroy\n @big_auth_user = BigAuth::User.find(params[:id])\n @big_auth_user.destroy\n\n respond_to do |format|\n format.html { redirect_to(big_auth_users_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @user.destroy\n\n head :no_content\n end",
"def destroy\n @user.destroy\n\n head :no_content\n end",
"def destroy\n @myuser.destroy\n\n head :no_content\n end",
"def destroy\n user = user_from_token\n user.tweets.destroy(params[:id])\n head :no_content\n end",
"def destroy\r\n @user = User.find(params[:id])\r\n @user.delete!\r\n track_activity @user\r\n\r\n redirect_to users_path, only_path: true \r\n end",
"def destroy\n user = User.find(params[:id])\n user.destroy\n head :no_content\n end",
"def destroy\n @user_tag = UserTag.find(params[:id])\n @user_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to user_tags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @instagram_user.destroy\n respond_to do |format|\n format.html { redirect_to instagram_users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user.destroy\n head :no_content\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n #head :no_content\n head :accepted # o deberia dejarlo en not_content\n end",
"def destroy\n @user.destroy\n head :no_content\n end",
"def destroy\n @user.destroy\n head :no_content\n end",
"def destroy\n @user.destroy\n head :no_content\n end",
"def destroy\n @external_link = ExternalLink.find(params[:id])\n @external_link.destroy\n\n respond_to do |format|\n format.html { redirect_to(backend_social_path) }\n end\n end",
"def destroy\n @user_comment_tag = UserCommentTag.find(params[:id])\n @user_comment_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to user_comment_tags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hastag.destroy\n respond_to do |format|\n format.html { redirect_to hastags_url, notice: 'Hastag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_user.destroy\n\n head :no_content\n end",
"def destroy\n @user.destroy\n head :no_content\n end",
"def destroy\n @facebooklink.destroy\n respond_to do |format|\n format.html { redirect_to facebooklinks_url, notice: 'Facebooklink was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_follow_tag = UserFollowTag.find(params[:id])\n @user_follow_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to user_follow_tags_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: '투표안건이 성공적으로 삭제되었습니다.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find_by_urlname(params[:id])\n @user.destroy\n \n respond_to do |format|\n flash[:notice] = \"User deleted from the system\"\n format.html { redirect_to users_path }\n format.xml { head :ok }\n end\n end",
"def destroy_links\n user_links = @current_user.links\n user_links.each do |link|\n # Queue a job to delete each link\n Delayed::Job.enqueue(DeleteLinkJob.new(link.short_url))\n end\n\n # Indicate that the deletion has been queued\n head :accepted\n end",
"def destroy\n\t\t@room_user.destroy\n\t\thead :no_content\n\tend",
"def destroy\n @habrauser = Habrauser.find(params[:id])\n @habrauser.destroy\n\n respond_to do |format|\n format.html { redirect_to(habrausers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event_users_linking.destroy\n respond_to do |format|\n format.html { redirect_to event_users_linkings_url, notice: 'Event details linking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_hito.destroy\n respond_to do |format|\n format.html { redirect_to user_hitos_url, notice: 'User hito was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user.destroy\n redirect_to root_url\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n head :no_content\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n head :no_content\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n head :no_content\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n head :no_content\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n head :no_content\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n head :no_content\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n head :no_content\n end",
"def destroy\n @hash_tag.destroy\n respond_to do |format|\n format.html { redirect_to hash_tags_url, notice: 'Hash tag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @auth_user.destroy\n end",
"def destroy\n @fbpost.destroy\n head :no_content\n end",
"def destroy\n @twitter_user = TwitterUser.find(params[:id])\n @twitter_user.destroy\n\n respond_to do |format|\n format.html { redirect_to twitter_users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @url_link.destroy\n respond_to do |format|\n format.html { redirect_to url_links_url, notice: 'Url link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visitor_home.update_attributes(:twitter_name => nil, :twitter_token => nil, :twitter_secret => nil)\n redirect_to :action => 'show'\n end",
"def destroy\n @user_share = UserShare.find(params[:id])\n @user_share.destroy\n\n respond_to do |format|\n format.html { redirect_to user_shares_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user.destroy!\n\n render nothing: true, status: :no_content\n end",
"def destroy\n\t\[email protected]\n\tend",
"def destroy\n @link.destroy\n flash[:success] = \"Link to Doc Deleted\"\n redirect_to current_user\n \n end",
"def destroy\n user = @current_user\n if user.destroy\n head :no_content\n else\n head :bad_request\n end\n end",
"def destroy\n conn.delete(self_link)\n end",
"def destroy\n @recommended_link.destroy\n\n head :no_content\n end",
"def destroy\n\t\trlink = Rlink.find(params[:id])\n\t\trlink.destroy\n\n\t\tredirect_to action: :index\n\tend",
"def destroy\n @guidances_user.destroy\n respond_to do |format|\n format.html { redirect_to guidances_users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t@tag = Tag.find(params[:id])\n\t\[email protected]\n\t\tredirect_to user_path(session[:current_user_id])\n\tend",
"def destroy\n\t\t@user = User.find(params[:id])\n \t\[email protected]\n\t \tredirect_to '/logout'\n\tend",
"def destroy\n @quicklink.destroy\n respond_to do |format|\n format.html { redirect_to quicklinks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\[email protected]\n\t\tredirect_to users_path\n\n\tend",
"def destroy\n @link = Link.find_by_slug(params[:id])\n @link.comments.each do |c|\n c.destroy\n end\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'BLAM! Link was thoroughly destroyed!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t#logout method is defined in helper file\n\t\tsession[:user_id] = nil\n\t\tredirect_to root_path\n\tend",
"def destroy\n if @user.destroy\n redirect_to index_user_path\n end\n end",
"def destroy\n @user.destroy\n redirect_to root_path\n end",
"def destroy\n @user.destroy\n redirect_to root_path\n end",
"def destroy\n @user_mention.destroy\n respond_to do |format|\n format.html { redirect_to user_mentions_url, notice: 'User mention was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n NotesUser.where(:note_id => @note.id).each do |nt| # destroy sharing links of this note\n nt.destroy\n end\n\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url, notice: 'Note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy \n session.delete :user_id \n head :no_content \n end",
"def destroy\n @fbcomment.destroy\n\n head :no_content\n end",
"def destroy\n @link = Links.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to('/') }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n redirect_to(root_path)\n end",
"def destroy\n @user_token = UserToken.find(params[:id])\n @user_token.destroy\n\n respond_to do |format|\n format.html { redirect_to user_tokens_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @tweet.destroy\n\n head :no_content\n end",
"def destroy\n @bookmark.destroy\n flash[:notice] = t('controller.successfully_deleted', :model => t('activerecord.models.bookmark'))\n @bookmark.create_tag_index\n\n if @user\n respond_to do |format|\n format.html { redirect_to user_bookmarks_url(@user) }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to user_bookmarks_url(@bookmark.user) }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n\t\tuser = current_user\n\n\t\tsession.delete(:user_id)\n\t\tdelete_current_user()\n\t\t\n\t\tuser.destroy\n\t\tredirect_to home_path\n\tend",
"def destroy\n unless is_owner? @link\n render :file => \"public/401.html\", :status => :unauthorized\n return\n end\n \n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bookmark = Bookmark.find(params[:id])\n @user = User.find(session[:user_id])\n @user.bookmarks.delete(@bookmark)\n\n respond_to do |format|\n format.html { redirect_to(bookmarks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @current_user = current_user()\n Like.find_by(user: @current_user, gossip: Gossip.find(params[:format])).destroy\n end",
"def destroy\n @link.destroy\n flash[:success] = 'Shorty was successfully deleted!'\n redirect_to root_path\n end",
"def destroy\n\t\t@user = User.find(params[:id])\n\t\[email protected]\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(user_index_url) }\n\t\t\tformat.xml { head :ok }\n\t\tend\n\tend",
"def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Review 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(scriptwords_users_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @link.destroy\n flash[:success] = \"Link gelöscht!\"\n respond_to do |format|\n format.html { redirect_to pot_path(@link.pot) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blog_link.destroy\n respond_to do |format|\n format.html { redirect_to blog_links_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.7061887",
"0.7016479",
"0.67993236",
"0.67949414",
"0.6739025",
"0.6663333",
"0.6637318",
"0.65807587",
"0.65647125",
"0.6560475",
"0.6554314",
"0.65458584",
"0.6525744",
"0.6525666",
"0.6525666",
"0.6523783",
"0.65194356",
"0.65089685",
"0.6502533",
"0.64780736",
"0.6458685",
"0.64499843",
"0.64499843",
"0.6448901",
"0.64412165",
"0.6427772",
"0.6402796",
"0.63986933",
"0.63801545",
"0.6377424",
"0.6375473",
"0.63745546",
"0.63745546",
"0.63745546",
"0.636011",
"0.6355905",
"0.6355778",
"0.6346605",
"0.6342525",
"0.6336907",
"0.63292646",
"0.63269657",
"0.6326376",
"0.6313926",
"0.6311245",
"0.63097936",
"0.63036186",
"0.63005954",
"0.6289978",
"0.62872624",
"0.62872624",
"0.62872624",
"0.62872624",
"0.62872624",
"0.62872624",
"0.62872624",
"0.6277732",
"0.6274892",
"0.62668866",
"0.62632585",
"0.62613344",
"0.62600684",
"0.6259418",
"0.6259098",
"0.62586236",
"0.62455064",
"0.62382036",
"0.62333727",
"0.6232923",
"0.6231648",
"0.6227325",
"0.62264174",
"0.62256336",
"0.62231344",
"0.62231046",
"0.62215567",
"0.6219889",
"0.6213595",
"0.6207359",
"0.61962605",
"0.61962605",
"0.6187913",
"0.6185666",
"0.6185322",
"0.6185217",
"0.6179326",
"0.6177928",
"0.61762273",
"0.617149",
"0.616473",
"0.61526686",
"0.6142555",
"0.61389995",
"0.61381805",
"0.61377215",
"0.61347103",
"0.6126949",
"0.6125911",
"0.6125249",
"0.6124492"
] | 0.7819325 | 0 |
Converts CamelCase words into snake_case | def underscore(camel_cased_word)
camel_cased_word.to_s.gsub(/::/, '/').
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').gsub(/([a-z\d])([A-Z])/,'\1_\2').
tr("-", "_").downcase
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snake_case\n return downcase if match(/\\A[A-Z]+\\z/)\n gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2').\n gsub(/([a-z])([A-Z])/, '\\1_\\2').\n downcase\n end",
"def snake_case\n self.gsub(/([a-z])([A-Z])/) {|s| \"#{s[0]}_#{s[1]}\"}.gsub(/([A-Z])([A-Z][a-z])/) {|s| \"#{s[0]}_#{s[1..2]}\"}.downcase\n end",
"def snake_case\n gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .tr('-', '_')\n .downcase\n end",
"def to_snake\n words = self\n .split(/([[:upper:]][[:lower:]]*)/)\n .select { |word| word.size > 0}\n lower_case_words = words.map { |word| word.downcase }\n lower_case_words.join('_')\n end",
"def pascalcase_to_snakecase(word)\n\tword.gsub(/\\B([A-Z])(?=[a-z0-9])|([a-z0-9])([A-Z])/, '\\2_\\+').downcase\nend",
"def snakecase(name)\n name.gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').downcase\n end",
"def snake_case(group = true)\n\t\t\treturn self unless self =~ %r/[A-Z\\s]/\n\t\t\treverse.scan(%r/[A-Z]+|[^A-Z]*[A-Z]+?|[^A-Z]+/).reverse.map{|word| word.reverse.downcase}.join('_').gsub(/\\s/,'_')\n\t\tend",
"def snake_case(str); end",
"def snakecase(string); end",
"def snake_case(name)\n name.gsub(/([a-z])([A-Z0-9])/, '\\1_\\2' ).downcase\nend",
"def snakecase\n str = dup\n str.gsub! /::/, '/'\n str.gsub! /([A-Z]+)([A-Z][a-z])/, '\\1_\\2'\n str.gsub! /([a-z\\d])([A-Z])/, '\\1_\\2'\n str.tr! \".\", \"_\"\n str.tr! \"-\", \"_\"\n str.downcase!\n str\n end",
"def camel_to_snake_case input\n input = input.to_s.dup\n\n # handle camel case like FooBar => Foo_Bar\n while input.gsub!(/([a-z]+)([A-Z])(\\w+)/) { $1 + '_' + $2 + $3 }\n end\n\n # handle abbreviations like XMLParser => XML_Parser\n while input.gsub!(/([A-Z]+)([A-Z])([a-z]+)/) { $1 + '_' + $2 + $3 }\n end\n\n input\n end",
"def camel_to_snake(input)\n input.gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').downcase\n end",
"def camel_to_snake(camel_string)\n camel_string.gsub(/[[:lower:]][[:upper:]]/) { |x| x.chars.join('_').downcase }\nend",
"def to_snake_case\n gsub(/\\W/, '_')\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z])([A-Z])/, '\\1_\\2')\n .downcase\n .gsub(/_+/, '_')\n end",
"def camel_to_snake(string)\n chopped_camel = string.to_s.split(/([A-Z](?:\\d|[a-z])+)/).reject(&:empty?)\n chopped_camel.each_with_index.map {|word, idx| idx == 0 ? word.downcase : word.downcase.prepend('_') }.join\nend",
"def snake_case(name); end",
"def camel_case_to_snake_case(camel_case)\n camel_case.to_s.gsub(/([a-z])([A-Z])/, '\\1_\\2').gsub(/([A-Z])([A-Z])([a-z])/, '\\1_\\2\\3').downcase\n end",
"def snake_case(str)\n str.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/, '\\1_\\2').\n tr('-', '_').\n downcase\n end",
"def snake_case2\n (self.gsub! /(.)([A-Z])/, '\\1_\\2').downcase\n rescue\n self\n end",
"def snake_case(str)\n str.gsub(/::/, '/')\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .tr('-', '_').downcase\n end",
"def snake_case(str)\n str = str.dup\n str.gsub!(/[A-Z]/) {|s| \"_\" + s}\n str.downcase!\n str.sub!(/^\\_/, \"\")\n str\nend",
"def snake_case(str)\n str.gsub(/::/, '/')\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .tr('-', '_')\n .downcase\n end",
"def snake_to_camel(snake_string)\n string = snake_string.gsub(/(_[a-z])/) {|match| match[1].upcase}\n string\nend",
"def snakify\n return downcase if match(/\\A[A-Z]+\\z/)\n gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2').\n gsub(/([a-z])([A-Z])/, '\\1_\\2').\n downcase\n end",
"def to_snake_case(s)\n s.to_s.split(/(?=[A-Z])/).join(\"_\").downcase\nend",
"def snake_case(string)\n string.gsub(/::/, '/')\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .tr('-', '_')\n .downcase\n end",
"def snake_case(string)\n string.gsub(/::/, '/')\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .tr('-', '_')\n .downcase\n end",
"def snake_case(string)\n string.gsub(/::/, '/')\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .tr('-', '_')\n .downcase\n end",
"def snake(str)\n words = str.split\n current_word = 1\n\n loop do\n words[current_word].downcase!\n\n current_word += 1\n break if current_word >= words.size\n end\n\n words.join('_')\nend",
"def camel(snake_case)\n snake_case.to_s.capitalize.gsub(/_./) { |match| match[1].upcase }\n end",
"def snake_case(preserve_prefixed_underscores: true)\n LuckyCase.snake_case self, preserve_prefixed_underscores: preserve_prefixed_underscores\n end",
"def snake_case_to_capitalised(str)\n str.split(\"_\").map(&:capitalize).join(\" \")\n end",
"def to_snake_case(str)\n str.chars.map { |e| e == e.upcase ? \"_#{e.downcase}\" : e }.join\nend",
"def to_snake_case\n gsub(/::/, '/')\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .tr('-', '_')\n .downcase\n end",
"def snake_to_camel(s)\n s.to_s.split('_').map(&:capitalize).join('')\n end",
"def train_case(preserve_prefixed_underscores: true)\n LuckyCase.train_case self, preserve_prefixed_underscores: preserve_prefixed_underscores\n end",
"def sentence_case(preserve_prefixed_underscores: true)\n LuckyCase.sentence_case self, preserve_prefixed_underscores: preserve_prefixed_underscores\n end",
"def to_snake_case(str)\n return downcase if match()\nend",
"def snake_case(object)\n # Implementation copied from: https://github.com/rubyworks/facets/blob/master/lib/core/facets/string/snakecase.rb\n # gsub(/::/, '/').\n should_symbolize = object.is_a?(Symbol)\n raise \"snake_case method only handles strings and symbols, passed a #{object.class}: #{object}\" unless should_symbolize || object.is_a?(String)\n\n text = object.to_s\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .tr('-', '_')\n .gsub(/\\s/, '_')\n .gsub(/__+/, '_')\n .downcase\n should_symbolize ? text.to_sym : text\n end",
"def snake(string)\n string.to_s.gsub(/([a-z])([A-Z])/, '\\1_\\2').downcase.to_sym\n end",
"def titlecase!\n replace(titlecase)\n end",
"def titlecase\n first = true\n words = downcase.split(/(?<!\\w')\\b/)\n\n words.map.with_index do |word,i|\n if LOWERCASE_WORDS.include?(word) and i > 0 # leave LOWERCASE_WORDS lowercase, unless it's the first word.\n word\n else\n word.gsub(/^\\w/) { |c| c.upcase } # capitalize first letter\n end\n end.join('')\n end",
"def titlecase\n first = true\n words = downcase.split(/(?<!\\w')\\b/)\n\n words.map.with_index do |word,i|\n if LOWERCASE_WORDS.include?(word) and i > 0 # leave LOWERCASE_WORDS lowercase, unless it's the first word.\n word\n else\n word.gsub(/^\\w/) { |c| c.upcase } # capitalize first letter\n end\n end.join('')\n end",
"def word_case(preserve_prefixed_underscores: true)\n LuckyCase.word_case self, preserve_prefixed_underscores: preserve_prefixed_underscores\n end",
"def titlecase\n\t\tsplit(/(\\W)/).map(&:capitalize).join\n\tend",
"def lower_camelcase\n str = dup\n str.gsub!(/\\/(.?)/) { \"::#{$1.upcase}\" }\n str.gsub!(/(?:_+|-+)([a-z])/) { $1.upcase }\n str.gsub!(/(\\A|\\s)([A-Z])/) { $1 + $2.downcase }\n str\n end",
"def case_fix(name)\r\n fixed_name = name.split(' ')\r\n fixed_name.each do |word|\r\n word.capitalize!\r\n end\r\n fixed_name.join(' ')\r\nend",
"def smart_titlecase\n small_words = %w(a an and as at but by en for if in of on or the to v v. via vs vs. von)\n\n x = split(\" \").map do |word|\n # note: word could contain non-word characters!\n # downcase all small_words, capitalize the rest\n small_words.include?(word.gsub(/\\W/, \"\").downcase) ? word.downcase! : word.smart_capitalize!\n word\n end\n # capitalize first and last words\n x.first.smart_capitalize!\n x.last.smart_capitalize!\n # small words after colons are capitalized\n x.join(\" \").gsub(/:\\s?(\\W*#{small_words.join(\"|\")}\\W*)\\s/) { \": #{$1.smart_capitalize} \" }\n end",
"def camel_case\n gsub /(?:^|_)(.)/ do $1.upcase end\n end",
"def snake_case_to_camel_case(value)\n pieces = value.to_s.split '_'\n\n (pieces[0] + pieces[1..-1].map(&:capitalize).join).to_sym\n end",
"def titlecase()\r\n ignore_list = %w{of etc and by the for on is at to but nor or a via}\r\n capitalize_all_ex(ignore_list)\r\n end",
"def keys_to_snake_case(hash)\n hash.transform_keys do |key|\n key.gsub(%r{([A-Z]+)([A-Z][a-z])}, '\\1_\\2')\n .gsub(%r{([a-z\\d])([A-Z])}, '\\1_\\2')\n .downcase\n .to_sym\n end\n end",
"def upcase() end",
"def to_lower_case(word)\n return word.downcase\n end",
"def snakify(string)\n string.split(/(?=[A-Z])/).map(&:downcase).join('_')\n end",
"def shout(words)\n\twords.upcase\nend",
"def downcase() end",
"def upcase!() end",
"def camel_case\n @word.split(' ').collect(&:capitalize).join\n end",
"def downcase!() end",
"def smash\n downcase.scan(/\\w+/).join\n end",
"def snake_name\n @_snake_name ||= name_components.map(&:downcase).join('_')\n end",
"def camel_to_snake(ident)\n ident = ident.is_a?(String) ? ident.dup : ident.to_s\n ident[0] = ident[0].downcase\n ident.chars.reduce('') { |s, c| s + (/[A-Z]/ =~ c ? \"_#{c.downcase}\" : c) }.to_sym\nend",
"def camel_to_snake(ident)\n ident = ident.is_a?(String) ? ident.dup : ident.to_s\n ident[0] = ident[0].downcase\n ident.chars.reduce('') { |s, c| s + (/[A-Z]/ =~ c ? \"_#{c.downcase}\" : c) }.to_sym\nend",
"def to_camel_case\n return self if self !~ /_/ && self !~ /\\s/ && self =~ /^[A-Z]+.*/\n\n gsub(/[^a-zA-Z0-9ññÑáéíóúÁÉÍÓÚüÜ_]/, \"_\")\n .split(\"_\").map(&:capitalize).join\n end",
"def camel_case(text)\n text.gsub(/_\\w/) {|match| match[1..-1].upcase}\n end",
"def titlecase(input)\n input.titlecase\n end",
"def camelize!\n self.titleize!\n self.replace(self[0, 1].downcase + self[1..-1])\n end",
"def camel_lower(value)\n case value\n when Array then value.map { |item| camel_lower(item) }\n when Hash then value.deep_transform_keys! { |key| camel_lower(key) }\n when Symbol then camel_lower(value.to_s).to_sym\n when String then value.underscore.camelize(:lower)\n else value\n end\n end",
"def hedcase\n return \"\" if empty?\n\n self.downcase!\n\n # Split on word-boundaries\n words = self.to_s.split( /\\b/ )\n\n # Always capitalize the first and last words\n words.first.capitalize!\n words.last.capitalize!\n\n # Now scan the rest of the tokens, skipping non-words and capitalization\n # exceptions.\n words.each_with_index do |word, i|\n\n # Non-words\n next unless /^\\w+$/.match( word )\n\n # Skip exception-words\n next if TITLE_CASE_EXCEPTIONS.include?( word )\n\n # Skip second parts of contractions\n next if words[i - 1] == \"'\" && /\\w/.match( words[i - 2] )\n\n word.capitalize!\n end\n\n return words.join\n end",
"def camel_case(str); end",
"def downcase_camelcase_input(input)\n input.split(\" \").collect do |word|\n word.downcase.capitalize\n end.join(\" \")\n end",
"def capital_word_case(preserve_prefixed_underscores: true)\n LuckyCase.capital_word_case self, preserve_prefixed_underscores: preserve_prefixed_underscores\n end",
"def camelcase(s)\n\n\nend",
"def titlecase\n gsub(/\\b\\w/){ $`[-1,1] == \"'\" ? $& : $&.upcase }\n end",
"def camel_case_lower(str)\n str.strip().gsub(' ','').split('_').inject([]){ |buffer,e| buffer.push(buffer.empty? ? e : e.capitalize) }.join\n end",
"def pascal_case(object)\n should_symbolize = object.is_a?(Symbol)\n raise \"snake_case method only handles strings and symbols, passed a #{object.class}: #{object}\" unless should_symbolize || object.is_a?(String)\n\n # Break word boundaries to snake case first\n text = snake_case(object.to_s).split('_').collect(&:capitalize).join\n should_symbolize ? text.to_sym : text\n end",
"def studly_caps(delimiter = '_')\n ((self.start_with?(delimiter) ? '' : delimiter) + self).camel_case(delimiter)\n end",
"def mixed_case_2(name)\n\tname.downcase.gsub(/\\b\\w/, &:upcase)\nend",
"def underscorize!\n self.replace(self.scan(/[A-Z][a-z]*/).join(\"_\").downcase)\n end",
"def shout(word)\n\treturn word.upcase\nend",
"def spell_out str\n str.downcase\nend",
"def titlecase(text)\n return text.to_s.titlecase\n end",
"def titlecase\n self\n .split(/ /)\n .map{ |word| word.capitalize }\n .join(' ')\n end",
"def swapcase!() end",
"def downcase; end",
"def mixed_case(name)\n name.downcase.gsub(/\\b\\w/, &:upcase)\nend",
"def staggered_case(words)\n mixed_chars = words.chars.each_with_index.map do |char, index|\n if index.even? && char =~ /[a-zA-Z]/\n char.upcase\n elsif index.odd? && char =~ /[a-zA-Z]/\n char.downcase\n else\n char\n end\n end\n mixed_chars.join\nend",
"def titlecase(string)\n string.dup.tap do |result|\n word_iterator.each_word(result) do |_, *boundary_pair|\n if cased_pos = first_cased(string, *boundary_pair)\n result[cased_pos] = titlecasing_hash[result[cased_pos]]\n\n (cased_pos + 1).upto(boundary_pair.last - 1) do |pos|\n result[pos] = lowercasing_hash[result[pos]]\n end\n end\n end\n end\n end",
"def swapcase() end",
"def upcase(input); end",
"def camel_case(preserve_prefixed_underscores: true)\n LuckyCase.camel_case self, preserve_prefixed_underscores: preserve_prefixed_underscores\n end",
"def acronymize_online(sentence)\n sentence.split.map { |word| word[0].upcase }.join\nend",
"def as_english_word\n self.name.gsub(/\\W/,\" \").gsub(/([a-z])([A-Z])/,\"\\\\1 \\\\2\").\n squeeze(\" \").strip.downcase\n end",
"def camelize(first_letter_in_uppercase=true)\n word = self.dup\n if first_letter_in_uppercase\n word.gsub(/\\/(.?)/) { \"::#{$1.upcase}\" }.gsub(/(?:^|_)(.)/) { $1.upcase }\n else\n word.to_s[0].chr.downcase + word.camelize[1..-1]\n end\n end",
"def do_magic(str)\n str.gsub!(/[^A-Z]/, '').to_s #delete small leters and uprinted sumbols\n str.downcase.to_s #make all leters small\nend",
"def shout(word)\n upper_case = word.upcase\nend",
"def upcase; end",
"def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true)\n if first_letter_in_uppercase\n lower_case_and_underscored_word.to_s.gsub(/\\/(.?)/) { \"::#{$1.upcase}\" }.gsub(/(?:^|_)(.)/) { $1.upcase }\n else\n lower_case_and_underscored_word[0..0].downcase + camelize(lower_case_and_underscored_word)[1..-1]\n end\n end",
"def capitalize!() end"
] | [
"0.8538748",
"0.8510148",
"0.8333288",
"0.8276699",
"0.82509327",
"0.8115528",
"0.8103241",
"0.805762",
"0.80227685",
"0.7968855",
"0.79246783",
"0.78807634",
"0.7871423",
"0.786908",
"0.7819258",
"0.780358",
"0.7781939",
"0.775939",
"0.7758842",
"0.775335",
"0.77234906",
"0.7702757",
"0.7669016",
"0.7629023",
"0.7628011",
"0.7562578",
"0.75301516",
"0.75301516",
"0.75301516",
"0.74929166",
"0.7439007",
"0.73695004",
"0.73577255",
"0.7314828",
"0.730251",
"0.7251616",
"0.72154665",
"0.71926206",
"0.7169178",
"0.7158834",
"0.71184343",
"0.7109892",
"0.70869195",
"0.70869195",
"0.70667344",
"0.70575845",
"0.705507",
"0.70311356",
"0.69961226",
"0.699333",
"0.6992574",
"0.6971934",
"0.6957871",
"0.69399434",
"0.69236636",
"0.6921057",
"0.6916275",
"0.6903835",
"0.6882458",
"0.68776494",
"0.6873942",
"0.68733585",
"0.6867259",
"0.68657064",
"0.68657064",
"0.686541",
"0.685771",
"0.6838544",
"0.6836214",
"0.681794",
"0.68148553",
"0.68019086",
"0.6796081",
"0.679308",
"0.6790697",
"0.67588365",
"0.6742591",
"0.67396456",
"0.67101824",
"0.6705574",
"0.6702092",
"0.6697682",
"0.66764843",
"0.6676068",
"0.66750145",
"0.66679215",
"0.66612476",
"0.665399",
"0.66514105",
"0.6648907",
"0.6639591",
"0.66345125",
"0.6631894",
"0.66244596",
"0.6619868",
"0.6619032",
"0.6617246",
"0.6615378",
"0.6610025",
"0.6601826",
"0.6598282"
] | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def task_params
params.require(:task).permit(:desc, :time, :user_id, :category_id)
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 |
Initializa End Adding tenant Method | def add_tenant tenant
# Tenant Validation
if tenant.credit_rating == "Bad"
p "WARNING: Tenant #{tenant.name} has a BAD credit rating"
elsif @apt_tenants.size > @apt_bed
p "WARNING: Apartment is full"
else
@apt_tenants << tenant
p "Tenant: #{tenant.name} is added to #{@apt_number}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_tenant\n Apartment::Tenant.create(account.tenant) do\n initialize_account_data\n account.switch do\n create_defaults\n fillin_translations\n add_initial_users\n schedule_recurring_jobs\n true\n end\n end\n end",
"def create_tenant!\n Apartment::Tenant.create(tenant_name) unless tenant_name.blank?\n end",
"def create_tenant\n Apartment::Tenant.create(account.tenant) do\n initialize_account_data\n Hyrax::Workflow::WorkflowImporter.load_workflows\n end\n end",
"def create_tenant\n Apartment::Tenant.create(params[:id])\n Apartment::Tenant.switch!(params[:id])\n\n\n redirect_to entreprise_path(enterprise_id: params[:entreprise])\n flash[:alert] = \"Tenant...#{Apartment::Tenant.current}\"\n end",
"def initiate_tenant( tenant )\n __milia_change_tenant!( tenant.id )\n end",
"def initialize_tenant_id\n if new_record?\n if has_attribute?(:tenant_id) && self.tenant_id.nil?\n self.tenant_id = current_tenant_id\n end\n end\n end",
"def set_tenant\n\t @tenant = Tenant.find(params[:id])\n\t end",
"def create\n @tenant = Tenant.new(tenant_params)\n \n p_id = Property.searchSecond(@tenant.tenantbuildinginfo)\n Property.find_by(id: p_id).tenants << @tenant\n respond_to do |format|\n if @tenant.save\n # if (@tenant.renewal == true)\n # UserMailer.delay(run_at: @tenant.leaseend - 3.months).reminder_email(@tenant)\n # end\n format.html { redirect_to @tenant, notice: 'Tenant was successfully created.' }\n format.json { render :show, status: :created, location: @tenant }\n else\n format.html { render :new }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_tenant\n @tenant = Tenant.find(params[:id])\n end",
"def set_tenant\n @tenant = Tenant.find(params[:id])\n end",
"def set_tenant\n @tenant = Tenant.find(params[:id])\n end",
"def set_tenant\n @tenant = Tenant.find(params[:id])\n end",
"def set_tenant\n @tenant = Tenant.find(params[:id])\n end",
"def set_tenant\n @tenant = Tenant.find(params[:id])\n end",
"def new_tenant()\n Thread.current[:tenant_id] = Factory(:tenant).id\n end",
"def set_tenant\n unless params[:id] == \"undefined\"\n @tenant = Tenant.find(params[:id])\n else\n redirect_to tenants_url\n end\n end",
"def create\n @tenant = Tenant.new(tenant_params)\n authorize @tenant\n # @tenant.apartment_id = params[:apartment_id]\n # @tenant.apartment_id = @apartment.id\n @tenant.apartment = @apartment\n @tenant.save\n redirect_to apartment_path(@apartment)\n\n\n # respond_to do |format|\n # if @tenant.save\n # format.html { redirect_to @tenant, notice: 'tenant was successfully created.' }\n # format.json { render :show, status: :created, location: @tenant }\n # else\n # format.html { render :new }\n # format.json { render json: @tenant.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def initialize_tenant!\n @database_schema_file = Rails.root.join('db', 'schema.rb')\n @database_seeds_file = Rails.root.join('db', 'seeds.rb')\n \n Customer.transaction do\n Apartment::Tenant.process(tenant_name) do\n load(@database_schema_file)\n load(@database_seeds_file) if Apartment.seed_after_create\n end\n end\n \n return true\n end",
"def add_tenant(new_tenant)\n if @bedrooms < @tenants.count\n @tenants.push(new_tenant)\n\n elsif @bedrooms >= @tenants.count\n \"No more tenants can be added\"\n end\n end",
"def set_tenant\n if current_user\n current_account = Account.where(id: current_user.current_tenant_id).first\n set_current_tenant(current_account)\n end\n end",
"def set_tenant\n @tenant = Tenant.find_by(id: params[:id])\n redirect_to tenants_path, :flash => { :notice => \"#{APP_MSG['authorization']['failure']}\" } if @tenant.blank?\n end",
"def set_tenant_and_account\n @account = current_user.account\n set_current_tenant @account\n end",
"def create\n assign_if_empty\n @tenant = Tenant.new(tenant_params)\n respond_to do |format|\n if @tenant.save\n format.html { redirect_to tenants_url, notice: 'Tenant was successfully created.' }\n format.json { render :show, status: :created, location: @tenant }\n else\n format.html { render :new }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_user_for_tenant(args = {}) \n post(\"/tenants.json/#{args[:tenantId]}/users\", args)\nend",
"def create_tenant(tenant, hostname, port=DEFAULT_SERVER_HTTPPORT)\n url=\"http://#{hostname}:#{port}/application/v2/tenant/#{tenant}\"\n http_request_put(URI(url), {})\n end",
"def create\n @tenant = keystone.create_tenant({:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n \n format.html { redirect_to @tenant, :notice => 'Tenant was successfully created.' }\n format.json { render :json => @tenant, :status => :created, :location => @tenant }\n \n end\n end",
"def createTenant\n if params[:op] == 'local'\n params_map = ActiveSupport::HashWithIndifferentAccess.new(params[:tenant])\n user = Tenant.new(params_map)\n if !user.save\n render 'create'\n return\n end\n session[:user_id] = user.id\n render 'search'\n else\n auth = session[:auth]\n if Tenant.find_by(:email => auth[\"info\"][\"email\"])\n flash[:notice] = 'Email already used.'\n redirect_to '/create'\n else \n user=Tenant.create_with_omniauth(session[:auth])\n session[:user_id] = user.id\n render 'search'\n end\n end\n end",
"def set_tenant_of\n @tenant_of = TenantOf.find_by(id: params[:id])\n @tenant = @tenant_of.user\n end",
"def set_tenant\n @tenant = Tenant.find(params[:id])\n rescue ActiveRecord::RecordNotFound \n redirect_to root_url\n return\n end",
"def create_tenant\n \t#password = Base64.encode64(Digest::SHA1.digest(\"#{rand(1<<64)}/#{Time.now.to_f}/#{Process.pid}/#{userid}\"))[0..7]\n \tPgTools.create_tenant(userid, db_password)\n end",
"def set_tenant_and_account\n @account = Account.find_by(subdomain: request.subdomain)\n if @account.nil?\n redirect_to signup_account_not_found_url(subdomain: EXTERNAL_SUBDOMAIN)\n else\n set_current_tenant @account\n end\n end",
"def tenant_id=(value)\n @tenant_id = value\n end",
"def tenant_id=(value)\n @tenant_id = value\n end",
"def tenant_id=(value)\n @tenant_id = value\n end",
"def tenant_id=(value)\n @tenant_id = value\n end",
"def create\n @tenant = Tenant.new(tenant_params)\n\n respond_to do |format|\n if @tenant.save\n redirect_to tenants_dashboard_path\n else\n format.html { render :new }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tenant = Tenant.new(params[:tenant])\n\n respond_to do |format|\n if @tenant.save\n format.html { redirect_to @tenant, notice: 'Tenant was successfully created.' }\n format.json { render json: @tenant, status: :created, location: @tenant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tenant = current_account.tenants.build(tenant_params)\n respond_to do |format|\n if @tenant.save\n TenantMailer.new_tenant_notification(@tenant, current_user).deliver_now\n format.html { redirect_to @tenant, notice: @tenant.name + ' was successfully created.' }\n format.json { render :show, status: :created, location: @tenant }\n else\n format.js { render :new, notice: @tenant.errors }\n format.html { render :new }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Build a new Tenant object and set the values based on user input\n tenant = Tenant.new do |t|\n p = params[:tenant]\n t.name = p[:name]\n t.payment_handle = p[:payment_handle]\n t.phone_num = p[:phone_num]\n t.email = p[:email]\n end\n\n # Attempt to save the tenant\n if tenant.save # success\n redirect_to back_address(\"\"), notice: return_message(record: tenant, action: \"create\")\n\n else # fail\n # Create 'failed_edits' hash which stores all the values from the records that failed to get saved\n failed_edits = Hash.new\n failed_edits['new'] = params[:tenant]\n failed_edits['new']['errors'] = tenant.errors.keys.map(&:to_s)\n\n redirect_to back_address(failed_edits.to_param), notice: return_message(record: tenant, action: \"create\")\n end\n end",
"def tenant\n TenantView.new(space.tenant)\n end",
"def create\n @tenant = Tenant.new(params[:tenant])\n\n respond_to do |format|\n if @tenant.save\n format.html { redirect_to(@tenant, :notice => 'tenant was successfully created.') }\n format.xml { render :xml => @tenant, :status => :created, :location => @tenant }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tenant.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def lease!\n Apartment::Tenant.create(leaser_name)\n end",
"def tenant_params\n params.require(:tenant).permit(:tenant_name, :address_line1, :address_line2, :city, :state, :country, :pincode, :parent_tenant_id, :companytype_id,:isactive)\n end",
"def create_external_resources\n create_account_inline && account.save && create_tenant\n end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def index\n @tenants = Tenant.all\n @tenants = policy_scope(Tenant).order(created_at: :desc)\n #@tenant = Tenant.find(params[:id])\n #@tenant = Tenant.find(params[:id])\n #tr4 = Apartment.find(6).tenants.first.first_name\n # => apartment(:id).tenants(@tenant)\n #@tenant = Apartment.find(params[:id]).tenants(tenant_params)\n\n end",
"def register_with_et\r\n App.et[\"accounts\"].each_pair do |account_name, account_config|\r\n next unless account_config[:rsvp_guest_list]\r\n ETSubscriberAdd.create!(\r\n :account => account_name,\r\n :target => self,\r\n :properties => {\r\n :list_id => account_config[:rsvp_guest_list],\r\n :values => {\r\n :email_address => self.email,\r\n :cobrand => cobrand.short_name\r\n }\r\n }\r\n )\r\n end\r\n end",
"def set_admin_role_to_tenant\n role = Spree::Role.create!(name: 'admin')\n end",
"def create_on_backend\n lab = Lab.find(self.lab_id)\n Rails.logger.info \"Creating tenant #{self.name} on openstack backend #{lab.name}.\"\n\n # First, run through some checks to ensure we can create the whole tenant properly\n # Check if an external network exists\n admin_network_c = lab.get_neutron(lab.auth_tenant) \n ext_network = admin_network_c.list_networks.select {|n| n.external == true}\n if ext_network.empty?\n Rails.logger.error \"There are no external networks on the OpenStack host\"\n return false\n end\n\n # Check if there are enough available floating ips\n # There does not appear to be an api endpoint to check ips available for an instance to check out\n # TODO - Take another look at this.\n\n # Create the tenant\n identity_c = get_connection(\"identity\")\n identity_c.create_tenant({:name => self.name, :description => \"Created by OpenShift Labs app\", :enabled => true})\n tenant = identity_c.tenants.select {|t| t.name == self.name}.first\n if tenant.nil?\n Rails.logger.error \"Attempted to create tenant with name #{self.name}, but tenant does not exist after creation.\"\n return false\n else\n Rails.logger.info \"Created tenant #{self.name} with tenant id #{tenant.id}.\"\n self.uuid = tenant.id\n end\n\n # If any of the following fails, we need to be sure we delete the OpenStack backend tenant\n begin\n\n # Add the lab's user to the tenant\n # TODO the below assumes an admin role exists. Need to verify that this is always the case.\n role = identity_c.list_roles.select {|r| r[:name] == \"admin\"}.first\n admin_user = identity_c.list_users.select {|u| u.name == lab.username }.first\n Rails.logger.info \"Adding user #{admin_user.name} to the #{self.name} tenant.\"\n identity_c.add_user_to_tenant({:tenant_id => tenant.id, :role_id => role[:id], :user_id => admin_user.id})\n\n # Get the compute and neutron connections\n compute_c = get_connection(\"compute\")\n network_c = get_connection(\"network\")\n\n # Set the quotas appropriately\n # Works needs to be done in the ruby-openstack gem to support this.\n Rails.logger.info \"Setting #{self.name} tenant quotas.\"\n compute_c.set_limits(tenant.id, {:cores => lab.default_quota_cores,\n :floating_ips => lab.default_quota_instances,\n :instances => lab.default_quota_instances,\n :ram => lab.default_quota_ram\n })\n\n # Create a network\n network_name = self.name + \"-network\"\n Rails.logger.info \"Creating network with name #{network_name} for tenant #{self.name}.\"\n network = network_c.create_network(network_name, {:admin_state_up => true})\n self.network = network_name\n\n # Create a subnet\n subnet_name = self.name + \"-subnet\"\n # TODO nameservers are hard-coded, but could change. Need to have them entered somewhere.\n Rails.logger.info \"Creating subnet with name #{subnet_name} for tenant #{self.name}.\"\n subnet = network_c.create_subnet(network.id, \"192.168.1.0/24\", \"4\", {:name => subnet_name, :gateway_ip => \"192.168.1.1\", :enable_dhcp => true, :dns_nameservers => ['10.11.5.3', '10.11.5.4']})\n\n # Create a router and add interface to subnet\n router_name = self.name + \"-router\"\n # TODO we grab the first external network, we should have a user specify which one to use somewhere, in case there are multiple\n external_network = network_c.list_networks.select {|n| n.external == true }.first\n Rails.logger.info \"Creating router with name #{router_name} for tenant #{self.name}.\"\n router = network_c.create_router(router_name, true, {:external_gateway_info => {:network_id => external_network.id}})\n Rails.logger.info \"Adding router interface for subnet #{subnet_name} on router #{router_name}.\"\n network_c.add_router_interface(router.id, subnet.id)\n\n # Get the default security group\n # TODO we assume there is a default security group, probably not the best way to go about this.\n security_group = compute_c.security_groups.select {|k,v| v[:name] == \"default\"}\n self.security_group = \"default\"\n security_group_id = security_group.keys.first\n\n # Delete default security group rules\n Rails.logger.info \"Removing default Ingress security group rules for tenant #{self.name}.\"\n security_group[security_group_id][:rules].each do |rule|\n compute_c.delete_security_group_rule(rule[:id])\n end\n\n # Create necessary security group rules\n Rails.logger.info \"Creating all-open security groups rules for tcp, udp, and icmp on tenant #{self.name}\"\n compute_c.create_security_group_rule(security_group_id, \n {:ip_protocol => \"tcp\", :from_port => 1, :to_port => 65535, :cidr => \"0.0.0.0/0\"})\n compute_c.create_security_group_rule(security_group_id, \n {:ip_protocol => \"udp\", :from_port => 1, :to_port => 65535, :cidr => \"0.0.0.0/0\"})\n compute_c.create_security_group_rule(security_group_id, \n {:ip_protocol => \"icmp\", :from_port => -1, :to_port => -1, :cidr => \"0.0.0.0/0\"})\n\n # Allocate all necessary floating ips\n # TODO shouldn't just get the first pool, should have a dropdown and database entry in project\n Rails.logger.info \"Allocating #{lab.default_quota_instances} floating ips to tenant #{self.name}\"\n floating_ip_pool = compute_c.get_floating_ip_pools.first[\"name\"]\n lab.default_quota_instances.times do\n compute_c.create_floating_ip(:pool => floating_ip_pool)\n end\n \n Rails.logger.info \"Tenant #{self.name} creation completed.\"\n rescue => e\n Rails.logger.error \"Could not create OpenStack backend tenant due to:\"\n Rails.logger.error e.message\n Rails.logger.error e.backtrace\n destroy_backend\n end\n\n end",
"def tenant_params\n params.require(:tenant).permit(:tenantbuildinginfo, :propertynumber, :tenantname, :ltype, :postgiven, :posttogive, :renewal, :t_address, :t_phone, :t_email, :monthrent, :businesstype, :addterms, :renewterms, :gst, :qst, :monthrentwithtax, :yearrentwithtax, :leasestart, :leaseend, :pshare, :expenseyear, :expenseforyear, :yearlyincrease, :additionalrent, :monthlyrent)\n end",
"def tenant_params\n params.require(:tenant).permit(:landlord_id, :property_id, :unit_id, :first_name, :last_name, :birthdate, :phone, :email, :bio, :income, :smoker)\n end",
"def tenant_params\n\t params.require(:tenant).permit(:name, :domain, :user)\n\t end",
"def set_tenant_detail\n @tenant_detail = TenantDetail.find(params[:id])\n end",
"def create(tenant_body, options = {})\n path = base_uri\n request(path, options.merge(method: :post), tenant_body).if_400_raise(Neutrino::Gateway::Exceptions::TenantInvalidError)\n .to_hash\n end",
"def tenant_params\n params.fetch(:tenant, {})\n params.require(:tenant).permit(:first_name, :last_name, :phone, :email)\n end",
"def add_tenant_to_specified_shard(args = {}) \n post(\"/tenants.json/shard/#{args[:shardId]}\", args)\nend",
"def set_current_tenant_if_necessary\n if !self.user.current_tenant\n self.user.current_tenant = self.tenant\n self.user.save\n end\n end",
"def create_accounts\n end",
"def tenant_params\n params.require(:tenant).permit(:name, :address, :client_id, :redirect_url,:from_number)\n end",
"def after_create\n super\n create_account\n end",
"def tenant_id\n return @tenant_id\n end",
"def tenant_id\n return @tenant_id\n end",
"def tenant_id\n return @tenant_id\n end",
"def tenant_id\n return @tenant_id\n end",
"def set_tenant_profile\n @tenant_profile = TenantProfile.find(params[:id])\n end",
"def tenant_params\n params.require(:tenant).permit(:name, :email, :phone, :logo)\n end",
"def tenant_create(name, description)\n\t\n\t\ttenant = {\"tenant\" => {\"name\" => name, \"description\" => description, \"enabled\" => true}}\n\t\n\t\tjson_string = JSON.generate(tenant)\n\t\n\t\tpost_call = Curl::Easy.http_post(\"#{@ip_address}:#{@port_2}/v2.0/tenants\", json_string\n\t\t) do |curl|\n\t\t\tcurl.headers['x-auth-token'] = @token\n\t\t\tcurl.headers['Content-Type'] = 'application/json'\n\t\tend\n\t\t\n\t\tparsed_json = JSON.parse(post_call.body_str)\n\t\t\n\t\tputs parsed_json\n\t\treturn parsed_json\n\tend",
"def set_tenant_scope(args = {}) \n put(\"/tenants.json/scope/#{args[:tenantId]}\", args)\nend",
"def with_tenant(tenant, options = {}, &block)\n previous_tenant = Multitenant.current_tenant\n Multitenant.current_tenant = tenant\n previous_extra_tenant_ids = Multitenant.extra_tenant_ids\n Multitenant.extra_tenant_ids = options[:extra_tenant_ids] if options[:extra_tenant_ids]\n yield\n ensure\n Multitenant.current_tenant = previous_tenant\n Multitenant.extra_tenant_ids = previous_extra_tenant_ids\n end",
"def set_current_tenant\n company = Company.where(subdomain: request.subdomains.last).first\n if subdomain_present? && !company.nil?\n ActsAsTenant.current_tenant = company\n logger.debug \"subdomain_present? && company exists\"\n elsif current_user_present?\n ActsAsTenant.current_tenant = current_user.company\n logger.warn \"current_user_present? : #{current_user.name}\"\n redirect_to root_url(subdomain: ActsAsTenant.current_tenant.subdomain)\n elsif !subdomain_present? || request.subdomains.last == 'www'\n #logger.warn \"user wanna sign up\"\n else\n #ActsAsTenant.current_tenant = nil\n logger.warn \"ActsAsTenant.current_tenant is nil #{ActsAsTenant.current_tenant}\"\n render :file => 'public/404.html', :status => :not_found, :layout => false\n end\n end",
"def tenant_path\n @tenant_path ||= '/api/v2/tenants/settings'\n end",
"def ensure_tenant\n return unless current_user && current_user.tenant_id.blank?\n\n redirect_to choose_sso_path, alert: 'You must choose if you are associated with an institution before continuing'\n end",
"def allowed_to_create_tenants=(value)\n @allowed_to_create_tenants = value\n end",
"def mapping_tenant\n @tenants = Tenant.where(:client_id => current_user.id, :is_active => true)\n @users = current_user.corporate_user\n end",
"def set_tenancy\n @tenancy = Tenancy.find(params[:id])\n end",
"def tenant_landlord property, tenant\n validate! property, tenant\n self.create tenant: tenant, landlord: property.landlord\n end",
"def add_arrays_to_tenant(args = {}) \n post(\"/tenants.json/#{args[:tenantId]}/arrays\", args)\nend",
"def set_current_tenant_id\n Tenant.current_id = self.id\n end",
"def tenant_params\n params.require(:tenant).permit(:tenant_name, :address_line1, :address_line2, :city, :state, :country, :pincode, :active_by, :isactive, :deleted_at, users_attributes:[:id, :first_name, :last_name, :email, :password, :phone_number, :player_id, :remarks, :isactive, :deleted_at, :role_id, :user_type_id])\n end",
"def init\n redirect_to Maestrano::Saml::Request[params[:tenant]].new(params, session).redirect_url\n end",
"def tenant_params\n params.require(:tenant).permit(:name, :subfolder)\n end",
"def set_tenant_fee\n @tenant_fee = TenantFee.find(params[:id])\n end",
"def set_tenant_location\n @tenant_location = TenantLocation.find(params[:id])\n end",
"def update\n\n respond_to do |format|\n if @tenant.update(tenant_params)\n p_id = Property.searchSecond(@tenant.tenantbuildinginfo)\n Property.find_by(id: p_id).tenants << @tenant\n format.html { redirect_to @tenant, notice: 'Tenant was successfully updated.' }\n format.json { render :show, status: :ok, location: @tenant }\n else\n format.html { render :edit }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n\n if params[:generate_lease]\n generate_lease(@tenant)\n elsif params[:expense_add]\n expense_addendum(@tenant)\n else\n #do nothing\n end\n\n end",
"def tenant_params\n params.permit(:name, :phone, :username, :password, :password_confirmation, :property_id, :active)\n end",
"def set_widget_and_tenant\n @widget = Widget.find_by_token(params[:widget_token])\n set_current_tenant @widget.account\n end",
"def add_customer_account\n self.create_account! unless self.account\n end",
"def initialize()\n @tenantId = MyAzure.get_tenant_id\n @clientId = MyAzure.get_client_id\n @clientSecret = MyAzure.get_client_secret\n \n # Generate bearer token.\n @bearerToken = auth_bearer_aad\n \n end",
"def create \n \n @tenant =Tenant.new(tenant_params)\n meal_spread_data = tenant_params[\"tenant_details_attributes\"].map{|i| [i[1][\"meal_time\"], i[1][\"stud_type\"], i[1][\"spread_type\"]] if i[1] != nil }\n duplication_values = meal_spread_data.group_by{ |e| e }.select { |k, v| v.size > 1 }.map(&:first)\n \n if duplication_values.uniq == []\n respond_to do |format|\n data = tenant_params\n\n tookan = {\"api_key\": \"50646180f541481e4c422b614c5825431be3c2f82fd57936541c03\",\"user_type\": 0,\"name\": data[:name],\"phone\": data[:phone1],\"email\": data[:email],\"address\": data[:address],\"latitude\": data[:latitude],\"longitude\": data[:longitude]}\n response = RestClient.post \"https://api.tookanapp.com/v2/customer/add\", tookan.to_json, :content_type => \"application/json\"\n response = JSON.parse(response)\n \n if response[\"status\"] == 200\n if @tenant.save \n @tenant.update(customer_id: response[\"data\"][\"customer_id\"])\n food_category = FoodCategory.find_or_create_by(name: \"Veg\")\n @tenant.tenant_details.update(food_category_id: food_category.id)\n @tenant.update(:created_by=>session[:kitchen_user_id],feedback_code: \"HU00\"+''[email protected]_s) \n TenantNotifierMailer.send_cnfrmtn_email(@tenant).deliver \n format.html { redirect_to tenants_url, notice: 'Tenant was successfully created.' } \n format.json { render :show, status: :created, location: @tenant }\n end \n else \n format.html { redirect_to tenants_url } \n format.json { render json: @tenant.errors, status: :unprocessable_entity } \n end \n end \n else\n @spread = JSON.parse RestClient.get(\"#{$pim_core_service}/pimcore/api/FoodRecepie/SpreadName\")\n @duplication_status = true\n render :new\n end\n end",
"def create_organization_and_subscription_plan\n organization = Organization.create(\n name: \"My Organization\",\n subscription_plan_id: self.subscription_plan_id,\n time_zone: self.time_zone\n )\n\n organization_membership = organization.add_user(self)\n organization_membership.role = :owner\n organization_membership.save\n end",
"def current_tenant\n\t\t@current_tenant ||= Tenant.find_by(id: session[:tenant_id])\n \tend",
"def create_sub_account(business)\n raise \"Business must not be nil\" if business.nil?\n client.accounts.create(:friendly_name => \"#{business.slug}-#{business.id}\", status: 'active')\n end",
"def show\n\n @tenant = Tenant.find(params[:id])\n # @tenant.apartment works!\n authorize @tenant\n end",
"def create\n @tenant_detail = TenantDetail.new(tenant_detail_params)\n\n respond_to do |format|\n if @tenant_detail.save\n format.html { redirect_to @tenant_detail, notice: \"Tenant detail was successfully created.\" }\n format.json { render :show, status: :created, location: @tenant_detail }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @tenant_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n if @property.user.id != @user.id\n redirect_to properties_path, notice: \"Not Authorized\"\n end\n\n @tenant_of = TenantOf.new\n \n end",
"def create_question_bank(question_bank_name,tenant_id,user_id)\n question_bank = QuestionBank.find_by_name_and_tenant_id(question_bank_name,tenant_id)\n if question_bank.nil? or question_bank.blank?\n question_bank = QuestionBank.new\n question_bank.name = question_bank_name\n question_bank.type_of_question_bank = \"\"\n question_bank.tenant_id = tenant_id\n question_bank.user_id = user_id\n question_bank.save\n end\n return question_bank.id\n end",
"def create\n @tenant_user = TenantUser.new(params[:tenant_user])\n\n respond_to do |format|\n if @tenant_user.save\n format.html { redirect_to @tenant_user, notice: 'Tenant user was successfully created.' }\n format.json { render json: @tenant_user, status: :created, location: @tenant_user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tenant_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_account\n\n end",
"def show\n @tenant=Tenant.find(params[:tenant_id])\n end",
"def new\n # @tenant = Tenant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @tenant }\n end\n end"
] | [
"0.7362397",
"0.71767366",
"0.71449375",
"0.69816566",
"0.6948081",
"0.6908528",
"0.69024235",
"0.68754977",
"0.6847186",
"0.6847186",
"0.6847186",
"0.6847186",
"0.6847186",
"0.6847186",
"0.6787493",
"0.6751198",
"0.6698958",
"0.66185606",
"0.6581966",
"0.6577646",
"0.65605676",
"0.6520701",
"0.6520613",
"0.6473244",
"0.64588815",
"0.64233965",
"0.64128727",
"0.6402636",
"0.63916266",
"0.6297441",
"0.6244361",
"0.6215247",
"0.6215247",
"0.6215247",
"0.6215247",
"0.6197814",
"0.61495805",
"0.6135147",
"0.61274916",
"0.6122538",
"0.6059292",
"0.6056119",
"0.6034278",
"0.6028607",
"0.6014423",
"0.6006032",
"0.5969128",
"0.59545",
"0.5952418",
"0.5936711",
"0.59209293",
"0.58949375",
"0.5870767",
"0.5866803",
"0.58427423",
"0.5836413",
"0.5829627",
"0.58174574",
"0.5774413",
"0.5763659",
"0.57454854",
"0.57454854",
"0.57454854",
"0.57454854",
"0.5742599",
"0.5740126",
"0.5736954",
"0.57266617",
"0.5719653",
"0.57007533",
"0.5681583",
"0.56723946",
"0.56609046",
"0.5660064",
"0.5657301",
"0.5653677",
"0.5649444",
"0.5645248",
"0.561358",
"0.5592879",
"0.5554735",
"0.554648",
"0.54986155",
"0.5488966",
"0.547744",
"0.54716074",
"0.5457778",
"0.54529655",
"0.5429035",
"0.54192674",
"0.5416962",
"0.5411854",
"0.5409313",
"0.5409258",
"0.5404746",
"0.540321",
"0.54019195",
"0.5399629",
"0.53973824",
"0.5396194"
] | 0.72995454 | 1 |
Add Tenant End Removing a Tenant | def remove_tenant tenant
# Checking if Tenant exsists & Removing a Tenant
@apt_tenants.each do |i|
p "#{tenant.name} has been removed from apartment #{@apt_number}"
@apt_tenants.delete_if{|obj| obj.name == tenant.name}
if @apt_tenants.include? 'i' == false
p "No Such Tenant found"
else
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_tenant tenant\n if tenant.to_s == tenant #this is matching the tenant, you could also do tenant.class = \"String\"\n index = @tenants.index { |t| t.name == tenant}\n if index.nil?\n not_found = true\n else\n @tenants.delete_at_index\n end\n else\n deleted = @tenants.delete tenant\n not_found = deleted.nil?\n end\n\n raise NoSuchTenantError.new tenant if not_found\n end",
"def add_tenant tenant\n\n # Tenant Validation\n if tenant.credit_rating == \"Bad\"\n p \"WARNING: Tenant #{tenant.name} has a BAD credit rating\"\n elsif @apt_tenants.size > @apt_bed\n p \"WARNING: Apartment is full\"\n else\n @apt_tenants << tenant\n p \"Tenant: #{tenant.name} is added to #{@apt_number}\"\n end\n\n end",
"def add_tenant(new_tenant)\n if @bedrooms < @tenants.count\n @tenants.push(new_tenant)\n\n elsif @bedrooms >= @tenants.count\n \"No more tenants can be added\"\n end\n end",
"def removeTenant(tenantArr,id)\n tenantArr.each do |tenant|\n if tenant[:id] == id\n tenant[:apartment_id] = 0\n end\n end\n end",
"def destroy\n \n keystone.delete_tenant(keystone.get_tenant(params[:id])[:id])\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :ok }\n end\n end",
"def index\n @tenants = Tenant.all - [@tenant]\n end",
"def index\n @tenants = Tenant.all - [@tenant]\n end",
"def destroy\n name = @tenant.name\n @tenant.destroy\n respond_to do |format|\n format.html { redirect_to tenants_url, notice: name + ' was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def tenant_delete(tenant_id)\n\t\n\t\tdelete_call = Curl::Easy.http_delete(\"#{@ip_address}:#{@port_2}/v2.0/tenants/#{tenant_id}\"\n\t\t) do |curl|\n\t\t\tcurl.headers['x-auth-token'] = @token\n\t\t\tcurl.headers['userId'] = tenant_id\n\t\t end\n\t\t\n\t\tputs \"invoked tenant delete\"\n\tend",
"def destroy\n @tenant = Tenant.find(params[:id])\n @tenant.destroy\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n tookan = {\"api_key\": \"50646180f541481e4c422b614c5825431be3c2f82fd57936541c03\", \"customer_id\": @tenant.customer_id}\n response = RestClient.post \"https://api.tookanapp.com/v2/delete_customer\", tookan.to_json, :content_type => \"application/json\"\n response = JSON.parse(response)\n if response[\"status\"] == 200\n \n @tenant.destroy\n respond_to do |format|\n format.html { redirect_to tenants_url, notice: 'Tenant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n \n end",
"def remove!(tenant_id,entity_type_id,entity_id,tags)\n @instance.remove!(tenant_id,entity_type_id,entity_id,tags)\n end",
"def destroy\n @tenant = Tenant.find(params[:id])\n @tenant.destroy\n\n respond_to do |format|\n format.html { redirect_to(tenants_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tenant.destroy\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :no_content }\n end\n end",
"def set_tenant\n\t @tenant = Tenant.find(params[:id])\n\t end",
"def create_tenant\n Apartment::Tenant.create(params[:id])\n Apartment::Tenant.switch!(params[:id])\n\n\n redirect_to entreprise_path(enterprise_id: params[:entreprise])\n flash[:alert] = \"Tenant...#{Apartment::Tenant.current}\"\n end",
"def set_tenant\n @tenant = Tenant.find(params[:id])\n end",
"def set_tenant\n @tenant = Tenant.find(params[:id])\n end",
"def set_tenant\n @tenant = Tenant.find(params[:id])\n end",
"def set_tenant\n @tenant = Tenant.find(params[:id])\n end",
"def set_tenant\n @tenant = Tenant.find(params[:id])\n end",
"def set_tenant\n @tenant = Tenant.find(params[:id])\n end",
"def destroy\n @tenant.destroy\n respond_to do |format|\n format.html { redirect_to tenants_url, notice: 'Tenant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tenant.destroy\n respond_to do |format|\n format.html { redirect_to tenants_url, notice: 'Tenant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def set_tenant\n unless params[:id] == \"undefined\"\n @tenant = Tenant.find(params[:id])\n else\n redirect_to tenants_url\n end\n end",
"def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend",
"def destroy\n if @tenant_of.property.user.id != @user.id\n redirect_to properties_path, notice: \"Not Authorized\"\n else\n @tenant_of.destroy\n redirect_to :back, notice: 'Tenant was removed.' \n end \n end",
"def set_tenant\n @tenant = Tenant.find_by(id: params[:id])\n redirect_to tenants_path, :flash => { :notice => \"#{APP_MSG['authorization']['failure']}\" } if @tenant.blank?\n end",
"def add_user_for_tenant(args = {}) \n post(\"/tenants.json/#{args[:tenantId]}/users\", args)\nend",
"def set_tenant\n @tenant = Tenant.find(params[:id])\n rescue ActiveRecord::RecordNotFound \n redirect_to root_url\n return\n end",
"def create_tenant!\n Apartment::Tenant.create(tenant_name) unless tenant_name.blank?\n end",
"def evict_tenant\n\t\t#if @is_rental?\n\tend",
"def create_tenant(tenant, hostname, port=DEFAULT_SERVER_HTTPPORT)\n url=\"http://#{hostname}:#{port}/application/v2/tenant/#{tenant}\"\n http_request_put(URI(url), {})\n end",
"def create\n @tenant = Tenant.new(tenant_params)\n \n p_id = Property.searchSecond(@tenant.tenantbuildinginfo)\n Property.find_by(id: p_id).tenants << @tenant\n respond_to do |format|\n if @tenant.save\n # if (@tenant.renewal == true)\n # UserMailer.delay(run_at: @tenant.leaseend - 3.months).reminder_email(@tenant)\n # end\n format.html { redirect_to @tenant, notice: 'Tenant was successfully created.' }\n format.json { render :show, status: :created, location: @tenant }\n else\n format.html { render :new }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy_schema\n Apartment::Tenant.drop tenant\n end",
"def destroy_schema\n Apartment::Tenant.drop tenant\n end",
"def set_tenant_scope(args = {}) \n put(\"/tenants.json/scope/#{args[:tenantId]}\", args)\nend",
"def create_on_backend\n lab = Lab.find(self.lab_id)\n Rails.logger.info \"Creating tenant #{self.name} on openstack backend #{lab.name}.\"\n\n # First, run through some checks to ensure we can create the whole tenant properly\n # Check if an external network exists\n admin_network_c = lab.get_neutron(lab.auth_tenant) \n ext_network = admin_network_c.list_networks.select {|n| n.external == true}\n if ext_network.empty?\n Rails.logger.error \"There are no external networks on the OpenStack host\"\n return false\n end\n\n # Check if there are enough available floating ips\n # There does not appear to be an api endpoint to check ips available for an instance to check out\n # TODO - Take another look at this.\n\n # Create the tenant\n identity_c = get_connection(\"identity\")\n identity_c.create_tenant({:name => self.name, :description => \"Created by OpenShift Labs app\", :enabled => true})\n tenant = identity_c.tenants.select {|t| t.name == self.name}.first\n if tenant.nil?\n Rails.logger.error \"Attempted to create tenant with name #{self.name}, but tenant does not exist after creation.\"\n return false\n else\n Rails.logger.info \"Created tenant #{self.name} with tenant id #{tenant.id}.\"\n self.uuid = tenant.id\n end\n\n # If any of the following fails, we need to be sure we delete the OpenStack backend tenant\n begin\n\n # Add the lab's user to the tenant\n # TODO the below assumes an admin role exists. Need to verify that this is always the case.\n role = identity_c.list_roles.select {|r| r[:name] == \"admin\"}.first\n admin_user = identity_c.list_users.select {|u| u.name == lab.username }.first\n Rails.logger.info \"Adding user #{admin_user.name} to the #{self.name} tenant.\"\n identity_c.add_user_to_tenant({:tenant_id => tenant.id, :role_id => role[:id], :user_id => admin_user.id})\n\n # Get the compute and neutron connections\n compute_c = get_connection(\"compute\")\n network_c = get_connection(\"network\")\n\n # Set the quotas appropriately\n # Works needs to be done in the ruby-openstack gem to support this.\n Rails.logger.info \"Setting #{self.name} tenant quotas.\"\n compute_c.set_limits(tenant.id, {:cores => lab.default_quota_cores,\n :floating_ips => lab.default_quota_instances,\n :instances => lab.default_quota_instances,\n :ram => lab.default_quota_ram\n })\n\n # Create a network\n network_name = self.name + \"-network\"\n Rails.logger.info \"Creating network with name #{network_name} for tenant #{self.name}.\"\n network = network_c.create_network(network_name, {:admin_state_up => true})\n self.network = network_name\n\n # Create a subnet\n subnet_name = self.name + \"-subnet\"\n # TODO nameservers are hard-coded, but could change. Need to have them entered somewhere.\n Rails.logger.info \"Creating subnet with name #{subnet_name} for tenant #{self.name}.\"\n subnet = network_c.create_subnet(network.id, \"192.168.1.0/24\", \"4\", {:name => subnet_name, :gateway_ip => \"192.168.1.1\", :enable_dhcp => true, :dns_nameservers => ['10.11.5.3', '10.11.5.4']})\n\n # Create a router and add interface to subnet\n router_name = self.name + \"-router\"\n # TODO we grab the first external network, we should have a user specify which one to use somewhere, in case there are multiple\n external_network = network_c.list_networks.select {|n| n.external == true }.first\n Rails.logger.info \"Creating router with name #{router_name} for tenant #{self.name}.\"\n router = network_c.create_router(router_name, true, {:external_gateway_info => {:network_id => external_network.id}})\n Rails.logger.info \"Adding router interface for subnet #{subnet_name} on router #{router_name}.\"\n network_c.add_router_interface(router.id, subnet.id)\n\n # Get the default security group\n # TODO we assume there is a default security group, probably not the best way to go about this.\n security_group = compute_c.security_groups.select {|k,v| v[:name] == \"default\"}\n self.security_group = \"default\"\n security_group_id = security_group.keys.first\n\n # Delete default security group rules\n Rails.logger.info \"Removing default Ingress security group rules for tenant #{self.name}.\"\n security_group[security_group_id][:rules].each do |rule|\n compute_c.delete_security_group_rule(rule[:id])\n end\n\n # Create necessary security group rules\n Rails.logger.info \"Creating all-open security groups rules for tcp, udp, and icmp on tenant #{self.name}\"\n compute_c.create_security_group_rule(security_group_id, \n {:ip_protocol => \"tcp\", :from_port => 1, :to_port => 65535, :cidr => \"0.0.0.0/0\"})\n compute_c.create_security_group_rule(security_group_id, \n {:ip_protocol => \"udp\", :from_port => 1, :to_port => 65535, :cidr => \"0.0.0.0/0\"})\n compute_c.create_security_group_rule(security_group_id, \n {:ip_protocol => \"icmp\", :from_port => -1, :to_port => -1, :cidr => \"0.0.0.0/0\"})\n\n # Allocate all necessary floating ips\n # TODO shouldn't just get the first pool, should have a dropdown and database entry in project\n Rails.logger.info \"Allocating #{lab.default_quota_instances} floating ips to tenant #{self.name}\"\n floating_ip_pool = compute_c.get_floating_ip_pools.first[\"name\"]\n lab.default_quota_instances.times do\n compute_c.create_floating_ip(:pool => floating_ip_pool)\n end\n \n Rails.logger.info \"Tenant #{self.name} creation completed.\"\n rescue => e\n Rails.logger.error \"Could not create OpenStack backend tenant due to:\"\n Rails.logger.error e.message\n Rails.logger.error e.backtrace\n destroy_backend\n end\n\n end",
"def reset_tenant_scope_to_default \n put(\"/tenants.json/scope/clear\")\nend",
"def destroy\n @tenant_detail.destroy\n respond_to do |format|\n format.html { redirect_to tenant_details_url, notice: \"Tenant detail was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def update\n\n respond_to do |format|\n if @tenant.update(tenant_params)\n p_id = Property.searchSecond(@tenant.tenantbuildinginfo)\n Property.find_by(id: p_id).tenants << @tenant\n format.html { redirect_to @tenant, notice: 'Tenant was successfully updated.' }\n format.json { render :show, status: :ok, location: @tenant }\n else\n format.html { render :edit }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n\n if params[:generate_lease]\n generate_lease(@tenant)\n elsif params[:expense_add]\n expense_addendum(@tenant)\n else\n #do nothing\n end\n\n end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def log_out_tenant\n \t\tsession.delete(:tenant_id)\n \t\t@current_tenant = nil\n \tend",
"def add_tenant_to_specified_shard(args = {}) \n post(\"/tenants.json/shard/#{args[:shardId]}\", args)\nend",
"def set_tenant\n if current_user\n current_account = Account.where(id: current_user.current_tenant_id).first\n set_current_tenant(current_account)\n end\n end",
"def unauth\n #raise Apartment::TenantNotFound\n nil\n end",
"def destroy\n @tenant_user = TenantUser.find(params[:id])\n @tenant_user.destroy\n\n respond_to do |format|\n format.html { redirect_to tenant_users_url }\n format.json { head :no_content }\n end\n end",
"def set_tenant_of\n @tenant_of = TenantOf.find_by(id: params[:id])\n @tenant = @tenant_of.user\n end",
"def with_tenant(tenant, options = {}, &block)\n previous_tenant = Multitenant.current_tenant\n Multitenant.current_tenant = tenant\n previous_extra_tenant_ids = Multitenant.extra_tenant_ids\n Multitenant.extra_tenant_ids = options[:extra_tenant_ids] if options[:extra_tenant_ids]\n yield\n ensure\n Multitenant.current_tenant = previous_tenant\n Multitenant.extra_tenant_ids = previous_extra_tenant_ids\n end",
"def destroy\n audit(@tenure, current_user)\n @tenure.destroy\n \n\n head :no_content\n end",
"def tenant_id=(value)\n @tenant_id = value\n end",
"def tenant_id=(value)\n @tenant_id = value\n end",
"def tenant_id=(value)\n @tenant_id = value\n end",
"def tenant_id=(value)\n @tenant_id = value\n end",
"def create_tenant\n Apartment::Tenant.create(account.tenant) do\n initialize_account_data\n account.switch do\n create_defaults\n fillin_translations\n add_initial_users\n schedule_recurring_jobs\n true\n end\n end\n end",
"def assign_suspended_tenant_to_shard(args = {}) \n put(\"/shards.json/#{args[:shardId]}/tenant/#{args[:tenantId]}\", args)\nend",
"def set_current_tenant_if_necessary\n if !self.user.current_tenant\n self.user.current_tenant = self.tenant\n self.user.save\n end\n end",
"def remove_all_tenants\n @apt_tenants.clear\n end",
"def initiate_tenant( tenant )\n __milia_change_tenant!( tenant.id )\n end",
"def new_tenant()\n Thread.current[:tenant_id] = Factory(:tenant).id\n end",
"def set_admin_role_to_tenant\n role = Spree::Role.create!(name: 'admin')\n end",
"def remove_tenant(building)\n view_apartment_detail(building)\n puts \"Which tenant would you like to remove?\"\n tenant_to_remove = gets.chomp\n ##Step 1: Create an array with the hash of the exact apartment\n apartment_hash_to_modify = building.building_apartment_array.select {|hash| hash[:renter].include? tenant_to_remove}\n ##Step 2: Using the array from step 1:, determine the array index. \n index = building.building_apartment_array.index(apartment_hash_to_modify[0])\n ##Step 3: Remove the tenant\n building.building_apartment_array[index.to_i][:renter].delete(tenant_to_remove)\nend",
"def delete_accounts\n end",
"def destroy\n @tipo_fornecedor.destroy\n respond_to do |format|\n format.html { redirect_to tenant_tipo_fornecedors_path(tenant_id: @tenant.id), notice: 'Tipo fornecedor was successfully destroyed.' }\n end\n end",
"def tenant\n TenantView.new(space.tenant)\n end",
"def break!\n Apartment::Tenant.drop(leaser_name)\n end",
"def delete_array_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/arrays/#{args[:arrayId]}\", args)\nend",
"def create\n @tenant = Tenant.new(tenant_params)\n\n respond_to do |format|\n if @tenant.save\n redirect_to tenants_dashboard_path\n else\n format.html { render :new }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add!(tenant_id,entity_type_id,entity_id,tags)\n @instance.add!(tenant_id,entity_type_id,entity_id,tags)\n update_tag_count(tenant_id,tags)\n end",
"def set_current_tenant_id\n Tenant.current_id = self.id\n end",
"def create\n @tenant = Tenant.new(tenant_params)\n authorize @tenant\n # @tenant.apartment_id = params[:apartment_id]\n # @tenant.apartment_id = @apartment.id\n @tenant.apartment = @apartment\n @tenant.save\n redirect_to apartment_path(@apartment)\n\n\n # respond_to do |format|\n # if @tenant.save\n # format.html { redirect_to @tenant, notice: 'tenant was successfully created.' }\n # format.json { render :show, status: :created, location: @tenant }\n # else\n # format.html { render :new }\n # format.json { render json: @tenant.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def lease!\n Apartment::Tenant.create(leaser_name)\n end",
"def destroy_backend\n Rails.logger.info \"Removing tenant #{self.name} with tenant id #{self.uuid}.\"\n\n Rails.logger.info \"Undeploying all instances for tenant #{self.name}...\"\n # Delete all instances\n if self.instances.count > 0\n success = self.instances.each {|i| i.undeploy }\n if success\n Rails.logger.info \"Removed all instances for tenant #{self.name}.\"\n else\n Rails.logger.error \"Could not remove instance during project deletion:\"\n Rails.logger.error \"Instance: #{i.name} #{i.id} #{i.uuid}\"\n return false\n end\n end\n\n compute_c = get_connection(\"compute\")\n network_c = get_connection(\"network\")\n identity_c = get_connection(\"identity\")\n\n # Unallocate floating ips\n floating_ips = compute_c.get_floating_ips\n floating_ips.each do |ip|\n Rails.logger.info \"Deleting floating ip #{ip.ip} with id #{ip.id}\"\n compute_c.delete_floating_ip(ip.id)\n end\n\n routers = network_c.list_routers.select {|router| router.tenant_id == self.uuid}\n subnets = network_c.list_subnets.select {|subnet| subnet.tenant_id == self.uuid}\n networks = network_c.list_networks.select {|network| network.tenant_id == self.uuid}\n\n # Clear all router gateways\n routers.each do |router|\n Rails.logger.info \"Clearing router gateway for #{router.name} with id #{router.id}.\"\n # Remove gateway from the router\n network_c.update_router(router.id, {\"external_gateway_info\" => {}})\n end\n\n # loop through each network\n # For each router, remove any subnet interfaces\n networks.each do |network|\n subnets.select {|subnet| subnet.network_id == network.id}.each do |subnet|\n routers.each do |router|\n begin\n Rails.logger.info \"Attempting to remove router interface for subnet #{subnet.name} with id #{subnet.id} from router #{router.name} with id #{router.id}.\"\n network_c.remove_router_interface(router.id, subnet.id)\n Rails.logger.info \"Successfully removed router interface for subnet #{subnet.name}.\"\n rescue => e\n Rails.logger.error \"Tried to remove router interface for subnet #{subnet.name} with id #{subnet.id} from router #{router.name} with id #{router.id}.\"\n end\n end\n end\n end\n\n # Delete all subnets\n subnets.each do |subnet|\n Rails.logger.info \"Deleting subnet #{subnet.name} with id #{subnet.id}\"\n network_c.delete_subnet(subnet.id)\n end\n\n # Delete all routers\n routers.each do |router|\n Rails.logger.info \"Deleting router #{router.name} with id #{router.id}\"\n network_c.delete_router(router.id)\n end\n\n # Delete all networks\n networks.each do |network|\n Rails.logger.info \"Deleting network #{network.name} with id #{network.id}\"\n network_c.delete_network(network.id)\n end\n\n # Finally, delete the tenant\n Rails.logger.info \"Deleting tenant #{self.name} with id #{self.uuid}\"\n identity_c.delete_tenant(self.uuid)\n\n Rails.logger.info \"Removal of tenant #{self.name} on the OpenStack backend succeeded.\"\n end",
"def destroy\n @tenant_fee.destroy\n respond_to do |format|\n format.html { redirect_to tenant_fees_url, notice: 'Tenant fee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def createTenant\n if params[:op] == 'local'\n params_map = ActiveSupport::HashWithIndifferentAccess.new(params[:tenant])\n user = Tenant.new(params_map)\n if !user.save\n render 'create'\n return\n end\n session[:user_id] = user.id\n render 'search'\n else\n auth = session[:auth]\n if Tenant.find_by(:email => auth[\"info\"][\"email\"])\n flash[:notice] = 'Email already used.'\n redirect_to '/create'\n else \n user=Tenant.create_with_omniauth(session[:auth])\n session[:user_id] = user.id\n render 'search'\n end\n end\n end",
"def destroy\n @tipo_despesa.destroy\n respond_to do |format|\n format.html { redirect_to tenant_tipo_despesas_path(tenant_id: @tenant.id), notice: 'Tipo despesa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n assign_if_empty\n @tenant = Tenant.new(tenant_params)\n respond_to do |format|\n if @tenant.save\n format.html { redirect_to tenants_url, notice: 'Tenant was successfully created.' }\n format.json { render :show, status: :created, location: @tenant }\n else\n format.html { render :new }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_tenant_and_account\n @account = Account.find_by(subdomain: request.subdomain)\n if @account.nil?\n redirect_to signup_account_not_found_url(subdomain: EXTERNAL_SUBDOMAIN)\n else\n set_current_tenant @account\n end\n end",
"def set_tenant_and_account\n @account = current_user.account\n set_current_tenant @account\n end",
"def create_tenant\n Apartment::Tenant.create(account.tenant) do\n initialize_account_data\n Hyrax::Workflow::WorkflowImporter.load_workflows\n end\n end",
"def create\n @tenant = keystone.create_tenant({:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n \n format.html { redirect_to @tenant, :notice => 'Tenant was successfully created.' }\n format.json { render :json => @tenant, :status => :created, :location => @tenant }\n \n end\n end",
"def leave\n Leases.current = nil\n Apartment::Tenant.switch!\n end",
"def destroy\n @billable_meter.destroy\n if (@billable_meter.tenant)\n # format.html { redirect_to @billable_meter.tenant, notice: 'The meter was successfully removed.' }\n # format.json { head :no_content }\n redirect_back(fallback_location: root_path,notice: \"The meter was successfully removed.\")\n else\n flash[:notice] = 'The meter was successfully removed.'\n render :configure\n end\n end",
"def tenant_path\n @tenant_path ||= '/api/v2/tenants/settings'\n end",
"def destroy\n @engagement_attendee.destroy\n head :no_content\n end",
"def create\n @tenant = current_account.tenants.build(tenant_params)\n respond_to do |format|\n if @tenant.save\n TenantMailer.new_tenant_notification(@tenant, current_user).deliver_now\n format.html { redirect_to @tenant, notice: @tenant.name + ' was successfully created.' }\n format.json { render :show, status: :created, location: @tenant }\n else\n format.js { render :new, notice: @tenant.errors }\n format.html { render :new }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_tenant_detail\n @tenant_detail = TenantDetail.find(params[:id])\n end",
"def delete_server\n super\n end",
"def remove_tags!(tenant_id,tags)\n @instance.remove_tags!(tenant_id,tags)\n end",
"def create\n @tenant = Tenant.new(params[:tenant])\n\n respond_to do |format|\n if @tenant.save\n format.html { redirect_to @tenant, notice: 'Tenant was successfully created.' }\n format.json { render json: @tenant, status: :created, location: @tenant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tenant = Tenant.new(params[:tenant])\n\n respond_to do |format|\n if @tenant.save\n format.html { redirect_to(@tenant, :notice => 'tenant was successfully created.') }\n format.xml { render :xml => @tenant, :status => :created, :location => @tenant }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tenant.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n # Build a new Tenant object and set the values based on user input\n tenant = Tenant.new do |t|\n p = params[:tenant]\n t.name = p[:name]\n t.payment_handle = p[:payment_handle]\n t.phone_num = p[:phone_num]\n t.email = p[:email]\n end\n\n # Attempt to save the tenant\n if tenant.save # success\n redirect_to back_address(\"\"), notice: return_message(record: tenant, action: \"create\")\n\n else # fail\n # Create 'failed_edits' hash which stores all the values from the records that failed to get saved\n failed_edits = Hash.new\n failed_edits['new'] = params[:tenant]\n failed_edits['new']['errors'] = tenant.errors.keys.map(&:to_s)\n\n redirect_to back_address(failed_edits.to_param), notice: return_message(record: tenant, action: \"create\")\n end\n end",
"def delete_subscription(entity)\r\n subscriptions.delete(entity)\r\n end",
"def remove\n if @series.remove(Apartment::Tenant.current)\n flash[:notice] = \"Successfully removed from #{@series}\"\n else\n flash[:alert] = \"Error removing from #{@series}\"\n end\n\n redirect_to convention_series_path(@series)\n end",
"def add_arrays_to_tenant(args = {}) \n post(\"/tenants.json/#{args[:tenantId]}/arrays\", args)\nend",
"def update_user_tenant_id(user)\n # set user tenant based on team roles\n begin\n user.reload\n tenant_ids = user.team_roles.map(&:obj).map(&:tenant_id).uniq\n\n tenant = LandLord.default_tenant if tenant_ids.size != 1\n tenant = LandLord.new(tenant_ids[0]).tenant if tenant_ids.size == 1\n\n user.tenant = tenant\n user.configurable_set_parent(tenant)\n user.save\n rescue\n #giveashit\n # (this is untested, in a rush, and I definitely don't want to break things! TS)\n end\n end",
"def set_tenant_fee\n @tenant_fee = TenantFee.find(params[:id])\n end",
"def department=(new_department) \n\n @department.users.delete(self) \n\n @department = new_department \n\n @department.users << self \n\n end",
"def destroy\n @tenant_family_member.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Tenant family member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.68750405",
"0.677303",
"0.66688025",
"0.6382738",
"0.62778544",
"0.61788285",
"0.61788285",
"0.61681247",
"0.6162323",
"0.6139494",
"0.61336184",
"0.61287415",
"0.6107667",
"0.60380083",
"0.60336614",
"0.60230404",
"0.60229886",
"0.60229886",
"0.60229886",
"0.60229886",
"0.60229886",
"0.60229886",
"0.5978085",
"0.5978085",
"0.5928913",
"0.5886084",
"0.5824078",
"0.5813363",
"0.5766332",
"0.57549095",
"0.575225",
"0.574308",
"0.5682961",
"0.56760895",
"0.5617181",
"0.56062424",
"0.56062424",
"0.5602409",
"0.5571188",
"0.5554483",
"0.55443406",
"0.5531721",
"0.5515642",
"0.54893875",
"0.5470452",
"0.5468143",
"0.5441877",
"0.54278916",
"0.5425097",
"0.54164207",
"0.5403491",
"0.54023415",
"0.54023415",
"0.54023415",
"0.54023415",
"0.5394383",
"0.5391136",
"0.53846455",
"0.5383743",
"0.5373972",
"0.5367234",
"0.53627133",
"0.53486836",
"0.5344689",
"0.53391606",
"0.5338992",
"0.53303903",
"0.53295547",
"0.53181225",
"0.5313392",
"0.5312115",
"0.5301136",
"0.5274682",
"0.52732277",
"0.5251138",
"0.52351403",
"0.5200821",
"0.5199683",
"0.5189276",
"0.5162407",
"0.51601326",
"0.51496243",
"0.5136721",
"0.5125051",
"0.5102428",
"0.51006114",
"0.5074193",
"0.506182",
"0.5058596",
"0.5049552",
"0.5047423",
"0.50453013",
"0.5038863",
"0.5037307",
"0.50325257",
"0.50203437",
"0.50152904",
"0.50022864",
"0.49839836",
"0.49628922"
] | 0.6792177 | 1 |
Remove Tanent End Removing all Tenants | def remove_all_tenants
@apt_tenants.clear
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_endings(words)\n without_endings = []\n words.each do |word|\n without_endings << delete_ending(word)\n end\n\n without_endings\n end",
"def remove_tenant tenant\n\n # Checking if Tenant exsists & Removing a Tenant\n @apt_tenants.each do |i|\n p \"#{tenant.name} has been removed from apartment #{@apt_number}\"\n @apt_tenants.delete_if{|obj| obj.name == tenant.name}\n if @apt_tenants.include? 'i' == false\n p \"No Such Tenant found\"\n else\n end\n end\n\n end",
"def del_final\n @tail = @tail.node_ant\n if @tail != nil\n @tail.edi_sig(nil)\n else\n @head = @tail\n end\n end",
"def delete_ending(word)\n word_size = word.size\n if word_size <= 3\n return word\n else\n 3.downto(1).each do |i|\n ending = word.last(i)\n if @rus_endings.include?(ending)\n return word[0, word_size - i]\n end\n end\n end\n\n word\n end",
"def removeEnd\n @indices.delete(@content[-1])\n @content.pop\n end",
"def remove_trailing(node_or_range, size); end",
"def remove_tenant(building)\n view_apartment_detail(building)\n puts \"Which tenant would you like to remove?\"\n tenant_to_remove = gets.chomp\n ##Step 1: Create an array with the hash of the exact apartment\n apartment_hash_to_modify = building.building_apartment_array.select {|hash| hash[:renter].include? tenant_to_remove}\n ##Step 2: Using the array from step 1:, determine the array index. \n index = building.building_apartment_array.index(apartment_hash_to_modify[0])\n ##Step 3: Remove the tenant\n building.building_apartment_array[index.to_i][:renter].delete(tenant_to_remove)\nend",
"def delete_enders(text_arr)\n\t\tEnder.each {|ending| text_arr.delete(ending)}\n\t\treturn text_arr\n\tend",
"def remove\n from = Suspender.new(doc_with_tokens, tokens_to_remove).suspend\n from.filtered_text\n end",
"def remove_from_descendants\n # TODO\n end",
"def undent!\n replace undent\n end",
"def endpwent\n @pwents = nil\n end",
"def do_remove_from_termination (term)\r\n term.aln_path_id = nil\r\n term.aln_path = nil\r\n term.save\r\n end",
"def exclude_ends potato\n potato [1..-2]\nend",
"def test_tilde_remover\n parser = TancParser.new(\"#{File.dirname(__FILE__)}/../testdata/tanc-1.txt\")\n line_b = \"試験 結果発表~ も 恙無い{つつがなく}~ 終わる{終わって} 当面[01]{当面の} 視点 が 自然[02]{自然と} 夏休み に 集まる{集まって} 来る(くる){くる} でしょう{でしょ}\"\n references_array = line_b.split($delimiters[:tanc_refs_array])\n processed_references_array = []\n references_array.each do |ref|\n data = parser.class.process_reference(ref)\n processed_references_array << data if !data.empty?\n end\n assert_equal(\"結果発表\",processed_references_array[1][:index_word],\"Tilde remover not working\")\n assert_equal(\"恙無い\",processed_references_array[2][:index_word],\"Tilde remover not working\")\n end",
"def undent\n gsub /^.{#{slice(/^ +/).length}}/, ''\n end",
"def delete_last_teaching(teaching)\n if (teaching.curriculums.size == 0)\n teaching.delete\n end\n end",
"def prune\n @set.clear\n end",
"def remove_tail\n remove_node(@tail)\n end",
"def remove_entrance(exit)\n if !@entrances\n return\n end\n @entrances.delete(exit)\n if @entrances.empty?\n @entrances = nil\n end\n resolve_personal_objective_pronoun\n end",
"def strip() end",
"def clear()\n if @extend then\n @tiers.clear\n else\n @tiers.each do |tier|\n tier.clear\n end\n end\n \n @length = 0\n end",
"def remove_tower\n end",
"def drop_unused_tail things\n while things.last.unused?\n things = things[0...-1]\n end\n things\n end",
"def remove_trailing(node_or_range, size)\n range = to_range(node_or_range)\n to_remove = Parser::Source::Range.new(range.source_buffer,\n range.end_pos - size,\n range.end_pos)\n @source_rewriter.remove(to_remove)\n end",
"def remove\n @instantiations.dup.each(&:remove)\n @instantiations[0..-1] = []\n true\n end",
"def summon_removal\n # remove all expired pets\n @pets.clone.each {|p| @pets.delete(p) if p.terminate}\n # remove all expired monsters\n @monsters.clone.each {|m| @monsters.delete(m) if m.terminate}\n end",
"def remove_preceding(node_or_range, size); end",
"def remove_entity\n #traversal all the parent node\n #and remove all the entity of them\n msg = Message.new\n msg.result = true\n ActiveRecord::Base.transaction do\n entity = Entity.find_by_id(params[:entity_id])\n\n #previous_dept = entity.department\n\n #entity.department_id = nil\n #if entity.update_attribute(\"department_id\",nil)\n #if entity_group_item = EntityGroupItem.find_by_entity_id_and_entity_group_id(entity.id,previous_dept.entity_group.id)\n #entity_group_item.destroy\n #end\n\n #previous_dept.ancestors.each do |d|\n # if entity_group_item = EntityGroupItem.find_by_entity_id_and_entity_group_id(entity.id,d.entity_group.id)\n # entity_group_item.destroy\n # end\n #end\n #end\n msg.result = entity.update_attribute(\"department_id\",nil)\n end\n render :json=>msg\n end",
"def remove_termination(term)\r\n do_remove = lambda do |t|\r\n term = AlnTermination.to_aln_termination(t)\r\n self.do_remove_from_termination(term)\r\n self.aln_terminations.to_ary.delete(term)\r\n end\r\n term.class.eql?(Array) ? term.each{|t| do_remove[t]} : do_remove[term]\r\n end",
"def wipe_leading_adjective\n @leading_adjective = nil\n end",
"def delete_tail\r\n delete_node @tail\r\n end",
"def remove_vowel sentence\n sentence.delete 'aeiou'\nend",
"def clearAretes()\n laTaille = @aretes.size()\n for i in 0...laTaille do\n @aretes[0].supprimer()\n end\n end",
"def remove_attendees!(attendees)\n remove_attendees(attendees)\n save!\n end",
"def cleanup(node)\n node = node.root if ::Nokogiri::XML::Document === node\n # remove unwanted tags\n node.xpath(\"//*[@jam='erase']\").each do |n|\n unwrap(n)\n end\n # remove jam attributes\n\n #\n node\n end",
"def removeTenant(tenantArr,id)\n tenantArr.each do |tenant|\n if tenant[:id] == id\n tenant[:apartment_id] = 0\n end\n end\n end",
"def del_start\n @head = @head.node_sig\n if @head != nil\n @head.edi_ant(nil)\n end\n end",
"def delete_finals(arr)\n arr[0..4]\nend",
"def remove_fish_river()\n @fish.slice(index,1)\nend",
"def remove_from_end(arr)\n arr.pop\nend",
"def clean t\n # line feed should be removed also\n !t ? '' : t.gsub(\"\\n\",' ').gsub(\"\\t\",' ').strip.gsub(/\\s\\s+/,' ')\nend",
"def exclude_last potato\n potato[0..-2]\nend",
"def discardHiddenTreasure(t)\n \n end",
"def reset_end!\n @end = nil\n end",
"def vowel_killer\n\"Rubber Soul\".delete \"u\"\n\"Rbber Soul\".delete \"o\"\n\"Rbber Sul\".delete \"u\"\n\"Rbber Sl\".delete \"e\"\nend",
"def rstrip() end",
"def no_foot\n self.gsub(/[']/,\"\")\n end",
"def substractTreasure(tr_list, t)\n place = tr_list.index(t.kind)\n tr_list.delete_at(place) if place != nil\n end",
"def strip!() end",
"def _strip seq\n seq.shift while (tok = seq.first) && tok.type == :endline\n end",
"def strip_excess_words(content_player_id)\n\t\tself.played_words.each do |value|\n\t\t\tif value.t != self.t - 1 \n\t\t\t\tvalue.t_l.clear \n\t\t\tend\n\t\tend\t\n\tend",
"def delete_useless!\n @eng_sentence = @eng_sentence - @useless_eng_words\n @rus_sentence = @rus_sentence - @useless_rus_words\n end",
"def remove_at_tail\n\t\t\treturn nil if self.empty?\n\t\t\telement = self.head\n\t\t\tprevious_element = @head\n\n\t\t\tuntil element.next.nil?\n\t\t\t\tprevious_element = element\n\t\t\t\telement = element.next\n\t\t\tend\n\n\t\t\tprevious_element.next = nil\n\t\t\telement\n\t\tend",
"def exclude_end?() end",
"def consonant_cancel(sentence)\n words = sentence.split\n new_words = words.map { |word| remove_starting_consonants(word) }\n return new_words.join(\" \")\nend",
"def tstrip(term)\n ['au:','ti:','abs:','feed:'].each do |prefix|\n term = term.split(':', 2)[1] if term.start_with?(prefix)\n end\n term#.gsub(\"'\", \"''\").gsub('\"', \"'\")\n end",
"def del_let_words(current)\n output = []\n (0..(current.length-1)).each do |index|\n test_word = current.clone\n test_word[index] = \"\"\n output << test_word if legal_word?(test_word)\n end\n output\nend",
"def remove_topping(removed_topping)\n self.toppings = toppings.delete(removed_topping)\n puts \"You've removed #{removed_topping} from your burrito. Your toppings are now: #{self.toppings}.\"\n end",
"def remove_interrupts_recursivly(phrase, start = true, string)\n\tcheck_punctuation = false\n\tfirst_punctuation = nil\n\tpunctuation_before = start\n\ttags = [\"ADVP\"]\n\tlast_phr = nil #the variable should never be used before a real string is assigned to it\n\tphrase.each do |sub|\n\t\tif check_punctuation && sub.is_a?(Treat::Entities::Punctuation) # if it is a panctuation remove interrupting phrase\n\t\t\tstring.gsub!(/\\s* #{Regexp.escape(first_punctuation)}* \\s* #{Regexp.escape(last_phr)} \\s* #{Regexp.escape(sub.to_s)} \\s*/x, \" \")\n\t\t\tcheck_punctuation = false\n\t\t\tpunctuation_before = true\n\t\t\tfirst_punctuation = sub.to_s\n\t\telse\n\t\t\t# if it is an ADJP or ADVP after a punctuation, check if the next thing is a punctuation\n\t\t\tif punctuation_before && exact_tag?(sub, tags)\n\t\t\t\tcheck_punctuation = true\n\t\t\t\tlast_phr = sub.to_s\n\t\t\t# check if next run will have the potential of being an interrupting phrase\n\t\t\telsif sub.is_a?(Treat::Entities::Punctuation)\n\t\t\t\tpunctuation_before = true\n\t\t\t\tfirst_punctuation = sub.to_s\n\t\t\telse \n\t\t\t# This sub is neither a punctuation nor a potential interrupting phrase\n\t\t\t\tcheck_punctuation = false\n\t\t\t\tpunctuation_before = false\n\t\t\tend\n\t\tend\n\n\t\t# do the same for sub entities\n\t\tstring = remove_interrupts_recursivly(sub, check_punctuation, string)\n\tend\n\n\t#if it ends with it, and without a punctuation, it must be an interrupting phrase at the end.\n\tif check_punctuation\n\t\tstring.gsub!(/\\s* #{Regexp.escape(first_punctuation)}* \\s* #{Regexp.escape(last_phr)} \\s* /x, \" \")\n\t\t\n\tend\n\treturn string\nend",
"def rstrip!() end",
"def teardown_test_chamber\n if TestChamber::Config[:tc_partner_delete]\n TestChamber::Models::Partner.destroy_all(id: Array(TestChamber.created_partners))\n end\nend",
"def remove_tags_container(t, c)\n l, r = container_array(c)\n t.gsub!(l, '')\n t.gsub!(r, '')\n t\n end",
"def remove; end",
"def remove; end",
"def remove; end",
"def remove; end",
"def delete_last()\n \n end",
"def remove!(tenant_id,entity_type_id,entity_id,tags)\n @instance.remove!(tenant_id,entity_type_id,entity_id,tags)\n end",
"def eliminar_una_venta(venta)\n venta[:size]-=1\n nodo = venta[:tope]\n venta[:tope] = venta[:siguiente]\n nodo = nil\nend",
"def remove_node(index)\n @strat.remove_node(index)\n @ize -= 1\n end",
"def remove_from_general\n # Get general committees (may be more than one)\n general = Committee.where(\n committee_type_id: CommitteeType.general.id\n )\n\n # If this member is in the general members group (tested using set difference)\n if (general - self.committees).empty?\n general.each do |committee|\n self.committees.delete(general)\n end\n end\n end",
"def phase_one\n eliminated = []\n 8.times do\n elim_tribe = @borneo.immunity_challenge\n index = @borneo.tribes.index(elim_tribe)\n element = elim_tribe.tribal_council\n @borneo.tribes[index].members = @borneo.tribes[index].members - Array(element)\n eliminated << element\n end\n puts \"Phase 1 eliminations: \".red\n puts \"----------------------------------------\"\n eliminated.each_with_index do |contestants,index|\n puts \"#{index+1}: #{contestants}\"\n end\n puts \"----------------------------------------\"\n eliminated.length\nend",
"def all_else_dna(dna)\n # Input: A\n # Output: C G T\n # Input: C\n # Output: A G T\n dna_a = [\"A\", \"C\", \"G\", \"T\"]\n # puts dna_a.join(\" \")\n dna_a.delete(dna)\n # puts dna_a.join(\" \")\n return dna_a\n end",
"def remove_leading(node_or_range, size); end",
"def trim(n)\r\n @text = @text[n..-1] || \"\"\r\n end",
"def remove_vowel(sentence)\n sentence.delete('aeiou')\nend",
"def remove_discard_supernatant(items)\n show do\n title 'Remove Supernatant'\n note 'Remove and discard supernatant from:'\n items.each do |item|\n bullet item.to_s\n end\n end\n end",
"def remove_all_straits!\n patch_file!(\"map/adjacencies.csv\") do |file|\n # Haida-Tlingit\n file.b.lines.select{|x|\n t = x.split(\";\")[2]\n x =~ /Haida/ or (t != \"sea\" and t != \"lake\")\n }.join\n end\n end",
"def trim(start_nt, end_nt, ref_option = :HXB2, path_to_muscle = false)\n seq_hash = self.dna_hash.dup\n seq_hash_unique = seq_hash.uniq_hash\n trimmed_seq_hash = {}\n seq_hash_unique.each do |seq, names|\n trimmed_seq = ViralSeq::Sequence.new('', seq).sequence_clip(start_nt, end_nt, ref_option, path_to_muscle).dna\n names.each do |name|\n trimmed_seq_hash[name] = trimmed_seq\n end\n end\n return_seq_hash = self.dup\n return_seq_hash.dna_hash = trimmed_seq_hash\n return return_seq_hash\n end",
"def strip_to_stems\n str = self.sanitize_tags\n terms_a = str.gsub(/[^a-z]+/u, ' ').strip.split(' ')\n terms = terms_a.reject do |term|\n ((term.length < 3 && !SHORT_WORDS.include?(term)) || term.length > 20)\n end\n terms.collect! {|term| term.stem}\n terms = terms.select {|term| term.length > 1}\n terms = terms - STOP_STEMS\n return terms.join(' ')\n end",
"def disemvowel word\n word.delete('aeiou')\nend",
"def remove_sport\n 'basketball|baseball|softball|football|womens basketball'\n end",
"def remove(range); end",
"def remove(range); end",
"def remove(range); end",
"def remove(range); end",
"def remove(range); end",
"def remove(range); end",
"def remove(range); end",
"def remove(range); end",
"def excluir(telefone)\n @client.delete(Route.new([ROTA_BINA, telefone]))\n end",
"def trim\n repeat_until_unchanged(&:trim_once)\n end",
"def remove_en_passant(x, y)\n\t\topposite_team_color = (@board[x][y].piece.color == :white ? :black : :white)\n\t\tpawns = collect_pawns(opposite_team_color)\n\t\tpawns.each do |pawn|\n\t\t\tif @board[x][y].piece.color == :white\n\t\t\t\tpawn.piece = nil if pawn.piece.en_passant == true && @board[x][y - 1] == pawn\n\t\t\telse\n\t\t\t\tpawn.piece = nil if pawn.piece.en_passant == true && @board[x][y + 1] == pawn\n\t\t\tend\n\t\tend\n\tend",
"def delete_suffix!(str)\n return unless end_with?(str)\n\n slice!(-str.length..-1)\n self\n end",
"def cleanup \n @bullets.each do |bullet|\n if bullet.exploding\n @bullets.delete bullet\n end\n end\n end",
"def delete_last_n_characters_in_word(word,n)\r\n start = word.Selection.Start\r\n word.Selection.Start = start - n\r\n word.Selection.End = start\r\n word.Selection.Delete\r\nend",
"def destroy\r\n AlnTermination.find_all_by_aln_path_id(self.aln_path_id, :readonly => false).each {|t| do_remove_from_termination(t)}\r\n super\r\n end",
"def shortened_tweet_truncator(tweet)\n # puts \"**********************************#{tweet}\"\n tweet = selective_tweet_shortener(tweet)\n # new_tweet = tweeet\n if tweet.length > 140\n #slice!(start, length) → new_ary or nil\n tweet = tweet.slice(0,140)\n end\n tweet\nend",
"def remove(params)\n params[:real_at] ||= AtStructure.new(params[:at])\n\n # Le text-item de référence\n unless params.key?(:titem_ref)\n params.merge!(titem_ref: params[:real_at].first_titem)\n end\n\n # Pour connaitre l'opération, pour faire la distinction, plus tard, entre\n # une pure suppression et un remplacement. Elle permet aussi d'enregistrer\n # l'opération dans l'historique operations.txt\n unless params.key?(:operation)\n params.merge!(operation: 'remove')\n end\n\n # Un débug (régler les valeurs en haut de ce module)\n if debug_replace? || debug_remove?\n log(\"-> remove(params=#{params.inspect})\")\n end\n\n if params[:operation] == 'remove'\n msg = \"Suppression de “#{params[:real_at].first_titem.content}” (index absolu #{params[:real_at].abs(:at)}, index relatif #{params[:real_at].at}).\"\n log(msg, true)\n end\n\n\n # Si c'est une vraie suppression (i.e. pas un remplacement), il faut\n # supprimer aussi l'espace après. S'il n'y a pas d'espace après, il faut\n # supprimer l'espace avant s'il existe.\n # La formule est différente en fonction du fait qu'on ait un rang ou\n # un index seul et une liste discontinue d'index.\n # ATTENTION AUSSI : l'espace supplémentaire à supprimer est peut-être\n # dans la liste des index à supprimer et dans ce cas il faut étudier\n # le mot suivant et le text-item non-mot suivant.\n #\n # Le but de cette partie est donc de produire la liste exacte des text-items\n # qui doivent être finalement supprimé.\n # Elle n'est valable que pour une suppression pure car pour un replacement,\n # il faut garder tous les éléments autour du mot ou des mots remplacés.\n at = params[:real_at]\n if params[:operation] == 'remove'\n if at.list?\n # Pour une liste, on doit faire un traitement particulier : il faut\n # vérifier les text-item après chaque \"trou\"\n liste_finale = at.list.dup\n at.titems.each_with_index do |titem, idx_in_list|\n # Les non-mots doivent être passés\n next if titem.non_mot?\n # On passe ce mot si le mot suivant appartient aussi à la liste\n next if at.list[idx_in_list + 1] == idx + 1\n # On passe ce mot si le mot précédent appartient aussi à la liste\n next if at.list[idx_in_list - 1] == idx - 1\n # On doit tester ce mot qui est \"seul\" dans la liste, c'est-à-dire\n # que la liste ne contient ni son mot juste après ni son mot\n # juste avant.\n next_index = idx + 1\n next_titem = extrait_titems[next_index]\n prev_index = idx - 1\n prev_index = nil if prev_index < 0\n prev_titem = prev_index.nil? ? nil : extrait_titems[prev_index]\n if next_titem && next_titem.space?\n # On l'ajoute à la liste des items à supprimer\n liste_finale.insert(idx_in_list + 1, next_index)\n elsif prev_titem && prev_titem.space?\n liste_finale.insert(idx_in_list, prev_index)\n end\n end #/ boucle sur la liste\n\n # Si la liste finale a changé, il faut corrigé le at\n if liste_finale != at.list\n params[:real_at] = at = AtStructure.new(liste_finale.join(VG))\n end\n\n else\n # Pour un rang et un index seul, le traitement est plus simple, il\n # suffit de voir l'index après le dernier.\n # Noter qu'on ne supprime pas les espaces ici, on modifie le rang\n # ou on transforme l'index en range, ceci afin de ne pas provoquer\n # de doubles suppressions\n next_index = at.last + 1\n prev_index = at.first - 1\n prev_index = nil if prev_index < 0\n if extrait_titems[next_index].space?\n params[:real_at] = at = AtStructure.new(\"#{at.first}-#{next_index}\")\n elsif prev_index && extrait_titems[prev_index].space?\n params[:real_at] = at = AtStructure.new(\"#{prev_index}-#{at.last}\")\n end\n end\n end\n\n # On mémorise l'opération pour pouvoir l'annuler\n if params.key?(:cancellor) # pas quand c'est une annulation\n at.titems.each do |titem|\n params[:cancellor] << {operation: :insert, index: titem.index, content: params[:content]}\n end\n end\n\n # SUPPRESSION\n # ------------\n # On procède vraiment à la suppression des mots dans le texte\n # lui-même, ainsi que dans la base de données avec une formule différente en\n # fonction du fait que c'est un rang ou une liste (note : un index unique\n # a été mis dans une liste pour simplifier les opérations)\n if at.range?\n extrait_titems.slice!(at.from, at.nombre)\n itexte.db.delete_text_items(from:at.abs(:from), for:at.nombre)\n else\n at.list.each { |idx| extrait_titems.slice!(idx) }\n itexte.db.delete_text_items(at.abs(:list))\n end\n\n # Si c'est vraiment une opération de destruction, on l'enregistre\n # en tant qu'opération et on actualise l'affichage en indiquant que\n # l'extrait a changé\n if params[:operation] == 'remove'\n itexte.operator.add_text_operation(params)\n update\n end\n\nend"
] | [
"0.5913725",
"0.5794198",
"0.57462716",
"0.5727242",
"0.5651412",
"0.55635625",
"0.5450321",
"0.54101455",
"0.5331219",
"0.53170764",
"0.53120434",
"0.52626944",
"0.52606344",
"0.52599806",
"0.52569854",
"0.52429855",
"0.5203306",
"0.5200003",
"0.51658964",
"0.51571745",
"0.5130918",
"0.5129384",
"0.51172817",
"0.51033854",
"0.50918984",
"0.5083455",
"0.5080947",
"0.5077581",
"0.5073024",
"0.50674653",
"0.50647366",
"0.5054088",
"0.5047286",
"0.504451",
"0.5030879",
"0.50129616",
"0.50129366",
"0.5004058",
"0.50014454",
"0.5001407",
"0.5000744",
"0.49884886",
"0.49762407",
"0.4974423",
"0.49728373",
"0.4972032",
"0.4967996",
"0.49642953",
"0.49584854",
"0.49515077",
"0.49459663",
"0.4935307",
"0.4934872",
"0.49231747",
"0.49135613",
"0.49129993",
"0.4910623",
"0.49083576",
"0.49017596",
"0.48978895",
"0.48942426",
"0.48903462",
"0.48825112",
"0.48795596",
"0.48795596",
"0.48795596",
"0.48795596",
"0.48760456",
"0.48728064",
"0.48707983",
"0.4869781",
"0.485693",
"0.48506612",
"0.48491505",
"0.48478198",
"0.48477536",
"0.48405594",
"0.48392975",
"0.48355705",
"0.48273742",
"0.4825241",
"0.4816696",
"0.48132235",
"0.4811011",
"0.4811011",
"0.4811011",
"0.4811011",
"0.4811011",
"0.4811011",
"0.4811011",
"0.4811011",
"0.48084673",
"0.4807166",
"0.47986722",
"0.47892827",
"0.47888976",
"0.4787551",
"0.47831276",
"0.47825575",
"0.47814065"
] | 0.6031212 | 0 |
calculating average credit rating | def average_credit_score
#Validation
if @apt_tenants.size <= 0
p "No Tenants!"
else
#Isolating credit Scores
every_credit = self.apt_tenants.map { |i| i.credit_score }
#Summing total, then dividing by arr size
average_credit = every_credit.reduce(:+) / every_credit.size
#passing to class instance
@apt_avg_c = average_credit
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def average_rating\n sum = 0\n self.ratings.each do |rating|\n sum += rating.score\n end\n avg = sum/self.ratings.length\n avg.to_f\n end",
"def average_rating\n \ttotal_score = 0\n \tnum_of_ratings = self.ratings.count\n \tself.ratings.each do |rating|\n \t\ttotal_score += rating.overall_rating\n \tend\n \tif num_of_ratings > 0\n \t\treturn total_score / num_of_ratings\n \telse\n \t\treturn 0\n \tend\n end",
"def average_credit_score\n @tenants.inject{ |sum, t| sum + t.credit_score }.to_f / @tenants.size\n end",
"def average_rating\n self.ratings.reduce(0.0) { |sum, score| sum += score } / self.ratings.length\n end",
"def average_rating\n\t\t\t\t\treturn 0 if rates.empty?\n\t\t\t\t\t( rates.inject(0){|total, rate| total += rate.score }.to_f / rates.size )\n\t\t\t\tend",
"def average_rating(&block)\n total = 0\n countable_ratings = block ? ratings.select(&block) : ratings\n countable_ratings.each do |rating|\n total += rating.rating\n end\n average_rating = countable_ratings.empty? ? 0 : (0.0 + total) / countable_ratings.size\n # only 1 decimal.\n [(0.0 + (average_rating * 10).round) / 10, countable_ratings.size]\n end",
"def average_rating\n ratings.inject(0.0) {|sum, num| sum +=num} / ratings.length\n end",
"def average_credit_rating\n if average_credit_score > 760\n \"excellent\"\n elsif average_credit_score > 725\n \"great\"\n elsif average_credit_score > 660\n \"good\"\n elsif average_credit_score > 560\n \"mediocre\"\n else\n \"bad\"\n end\n end",
"def average_rating\n\n all_ratings = self.reviews.to_a.map do |review|\n review.rating\n end\n\n return 0 unless all_ratings.length > 0\n\n all_ratings.sum / all_ratings.length\n end",
"def average_rating\n (ratings.sum(:rating).to_f / num_ratings).round(1)\nend",
"def average_rating\n if reviews.count > 0\n ratings = reviews.map { |review| review.rating }\n sum = ratings.reduce(:+)\n if sum > 0\n average = sum / ratings.count\n average.round(1)\n else\n return 0\n end\n else\n return 0\n end\n end",
"def average_rating\n return 0 if self.ratings.empty?\n (self.ratings.inject(0){|total, rating| total += rating.score }.to_f / self.ratings.size )\n end",
"def calc_average!\n update!(avg_rating: ratings.average(:rating))\n end",
"def average_rating\n total = 0\n self.reviews.each do |review|\n total += review.rating\n end\n average = total.to_f / self.reviews.count\n end",
"def calculate_average_rating\n self.average_rating = ((self.content_rating.to_f + self.recommend_rating.to_f) / 2).round(1)\n end",
"def avg_rating\n stars_array = []\n ratings.each do |rating|\n stars_array << rating.stars\n end\n return stars_array.inject{ |sum, el| sum + el }.to_f / stars_array.size\n end",
"def average_ratings\n ratings = 0\n self.ratings.each {|r| ratings += r.score}\n avg = votes == 0 ? 0 : ratings.to_f/votes.to_f\n \"%.1f\" % avg\n end",
"def average_ratings\n ratings = 0\n self.ratings.each {|r| ratings += r.score}\n avg = votes == 0 ? 0 : ratings.to_f/votes.to_f\n \"%.1f\" % avg\n end",
"def average_rating\n\t\tall_ratings = self.reviews.map{|review| review.rating}\n\t\taverage_rating = all_ratings.reduce(0){|sum, rating| sum + rating} / all_ratings.count.to_f\n\t\t'%.1f' % average_rating \n\tend",
"def average_rating\r\n comments.average(:rating).to_f\r\n end",
"def average_ratings\n ratings.average(:int_value)\n end",
"def rating\n average = 0.0\n ratings.each { |r|\n average = average + r.rating\n }\n if ratings.size != 0\n average = average / ratings.size\n end\n average\n end",
"def average\n return ((@critics_score + @audience_score) / 2.0) #ultimate math skillz.\n end",
"def average_rating\n average = 0\n count = 0 \n self.trips.each do |trip|\n average += trip.rating.to_i\n count += 1\n end\n return average / count\n end",
"def avg_score\n reviews.average(:rating).round(2).to_f\n end",
"def rating_calculation\n ratings_collection = Rating.where(user_id: self.id)\n average = -1\n if !ratings_collection.empty?\n sum = 0\n ratings_collection.each do |r|\n sum += r.rating\n end\n average = (sum.to_f / ratings_collection.count).round\n end\n average\n end",
"def average_rating\n ratings.average(:value).to_f\n end",
"def calculate_average\n return 0 unless reviews.size.positive?\n avg = self.reviews.average(:rating) #.to_f.round(2) # * 100\n update_column(:rating, avg)\n end",
"def average_rating\n return 'n/a' if reviews.empty?\n #return 0 if reviews.empty?\n (reviews.pluck(:rating).sum / reviews.count.to_f).round(2)\n end",
"def average_rating\n\t\tall_ratings = self.reviews.map{|review| review.rating}\n\t\taverage_rating = all_ratings.reduce(0){|sum, rating| sum + rating} / all_ratings.count.to_f\n\t\t'%.0f' % average_rating # rounds to nearest integer for now\n\tend",
"def average_rating\n comments.average(:rating).to_f\n end",
"def average_rating\n comments.average(:rating).to_f\n end",
"def average_rating\n comments.average(:rating).to_f\n end",
"def average_rating\n comments.average(:rating).to_f\n end",
"def cal_mean\n sum = @data.inject(0) do |accu, hash|\n accu + hash[:prediction] - hash[:rating]\n end\n sum.to_f / @data.size\n end",
"def calculate_average_rating\n weighted_drinks_ratings.sum.to_f / weighted_drinks_ratings.count\n end",
"def average(ratings)\n ratings.inject(0.0) { |sum, el| sum + el.to_f } / ratings.size\n end",
"def average_rating\n rating_sum = 0\n if @trips.length > 0\n @trips.each.map do |trip|\n rating_sum += trip.rating\n end\n total_rating = (rating_sum.to_f / trips.length.to_f)\n total_rating = total_rating.to_f\n puts total_rating\n return total_rating\n elsif @trips == []\n return 0\n end \n end",
"def average_out(ratings)\n ratings.sum(&:score).to_f / ratings.count\n end",
"def average_rating\n ratings\n .average(:rating)\n .to_f\n .round(2)\n end",
"def avg_rating\n @reviews = @product.reviews\n @avg_rating = nil\n\n if @reviews.size > 0\n @avg_rating = (@reviews.inject(0.0) { |sum, el| sum + el.rating }.to_f / @reviews.size).round(1)\n end\n end",
"def avg_rating\n @avg = self.ratings.average(:rating) \n @avg ? @avg : 0\n end",
"def average_score\n if reviews.size > 0\n (reviews.sum(:rating) / reviews.size).round(1)\n else\n 0.0\n end\n end",
"def average_rating\n self.reviews.sum(:score) / reviews.size\n rescue ZeroDivisionError\n 0\n end",
"def average_rating\n return 'N/A' if reviews.none?\n reviews.inject(0) {|memo, review| memo + review.rating} / reviews.length\n end",
"def avg\n array = []\n# this DO-loop will put all the star ratings into an array\n @reviews.each do |count|\n array.push(count.star.to_i)\n end\n# this line will calculate the actual average of all the star ratings\n outavg = array.inject(0.0) { |sum, el| sum + el } / array.size\n end",
"def average_rating\n reviews.average(:rating)\n end",
"def average_rating\n guest_reviews.count == 0 ? 0 : guest_reviews.average(:star).round(2).to_i\n end",
"def avg_score\n return 0 unless reviews.count.positive?\n\n reviews.average(:score).round(2).to_f\n end",
"def avg_score\n return 0 unless reviews.size.positive?\n\n reviews.average(:score).to_f.round(2)\n end",
"def recalculate_average()\n\n #find total of all review ratings by iterating through them\n total = 0\n self.reviews.each do |review|\n total = total + review.rating\n end\n\n newAvg = total / self.reviews.size\n\n self.update_attribute(:avg_rating, newAvg)\n end",
"def get_avg\n recentReviewed = get_user_cards(Result.all)\n filteredDates = get_dates(recentReviewed)\n totalScore = filteredDates.reduce(0) {|curr,n| curr + n.score} \n totalScore/filteredDates.count \n end",
"def average_rating()\n total_ratings = 0\n total_trips = 0\n average_rating = 0\n #self.trips = Trip.where(driver_id:self.id)\n self.trips.each do |trip|\n # if trip cost is not nil, the trip is complete\n if trip.cost != nil \n total_ratings += trip.rating\n total_trips += 1\n end\n end\n if total_trips > 0 \n average_rating = total_ratings.to_f / total_trips\n end\n return average_rating\n end",
"def overall_rating\n\t\ttotal_score = 0\n\t\ttotal_score += self.setting \n\t\ttotal_score += self.hotness\n\t\ttotal_score += self.originality\n\t\ttotal_score += self.style\n\t\ttotal_score += self.attitude\n\t\treturn total_score / 5\n\tend",
"def average_rating\n if events.any?\n scores =[]\n events.each do |e|\n valid_ratings = e.ratings.valid_only\n if valid_ratings.any?\n scores << valid_ratings.map {|r| r.score}.sum / valid_ratings.size\n end\n end\n scores.sum/scores.size.to_f\n else\n 0\n end\n end",
"def calculate_average_ratings\n total_reviews = self.reviews.count\n\n quality_total = 0\n study_total = 0\n laptop_total = 0\n hipster_total = 0\n\n self.reviews.each { |review| quality_total += review.qualityRating }\n self.reviews.each { |review| study_total += review.studyRating }\n self.reviews.each { |review| laptop_total += review.laptopRating }\n self.reviews.each { |review| hipster_total += review.hipsterRating }\n\n if total_reviews > 0\n self.average_hipster = hipster_total / total_reviews\n self.average_study = study_total / total_reviews\n self.average_laptop = laptop_total / total_reviews\n self.average_quality = quality_total / total_reviews\n self.overall_average = (average_hipster + average_study + average_laptop + average_quality)/4\n end\n self.save\n end",
"def user_average_rating(user)\n #av = promedio (avarage), counter = contador(para calcular el total de reviews realizada)\n av, counter = 0.0, 0.0\n \n Review.where(user_id: user.id).each_with_index do |review, i|\n if review.rating\n av = av + review.rating\n counter = counter + 1.0\n end\n end\n\n av / counter\n end",
"def avg_score\n return 0 unless reviews.count.positive?\n reviews.average(:score).round(2).to_f\n end",
"def average_rating\n if ratings.where(\"score > 0\").size != 0\n\t\tratings.where(\"score > 0\").sum(:score) / ratings.where(\"score > 0\").size\n\telse\n\t\t0\n\tend\n end",
"def average_rating\n return nil if reviews.detect{|r| r.rating}.nil?\n ratings = reviews.map{|r| r.rating}.reject{|r| r.nil?}\n ratings.sum / ratings.size\n end",
"def average_score\n count = 0.0\n avrg = 0.0\n if self.cadets.empty?\n return 0.0\n else\n self.cadets.each do |cdt|\n unless cdt.discharged?\n avrg += cdt.average_score\n count += 1.0\n end\n end\n return count != 0.0 ? (avrg/count).round(1) : 0.0\n end\n end",
"def average_rating\n driver_id = id\n trips_array = RideShare::Trip.find_by_driver(driver_id)\n trips_array.collect! { |trip| trip.rating.to_f }\n trips_array.reject! { |trip| trip < 1 }\n total = trips_array.reduce(:+)/trips_array.length\n total.round(2)\n end",
"def average_rating\n avgrev = reviews.average(:rating)\n \n if avgrev == 0 || avgrev.nil?\n avgrev = 0\n else\n avgrev \n end\n end",
"def average_rating\n if ratings != []\n ratings.sum(:stars) / ratings.size\n else\n 0\n end\n end",
"def calculate_reviews_average(score)\n (self.reviews_average * self.reviews_count + score) / (self.reviews_count + 1)\n end",
"def average_points\n if ratings.count > 0\n ratings.collect(&:points).sum / ratings.count\n else\n 0\n end\n end",
"def credit_rating\n Credit_Ratings.credit_chart(credit_score)\n end",
"def get_avg_rating(rides)\n total_rating = 0\n rides.each do |ride|\n total_rating += ride[:rating]\n end\n return total_rating.to_f / get_num_rides(rides)\nend",
"def get_average_rating(driver_id)\n\n sum = RIDE_SHARES[driver_id].sum do |rides|\n rides[:rating]\n end\n\n return (sum.to_f / RIDE_SHARES[driver_id].length * 10).floor / 10.0\n\nend",
"def rate(rating)\n @nb_ratings += 1\n @sum_ratings += rating\n @average_rating = @sum_ratings / @nb_ratings\n end",
"def average_rating\n ratings.present? ? (ratings.map(&:score).sum.to_f) / ratings.count : nil\n end",
"def avg_rating\n\t\tcount = reviews.count\n\t\tcount > 0 ? '%.2f' % (reviews.reduce(0) {|sum,x| sum + x.rating }.to_f / count) : '0.00'\n\tend",
"def reviews_avg\n number_with_precision(self.member_reviews.avg(:rating), precision: 1)\n end",
"def average_rating\n if driven_trips.length == 0\n return 0\n else\n completed_trips = driven_trips.reject {|trip| trip.rating.nil?}.map{|item| item.rating}\n return completed_trips.sum.to_f / completed_trips.length\n end\n end",
"def average_of_ratings(numbers)\n\t\tsum = numbers.reduce(:+)\n\t\tavg = sum.to_f / numbers.length\n\tend",
"def avg_rating\n movie_recs = self.given_movie_recommendations\n book_recs = self.given_book_recommendations\n ratings = (movie_recs + book_recs).map(&:recommendee_rating).compact\n return 0 if ratings.empty?\n (ratings.sum.to_f / ratings.size.to_f).round(1)\n end",
"def avg_rating(attribute)\n\t\tif reviews.none?\n\t\t val = 0\n\t\telse \n\t\t val = reviews.average(attribute)\n\t\tend\n\t\treturn val\n\tend",
"def average_rating(assignment)\n # team = self.teams.find(team_id)\n # feedback = team.feedbacks.all.where(:receiver_id => self.user_id)\n feedback = assignment.feedbacks.where(:receiver_id => self.user_id)\n average = 0\n for f in feedback\n average += f.rating\n end\n if feedback.length != 0\n average = average/feedback.length\n average.to_s\n else\n 'N/A'\n end\n end",
"def average_rating \n\t\tif has_reviews?\n\t\t\taverage_rating = ratings.reduce(0){|sum, rating| sum + rating} / ratings.count.to_f\n\t\t\t'%.0f' % average_rating # rounds to nearest integer for now\n\t\telse\n\t\t\t\"NA\"\n\t\tend\n\tend",
"def average_rating\n if reviews.count >= 1\n self.reviews.average(:rating).to_f\n else\n \"No reviews yet!\"\n end\n end",
"def rating\n reviews.average(:rating)\n end",
"def avg_rating u\n \tuser_ratings = @userdata[u.to_s.to_sym]\n \tavg = 0\n \tuser_ratings.each do |id, rating|\n \t\tavg += rating\n \tend\n \tavg = avg / user_ratings.size.to_f\n \treturn avg\n end",
"def average_rating_round\n average_rating.round\n end",
"def average_reviews \n zmienna = self.reviews.sum(\"vote\") \n zmienna2 = self.reviews.count\n if zmienna2 == 0\n wynik = 0\n else \n wynik = zmienna/zmienna2\n end \n end",
"def avg_rating\n\t\t('%.2f' % issues.average(:rating).to_f).to_f\n\tend",
"def get_avg_rating(movie_ratings)\n sum = 0\n movie_ratings.each { |b| sum += b }\n @average_movie_rating = (sum.to_f / @movie_ratings.count.to_f).round(1)\n end",
"def average_review_rating\n self.reviews.all.average(:rating)\n end",
"def average_rating\n ratings = book_reviews.pluck(:rating)\n ratings.size.zero? ? nil : (ratings.sum / ratings.size.to_f).round(1)\n end",
"def average\n if self.critics.size>0\n begin\n self.critics.map{|i| i.score.to_f}.inject{ |sum, el| sum + el }.to_f / self.critics.size.to_f\n rescue\n nil\n end\n end\n end",
"def average_rating\n rating && rating.average_rating || 0.0\n end",
"def average_rating\n feedbacks = Feedback.submitted.where(\"project_id in (?)\", self.projects.pluck(:id))\n if feedbacks.count >= 1\n sum = 0\n feedbacks.each do |feedback|\n sum += feedback.rating\n end\n average_rating = (sum.to_f() / feedbacks.count).round(1)\n #return 1, 2, 3, or 4 based on average_rating\n if average_rating > 0 and average_rating <= 2.5\n average_rating = 1\n elsif average_rating > 2.5 and average_rating <= 5.0\n average_rating = 2\n elsif average_rating > 5.0 and average_rating <= 7.5\n average_rating = 3\n elsif average_rating > 7.5 and average_rating <= 10.0\n average_rating = 4\n end\n else\n average_rating = 0\n end\n average_rating\n end",
"def rating\n average_rating = (trips.collect {|trip| trip.rating.to_f}.sum)/trips.length\n ## Code below functions the same as the code in line 28\n ## Was unsure which design was preferred, so left both in\n # total_rating = 0.0\n # trips.each do |trip|\n # total_rating += trip.rating\n # end\n # average_rating = total_rating/trips.length\n return average_rating.round(1)\n end",
"def get_average_rating\n num_of_trips = get_num_of_completed_trips\n return num_of_trips == 0 ? 0 : (get_ratings.to_f / num_of_trips)\n end",
"def ratings\n if self.reviews.any?\n avg_rating = 0\n self.reviews.each do |review|\n avg_rating += review.rating\n end\n avg_rating = (avg_rating/self.reviews.length).ceil\n return avg_rating\n end\n end",
"def average_rating_round\n average_rating.round\n end",
"def rating_average(obj)\n if obj.reviews.count >= 1\n array = []\n obj.reviews.each do |review|\n array.push(review.rating)\n end\n return (array.inject{ |sum, el| sum + el }.to_f / array.size).to_i\n else\n if obj.class.name == \"SharespaceVenue\"\n \"No reviews yet.\"\n else\n \"No reviews yet.\"\n end\n end\n\n\n\n end",
"def average_rating\n cal_average_rating(@products)\n end",
"def average_of_star_ratings\n return nil if star_ratings.size == 0\n star_ratings.average(:stars).to_int\n end",
"def update_score\n sum = 0.0\n total = 0.0\n ratings.each do |rating|\n vp = User.find(rating.user_id).voting_power \n sum = sum + rating.score * vp\n total = total + vp\n end\n average = sum / total\n variance = ratings.inject(0.0){ |sum, element| sum + \n (element.score - average) ** 2 }\n penalty = Math.log10((variance / ratings.size) + 1) + 1.0;\n update_attribute(:score, average / penalty)\n end",
"def avg_rating\n visits.avg_rating\n end"
] | [
"0.7896761",
"0.78927726",
"0.7869654",
"0.78171885",
"0.78170496",
"0.78020513",
"0.7753853",
"0.7751833",
"0.774462",
"0.773833",
"0.76897085",
"0.76746",
"0.76614314",
"0.7647812",
"0.7638108",
"0.7589248",
"0.75538844",
"0.75538844",
"0.751805",
"0.75172794",
"0.7513618",
"0.75010043",
"0.7484414",
"0.74594307",
"0.7455556",
"0.7445199",
"0.742929",
"0.7428444",
"0.7417362",
"0.741555",
"0.7405039",
"0.7405039",
"0.7405039",
"0.7405039",
"0.7395772",
"0.7395098",
"0.73897094",
"0.73804736",
"0.73718715",
"0.7367002",
"0.7366657",
"0.736095",
"0.7353337",
"0.732683",
"0.73015755",
"0.7298933",
"0.72941047",
"0.7276817",
"0.7275313",
"0.72664523",
"0.7261454",
"0.7256951",
"0.72519886",
"0.7248716",
"0.72449565",
"0.7239788",
"0.7235959",
"0.7234883",
"0.72315377",
"0.72279626",
"0.7221808",
"0.72140646",
"0.7211558",
"0.7204063",
"0.71974635",
"0.7195519",
"0.7192396",
"0.71855205",
"0.71637416",
"0.716014",
"0.7154432",
"0.7128768",
"0.712595",
"0.7125884",
"0.711145",
"0.710094",
"0.70962536",
"0.70875883",
"0.70848197",
"0.7078042",
"0.7061636",
"0.70609",
"0.7045103",
"0.7040642",
"0.703711",
"0.7026354",
"0.70261365",
"0.7024239",
"0.70090234",
"0.69938284",
"0.6975874",
"0.6971722",
"0.6956927",
"0.69427717",
"0.69332117",
"0.6927885",
"0.69193274",
"0.6912705",
"0.6903348",
"0.68980956"
] | 0.75685805 | 16 |
average_credit_score ends apartment credit rating | def apartment_credit_rating
#Run Rate Credit
therating = rate_credit @apt_avg_c
#Pass results to model
@apt_c_rating = therating
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def average_credit_score\n @tenants.inject{ |sum, t| sum + t.credit_score }.to_f / @tenants.size\n end",
"def average_credit_score\n\n #Validation\n if @apt_tenants.size <= 0\n p \"No Tenants!\"\n else\n #Isolating credit Scores\n every_credit = self.apt_tenants.map { |i| i.credit_score }\n\n #Summing total, then dividing by arr size\n average_credit = every_credit.reduce(:+) / every_credit.size\n\n #passing to class instance\n @apt_avg_c = average_credit\n end\n end",
"def average_credit_rating\n if average_credit_score > 760\n \"excellent\"\n elsif average_credit_score > 725\n \"great\"\n elsif average_credit_score > 660\n \"good\"\n elsif average_credit_score > 560\n \"mediocre\"\n else\n \"bad\"\n end\n end",
"def average\n return ((@critics_score + @audience_score) / 2.0) #ultimate math skillz.\n end",
"def calculate_final_score\n self.scores.average(:total_score)\n end",
"def average_score\n count = 0.0\n avrg = 0.0\n if self.cadets.empty?\n return 0.0\n else\n self.cadets.each do |cdt|\n unless cdt.discharged?\n avrg += cdt.average_score\n count += 1.0\n end\n end\n return count != 0.0 ? (avrg/count).round(1) : 0.0\n end\n end",
"def average_score\n grades.average(:score) || 0\n end",
"def credit_rating\n Credit_Ratings.credit_chart(credit_score)\n end",
"def avg_score\n return 0 unless reviews.size.positive?\n\n reviews.average(:score).to_f.round(2)\n end",
"def calculate_reviews_average(score)\n (self.reviews_average * self.reviews_count + score) / (self.reviews_count + 1)\n end",
"def average\n if self.critics.size>0\n begin\n self.critics.map{|i| i.score.to_f}.inject{ |sum, el| sum + el }.to_f / self.critics.size.to_f\n rescue\n nil\n end\n end\n end",
"def avg_score\n return 0 unless reviews.count.positive?\n\n reviews.average(:score).round(2).to_f\n end",
"def avg_score\n return 0 unless reviews.count.positive?\n reviews.average(:score).round(2).to_f\n end",
"def average_rating\n \ttotal_score = 0\n \tnum_of_ratings = self.ratings.count\n \tself.ratings.each do |rating|\n \t\ttotal_score += rating.overall_rating\n \tend\n \tif num_of_ratings > 0\n \t\treturn total_score / num_of_ratings\n \telse\n \t\treturn 0\n \tend\n end",
"def average_of(raitingss)\n raitingss.sum(&:score).to_f / raitingss.count\n end",
"def avg_score\n reviews.average(:rating).round(2).to_f\n end",
"def average_out(ratings)\n ratings.sum(&:score).to_f / ratings.count\n end",
"def average_rating\n sum = 0\n self.ratings.each do |rating|\n sum += rating.score\n end\n avg = sum/self.ratings.length\n avg.to_f\n end",
"def average_score\n if reviews.size > 0\n (reviews.sum(:rating) / reviews.size).round(1)\n else\n 0.0\n end\n end",
"def average_rating\n\t\t\t\t\treturn 0 if rates.empty?\n\t\t\t\t\t( rates.inject(0){|total, rate| total += rate.score }.to_f / rates.size )\n\t\t\t\tend",
"def calc_average!\n update!(avg_rating: ratings.average(:rating))\n end",
"def get_average_score()\n if get_maximum_score != 0 then\n ((get_total_score.to_f / get_maximum_score.to_f) * 100).to_i\n else\n 0\n end\n end",
"def average\n\t\tif 2 < course.users.length and 0 < grades.length and 0 < worth\n\t\t\taverage = (grades.sum(:grade) / grades.length);\n\t\t\taverage = (average.to_f / worth) * 100;\n\t\t\treturn average\n\t\tend\n\tend",
"def average_rating\n self.ratings.reduce(0.0) { |sum, score| sum += score } / self.ratings.length\n end",
"def average_score\n numbers_without_zeros = self.comments.map{|comment| comment.overall_score}.reject{|n| n==0}\n return 0 if numbers_without_zeros == []\n preround = numbers_without_zeros.inject(:+)/numbers_without_zeros.count.to_f\n return preround.round\n end",
"def feedback_score\n average_rating = self.average_rating\n if average_rating > 0 and average_rating <= 2.5\n average_rating = 1\n elsif average_rating > 2.5 and average_rating <= 5.0\n average_rating = 2\n elsif average_rating > 5.0 and average_rating <= 7.5\n average_rating = 3\n elsif average_rating > 7.5 and average_rating <= 10.0\n average_rating = 4\n end\n end",
"def avg_score\n deploy_average_scoring? ? self[:avg_score] : 0\n end",
"def compute_average_grade\n total = 0.0\n self.fcqs.compact.each {|x| next if x.avg_grd == nil; total += x.avg_grd}\n count = courses_taught\n if count == 0\n return 1.0 \n else\n return (total.to_f / count.to_f)\n end\n end",
"def calculate_average\n return 0 unless reviews.size.positive?\n avg = self.reviews.average(:rating) #.to_f.round(2) # * 100\n update_column(:rating, avg)\n end",
"def average_score\n return nil if metrics.empty?\n totals = grades.includes(:subject).group_by(&:subject).map { |_, grades|\n grades.sum(&:weighted_score) }\n return 0 if totals.empty?\n totals.sum.to_f / totals.length\n end",
"def average_rating\n return 0 if self.ratings.empty?\n (self.ratings.inject(0){|total, rating| total += rating.score }.to_f / self.ratings.size )\n end",
"def current_average\n earned = self.current_points\n possible = self.section.points_assigned\n \n (earned.to_f / possible)*100\n end",
"def average_rating(&block)\n total = 0\n countable_ratings = block ? ratings.select(&block) : ratings\n countable_ratings.each do |rating|\n total += rating.rating\n end\n average_rating = countable_ratings.empty? ? 0 : (0.0 + total) / countable_ratings.size\n # only 1 decimal.\n [(0.0 + (average_rating * 10).round) / 10, countable_ratings.size]\n end",
"def calc_modified_average(score_list)\n sum = 0;\n calc_size = score_list.size\n calc_size = (4 + (calc_size-4)/2) if (calc_size > 5)\n\n calc_size.times do |score|\n sum += score_list[score]\n end\n (sum / calc_size)\n end",
"def assignment_average_score(grade_hash, assignment_num)\n marks = assignment_scores(grade_hash, assignment_num)\n marks.sum / marks.length\nend",
"def average_assignment_score\n assignment_average_scores.inject(:+).to_f/num_assignments\n rescue ZeroDivisionError\n 0\n end",
"def update_score\n sum = 0.0\n total = 0.0\n ratings.each do |rating|\n vp = User.find(rating.user_id).voting_power \n sum = sum + rating.score * vp\n total = total + vp\n end\n average = sum / total\n variance = ratings.inject(0.0){ |sum, element| sum + \n (element.score - average) ** 2 }\n penalty = Math.log10((variance / ratings.size) + 1) + 1.0;\n update_attribute(:score, average / penalty)\n end",
"def average_rating\n if ratings.where(\"score > 0\").size != 0\n\t\tratings.where(\"score > 0\").sum(:score) / ratings.where(\"score > 0\").size\n\telse\n\t\t0\n\tend\n end",
"def update_reviews_average(score)\n self.reviews_average = calculate_reviews_average(score)\n self.reviews_count += 1\n self.save\n end",
"def avg_rating\n @avg = self.ratings.average(:rating) \n @avg ? @avg : 0\n end",
"def get_avg\n recentReviewed = get_user_cards(Result.all)\n filteredDates = get_dates(recentReviewed)\n totalScore = filteredDates.reduce(0) {|curr,n| curr + n.score} \n totalScore/filteredDates.count \n end",
"def update_school_avg_score\n # Below - Makes sure the review is scorable for the city\n department_reviews = self.department_reviews.select do |review| \n review.is_scorable_review? == true\n end \n # Makes sure to update only when department_reviews is not empty\n unless department_reviews.empty?\n update_attributes(score: department_reviews.collect(&:score).average) \n end \n end",
"def overall_rating\n\t\ttotal_score = 0\n\t\ttotal_score += self.setting \n\t\ttotal_score += self.hotness\n\t\ttotal_score += self.originality\n\t\ttotal_score += self.style\n\t\ttotal_score += self.attitude\n\t\treturn total_score / 5\n\tend",
"def average_score\n responses = Response.all\n sum = 0\n count = 0\n\n responses.each do |response|\n r_summary = response.summarize\n if r_summary[self.name][:nrm]\n sum += r_summary[self.name][:nrm]\n count += 1\n end\n end\n\n return (sum/count).round\n end",
"def average_rating\n rating && rating.average_rating || 0.0\n end",
"def average\n\t\tif 2 < course.users.length and 0 < grades.length and 0 < worth\n\t\t\taverage = 0\n\t\t\tgrades = 0\n\n\t\t\tcourse.users.each do |user|\n\t\t\t\tgrade = self.user_grade(user)\n\t\t\t\t\n\t\t\t\tif grade\n\t\t\t\t\taverage = average + grade\n\t\t\t\t\tgrades = grades + 1\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn average / grades\n\t\tend\n\tend",
"def average_rating\n\n all_ratings = self.reviews.to_a.map do |review|\n review.rating\n end\n\n return 0 unless all_ratings.length > 0\n\n all_ratings.sum / all_ratings.length\n end",
"def average_rating\n (ratings.sum(:rating).to_f / num_ratings).round(1)\nend",
"def average_rating\n ratings.present? ? (ratings.map(&:score).sum.to_f) / ratings.count : nil\n end",
"def calculate_average_rating\n self.average_rating = ((self.content_rating.to_f + self.recommend_rating.to_f) / 2).round(1)\n end",
"def assignment_average_score(grade_hash, assignment_score)\n sum = 0\n grade_hash.each do |key, value|\n sum += value[assignment_score - 1]\n end\n average = sum / grade_hash.keys.length\n average\nend",
"def average_rating\n self.reviews.sum(:score) / reviews.size\n rescue ZeroDivisionError\n 0\n end",
"def average_income; end",
"def average_score(review_criterion = nil)\n return reviewers.without_committee_scores.collect{|r| r.get_score(review_criterion)}.compact.reject{|s| s.zero?}.average unless review_criterion.nil?\n @average_score ||= reviewers.without_committee_scores.collect(&:total_score).compact.reject{|s| s.zero?}.average\n end",
"def assignment_average_score(grade_hash, assignment_num)\n a = []\n grade_hash.values.each { |dude| a.push(dude[assignment_num - 1]) }\n sum = a.sum\n average = sum/a.length\nend",
"def average_rating(assignment)\n # team = self.teams.find(team_id)\n # feedback = team.feedbacks.all.where(:receiver_id => self.user_id)\n feedback = assignment.feedbacks.where(:receiver_id => self.user_id)\n average = 0\n for f in feedback\n average += f.rating\n end\n if feedback.length != 0\n average = average/feedback.length\n average.to_s\n else\n 'N/A'\n end\n end",
"def average_rating\n total = 0\n self.reviews.each do |review|\n total += review.rating\n end\n average = total.to_f / self.reviews.count\n end",
"def average_rating\n ratings\n .average(:rating)\n .to_f\n .round(2)\n end",
"def average_rating_round\n average_rating.round\n end",
"def get_average assignment_num\n assignment = Assignment.find_by(number: assignment_num)\n actual_attachments = assignment.corrections\n\n if assignment.finished_mandatory_stages?\n average = 0\n size = 0\n actual_attachments.each do |a|\n if (a.score != -1) \n average += a.score\n size += 1\n end\n end\n\n average = (average/size).round(2)\n return average\n end\n end",
"def recalculate_average()\n\n #find total of all review ratings by iterating through them\n total = 0\n self.reviews.each do |review|\n total = total + review.rating\n end\n\n newAvg = total / self.reviews.size\n\n self.update_attribute(:avg_rating, newAvg)\n end",
"def grade_average\n @grades.inject(:+) / @grades.size\n end",
"def average_rating_round\n\t\t\t\t\taverage_rating.round\n\t\t\t\tend",
"def average_rating\n ratings.inject(0.0) {|sum, num| sum +=num} / ratings.length\n end",
"def calculate_average_ratings\n total_reviews = self.reviews.count\n\n quality_total = 0\n study_total = 0\n laptop_total = 0\n hipster_total = 0\n\n self.reviews.each { |review| quality_total += review.qualityRating }\n self.reviews.each { |review| study_total += review.studyRating }\n self.reviews.each { |review| laptop_total += review.laptopRating }\n self.reviews.each { |review| hipster_total += review.hipsterRating }\n\n if total_reviews > 0\n self.average_hipster = hipster_total / total_reviews\n self.average_study = study_total / total_reviews\n self.average_laptop = laptop_total / total_reviews\n self.average_quality = quality_total / total_reviews\n self.overall_average = (average_hipster + average_study + average_laptop + average_quality)/4\n end\n self.save\n end",
"def average_ratings\n ratings = 0\n self.ratings.each {|r| ratings += r.score}\n avg = votes == 0 ? 0 : ratings.to_f/votes.to_f\n \"%.1f\" % avg\n end",
"def average_ratings\n ratings = 0\n self.ratings.each {|r| ratings += r.score}\n avg = votes == 0 ? 0 : ratings.to_f/votes.to_f\n \"%.1f\" % avg\n end",
"def update_police_avg_score\n # Below - Makes sure the review is scorable for the city\n department_reviews = self.department_reviews.select do |review| \n review.is_scorable_review? == true\n end \n # Makes sure to update only when department_reviews is not empty\n unless department_reviews.empty?\n update_attributes(score: department_reviews.collect(&:score).average) \n end \n end",
"def cal_mean\n sum = @data.inject(0) do |accu, hash|\n accu + hash[:prediction] - hash[:rating]\n end\n sum.to_f / @data.size\n end",
"def assignment_average_score(grade_hash, assignment_num)\n assignment_score = grade_hash.map do |key, value|\n value [assignment_num - 1]\n end\n total = assignment_score.reduce do |total, grade|\n total += grade\n end\n total / assignment_score.length\nend",
"def assignment_average_score(grade_hash, assignment_num)\n (grade_hash.values.transpose[assignment_num - 1].reduce { |acc, num| acc + num }.to_f / 10).floor\nend",
"def get_summary_score\n\t\t(self.taste_score + self.value_score + self.on_time_score)/3\n\tend",
"def assignment_average_score(grade_hash, assignment_num)\n assignment = grade_hash.map do |key, value|\n value[assignment_num - 1]\n end\n\n sum = assignment.reduce do |sum, x|\n sum += x\n end\n\n sum / assignment.length\nend",
"def average_rating\n feedbacks = Feedback.submitted.where(\"project_id in (?)\", self.projects.pluck(:id))\n if feedbacks.count >= 1\n sum = 0\n feedbacks.each do |feedback|\n sum += feedback.rating\n end\n average_rating = (sum.to_f() / feedbacks.count).round(1)\n #return 1, 2, 3, or 4 based on average_rating\n if average_rating > 0 and average_rating <= 2.5\n average_rating = 1\n elsif average_rating > 2.5 and average_rating <= 5.0\n average_rating = 2\n elsif average_rating > 5.0 and average_rating <= 7.5\n average_rating = 3\n elsif average_rating > 7.5 and average_rating <= 10.0\n average_rating = 4\n end\n else\n average_rating = 0\n end\n average_rating\n end",
"def average_rating\n if events.any?\n scores =[]\n events.each do |e|\n valid_ratings = e.ratings.valid_only\n if valid_ratings.any?\n scores << valid_ratings.map {|r| r.score}.sum / valid_ratings.size\n end\n end\n scores.sum/scores.size.to_f\n else\n 0\n end\n end",
"def gradeAVG(scores)\n sum = 0\n scores.each do |grade|\n sum += grade\n end\n average = sum / (scores.length)\n return average\nend",
"def average_rating\n if reviews.count > 0\n ratings = reviews.map { |review| review.rating }\n sum = ratings.reduce(:+)\n if sum > 0\n average = sum / ratings.count\n average.round(1)\n else\n return 0\n end\n else\n return 0\n end\n end",
"def assignment_average_score(grade_hash, assignment_num)\n assignment = grade_hash.map {|x| x[1][assignment_num-1]}\n average = assignment.reduce{|x,n| x += n}/assignment.length\nend",
"def avg_reviews\n @avg = self.reviews.average(:rating) \n @avg ? @avg : 0\nend",
"def get_average(total_rating, rides)\n\n if rides > 0\n average = total_rating.to_f / rides\n else\n average = 0\n end\n return average\n\nend",
"def avg_rating\n @reviews = @product.reviews\n @avg_rating = nil\n\n if @reviews.size > 0\n @avg_rating = (@reviews.inject(0.0) { |sum, el| sum + el.rating }.to_f / @reviews.size).round(1)\n end\n end",
"def average_rating\n return 'n/a' if reviews.empty?\n #return 0 if reviews.empty?\n (reviews.pluck(:rating).sum / reviews.count.to_f).round(2)\n end",
"def average_rating\r\n comments.average(:rating).to_f\r\n end",
"def average_rating_round\n average_rating.round\n end",
"def average_rating\n avgrev = reviews.average(:rating)\n \n if avgrev == 0 || avgrev.nil?\n avgrev = 0\n else\n avgrev \n end\n end",
"def rate_average_price_earnings_ratio(per)\n sum = per.value_three_years_ago + per.value_two_years_ago + per.value_last_year + per.value_this_year + per.value_next_year\n avg = sum / 5\n case \n when avg < 12\n score = 1\n when avg > 16\n score = -1\n else\n score = 0\n end\n per.average = avg\n per.score = score\n return score\n end",
"def overall\n avg = @difficulty = @mood = @teaching_skills = 0.0\n @exams_difficulty = @helpfulness = 0.0\n count = 0 + sections.count\n count = 1 if count.zero?\n sections.each do |section|\n avg += section.professor_overall\n @difficulty += section.professor_difficulty\n @teaching_skills += section.professor_teaching\n @mood += section.professor_mood\n @exams_difficulty += section.professor_exam\n @helpfulness += section.professor_helpfulness\n end\n\n @difficulty /= count\n @teaching_skills /= count\n @mood /= count\n @exams_difficulty /= count\n @helpfulness /= count\n avg / count\n end",
"def average_grade_overall\n return self.data[\"average_grade\"]\n end",
"def average_rating_percent\n f = 100 / max_rating.to_f\n average_rating * f\n end",
"def average_rating\n guest_reviews.count == 0 ? 0 : guest_reviews.average(:star).round(2).to_i\n end",
"def score\n\t\treviews.length > 1 ? 5 + (avg_rating-2.5)*2*rating_factor : -1\n\tend",
"def update_avg_score\n department.update_department_score # Calls the \"update_score\" method in Departments' Model's callbacks.\n end",
"def get_average_rating(driver_id)\n\n sum = RIDE_SHARES[driver_id].sum do |rides|\n rides[:rating]\n end\n\n return (sum.to_f / RIDE_SHARES[driver_id].length * 10).floor / 10.0\n\nend",
"def average_rating\n return 'N/A' if reviews.none?\n reviews.inject(0) {|memo, review| memo + review.rating} / reviews.length\n end",
"def average_points\n if ratings.count > 0\n ratings.collect(&:points).sum / ratings.count\n else\n 0\n end\n end",
"def average_ratings\n ratings.average(:int_value)\n end",
"def average_rating\n reviews.average(:rating)\n end",
"def average\n (max + min) / 2.0\n end",
"def average_rating\n if driven_trips.length == 0\n return 0\n else\n completed_trips = driven_trips.reject {|trip| trip.rating.nil?}.map{|item| item.rating}\n return completed_trips.sum.to_f / completed_trips.length\n end\n end",
"def weighted_score(score, avg_score)\n #add if statement if score is 0\n if(score==0)\n return\n end\n return (avg_score + 215)/score\n end"
] | [
"0.77737933",
"0.77653176",
"0.7504421",
"0.73262286",
"0.7214694",
"0.7189772",
"0.68438995",
"0.671789",
"0.669527",
"0.6686515",
"0.6658387",
"0.6647913",
"0.66439736",
"0.66366506",
"0.6558271",
"0.6540636",
"0.6531642",
"0.6530246",
"0.6506144",
"0.6443557",
"0.6440802",
"0.6426729",
"0.64219105",
"0.64110553",
"0.6386603",
"0.63856435",
"0.63720715",
"0.6349335",
"0.6345113",
"0.6306307",
"0.6304567",
"0.6293874",
"0.626736",
"0.6262752",
"0.6254189",
"0.6251555",
"0.6249968",
"0.6225668",
"0.62161577",
"0.62065274",
"0.62041885",
"0.6199855",
"0.6189985",
"0.61850864",
"0.61508083",
"0.6150158",
"0.61302274",
"0.61248606",
"0.60961884",
"0.60958326",
"0.60916567",
"0.608834",
"0.6075867",
"0.6071214",
"0.606497",
"0.6062132",
"0.606151",
"0.60516036",
"0.60470736",
"0.6035406",
"0.603186",
"0.60261744",
"0.6004242",
"0.600098",
"0.5993483",
"0.5993451",
"0.5993451",
"0.5989464",
"0.5986622",
"0.59705263",
"0.5969927",
"0.5967197",
"0.59665096",
"0.5962411",
"0.5961707",
"0.59605944",
"0.5940804",
"0.5936492",
"0.5935512",
"0.5935392",
"0.5932527",
"0.5926449",
"0.59263",
"0.5922853",
"0.59162605",
"0.5909354",
"0.5903351",
"0.5892127",
"0.58919865",
"0.5886357",
"0.58854824",
"0.5885142",
"0.5880864",
"0.58777374",
"0.5869859",
"0.5868488",
"0.58665967",
"0.5864078",
"0.5854998",
"0.5850935"
] | 0.6695157 | 9 |
GET /varietywines GET /varietywines.json | def index
@varietywines = Varietywine.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @variety = Variety.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @variety }\n end\n end",
"def index\n @wine_varieties = WineVariety.all\n end",
"def index\n @varieties = Variety.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @varieties }\n end\n end",
"def show\n @wine = Wine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wine }\n end\n end",
"def wines\n client = Square::Client.new(\n access_token: Figaro.env.square_api_key,\n environment: 'production'\n )\n\n result = client.catalog.list_catalog(\n types: \"ITEM\"\n )\n \n if result.success?\n wines = result.data[0].filter {|item| item[:item_data][:name].start_with?(\"20\")}\n wine_data = wines.map do |wine|\n price = wine[:item_data][:variations][0][:item_variation_data][:price_money][:amount]\n {\n \"name\": wine[:item_data][:name],\n \"price\": price\n }\n end\n render json: wine_data.to_json\n elsif result.error?\n warn result.errors\n end\n end",
"def show\n @wine_type = WineType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wine_type }\n end\n end",
"def index\n @wines = handle_sorting(:wine, :vintage, :name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wines }\n end\n end",
"def show\n @venue = Venue.find(params[:id])\n\n render json: @venue\n end",
"def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end",
"def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end",
"def show\n @nightclub = Nightclub.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nightclub }\n end\n end",
"def show\n @county = County.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @county }\n end\n end",
"def index\n @specialties = Specialty.all\n\n render json: @specialties\n end",
"def index\n @loves = Love.all\n render json: @loves\n end",
"def index\n @sightings = Sighting.all\n render json: @sightings\n end",
"def get_json(state, city)\n HTTParty.get(\"http://api.wunderground.com/api/b0938627f87459c4/conditions/q/#{state}/#{city}.json\").parsed_response\nend",
"def show\r\n @venue = Venue.fetch(params[:id])\r\n render json: @venue\r\n end",
"def new\n @variety = Variety.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @variety }\n end\n end",
"def index\n @witnesses = Witness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @witnesses }\n end\n end",
"def show\n\n @venue = Venue.find(params[:id])\n render :json => @venue, \n :methods => [:average_rating,:user_count],\n :include => [:venue_photos,:parties]\n end",
"def index\n @wines = Wine.all\n end",
"def show\n @wine = Wine.find(params[:id])\n @bottlings = Bottling.find_all_by_wine_id(params[:id]).sort_by! {|b| b.bottle_size[0..-3].to_i }\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wine }\n end\n end",
"def index\n weathers = Weather.all\n render json: weathers, status: 200\n end",
"def show\n @mood = Mood.find(params[:id])\n respond_to do |format|\n format.any { render :json => @mood }\n end\n end",
"def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end",
"def show\n animal = Animal.find(params[:id])\n #return all the sightings for the animal\n render json: animal.to_json(include: :sightings)\nend",
"def foods_units\n get('/foods/units.json')\n end",
"def set_varietywine\n @varietywine = Varietywine.find(params[:id])\n end",
"def interesting(options = {})\n response = Typhoeus::Request.get(\"#{DARKSKY_API_URL}/interesting/#{@api_key}\", DEFAULT_OPTIONS.dup.merge(options))\n JSON.parse(response.body) if response.code == 200 \n end",
"def show\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venue }\n end\n end",
"def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end",
"def show\n @love = Love.find(params[:id])\n render json: @love\n end",
"def show\n render json: @wellist\n end",
"def index\n @winners = Winner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @winners }\n end\n end",
"def show\n @forecast_wsize = ForecastWsize.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @forecast_wsize }\n end\n end",
"def index\n @curriculum_vitaes = findable_curriculum_vitaes.all\n respond_to do |format|\n format.html {}\n format.json { render json: @curriculum_vitaes }\n end\n end",
"def index\n @venues = Venue.all :conditions=>{:display=>true}, :origin=>[params[:lat].to_f, params[:lng].to_f], :within=>30\n\n respond_to do |format|\n #format.html # index.html.erb\n format.json { render :json => @venues.to_json(:except=>[:display, :user_id, :modified_user_id]), :callback=>params[:callback] }\n end\n end",
"def show\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @venue }\n end\n end",
"def show\n render \"api/v1/bounties/show\"\n end",
"def show\n @paper_venue = PaperVenue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @paper_venue }\n end\n end",
"def show\n render json: @tenure\n end",
"def index\n @movers = Mover.all\n\n render json: @movers\n end",
"def show\n render json: @sighting\n end",
"def show\n @kitchen = Kitchen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kitchen }\n end\n end",
"def show\n @mostsmallroad = Mostsmallroad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallroad }\n end\n end",
"def index\n @twenties = Twenty.all\n end",
"def dayIndex\n render json: Restaurant.restaurantsDay\n end",
"def set_wine_variety\n @wine_variety = WineVariety.find(params[:id])\n end",
"def planets\n data = JSON.parse(open(\"http://swapi.co/api/planets\").read)\n @results = data[\"results\"]\n end",
"def new\n @wine = Wine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wine }\n end\n end",
"def new\n @wine = Wine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wine }\n end\n end",
"def show\n @place = Venue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end",
"def show\n animal = Animal.find(params[:id])\n render json: animal.as_json(include: :sightings) \n end",
"def index\n @guests = @wedding.guests.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guests }\n end\n end",
"def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end",
"def index\n @weddings = Wedding.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weddings }\n end\n end",
"def index\n @forecast_wsizes = ForecastWsize.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @forecast_wsizes }\n end\n end",
"def index\n @given_circumstances = GivenCircumstance.all\n render json: @given_circumstances\n end",
"def show\n @thermo_oil_production = ThermoOilProduction.find(params[:id])\n @thermo_oil_production_years = ThermoOilProductionYear.find_all_by_thermoOilProduction_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @thermo_oil_production }\n end\n end",
"def index\n @whoarewes = Whoarewe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @whoarewes }\n end\n end",
"def rating(food)\n url = 'https://thereportoftheweek-api.herokuapp.com/reports'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n result = JSON.parse(response)\n puts result[7]['product']\n \n end",
"def show\n @zombie_sighting = ZombieSighting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zombie_sighting }\n end\n end",
"def index\n @universes = Universe.all.page(params[:page]).per(25)\n respond_to do |format|\n format.html\n format.json { render json: @universes }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venue }\n end\n end",
"def index\n @cloth_measures = ClothMeasure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cloth_measures }\n end\n end",
"def show\n @governor = Governor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @governor }\n end\n end",
"def show\n @official_tenure = OfficialTenure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @official_tenure }\n end\n end",
"def index\n @carbon_monoxides = CarbonMonoxide.all\n render json: @carbon_monoxides\n end",
"def index\n @nepals = Nepal.all\n\n render json: @nepals\n end",
"def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end",
"def show\n\n\n # respond_to do |format|\n # format.html # show.html.erb\n # format.json { render json: @venue }\n # end\n end",
"def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end",
"def vitals\n raise UserNotAuthenticated unless access_token\n\n get('records/vitals')\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @neuropsychologist }\n end\n end",
"def show\n @tenure = Tenure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tenure }\n end\n end",
"def index\n @illnesses = Illness.all\n\n render json: @illnesses\n end",
"def get\n\t\t\t result = Status.find_by(windmillid: params[:windmillid]) \n \t\t\trender json: [result.as_json(only: [:status,:power,:gen,:frequency,:rotor,:wind,:pitch])]\n\tend",
"def index\n @vhours = Vhour.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vhours }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mood }\n end\n end",
"def index\n @harvestings = Harvesting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @harvestings }\n end\n end",
"def index\n sighting = Sighting.all \n render json: SightingSerializer.new(sighting)\n end",
"def index\n @livingexpenses = Livingexpense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @livingexpenses }\n end\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @life_insurances }\n end\n end",
"def index\n @daily_horoscopes = DailyHoroscope.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @daily_horoscopes }\n end\n end",
"def show\n render json: @pizza\n end",
"def corona_virus\n # endpoint = \"https://corona.lmao.ninja/all\"\n endpoint = 'https://corona.lmao.ninja/v2/all'\n response = HTTParty.get(endpoint)\n data = JSON.parse response.body\n res = data\n result = []\n result<<{\n country: \"world\",\n cases: res[\"cases\"],\n todayCases: res[\"todayCases\"],\n deaths: res[\"deaths\"],\n todayDeaths: res[\"todayDeaths\"],\n recovered: res[\"recovered\"],\n active: res[\"active\"],\n critical: res[\"critical\"],\n casesPerOneMillion: res[\"casesPerOneMillion\"],\n deathsPerOneMillion: res[\"deathsPerOneMillion\"],\n tests: res[\"tests\"],\n testsPerOneMillion: res[\"testsPerOneMillion\"],\n affectedCountries: res[\"affectedCountries\"]\n }\n render json: result\n end",
"def weekIndex\n render json: Restaurant.restaurantsWeek\n end",
"def index\n @neighborhoods = Neighborhood.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @neighborhoods }\n end\n end",
"def index\n @petty_cash_expenses = PettyCashExpense.all\n render json: @petty_cash_expenses\n end",
"def show\n @daily_horoscope = DailyHoroscope.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @daily_horoscope }\n end\n end",
"def index\n @places = @site.places.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @places }\n end\n end",
"def show\n @neighborhood = Neighborhood.find(params[:id])\n\n render json: @neighborhood\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 show\n @county = Entity.where(id: params[:id]).where(entity_type: 'County').first\n respond_with(@county) do |format|\n format.geojson { render text: @county.to_geojson }\n end\n end",
"def show\n render json: @petty_cash_expense\n end",
"def show\n render json: @vat\n end",
"def show\n render json: @given_circumstance\n end",
"def index\n @harvests = Harvest.all\n @upcoming_harvests = Harvest.upcoming\n @past_harvests = Harvest.past\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @harvests }\n end\n end",
"def create\n @wine_variety = WineVariety.new(wine_variety_params)\n\n respond_to do |format|\n if @wine_variety.save\n format.html { redirect_to @wine_variety, notice: \"Wine variety was successfully created.\" }\n format.json { render :show, status: :created, location: @wine_variety }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @wine_variety.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n if params[:q]\n url = \"http://api.worldweatheronline.com/premium/v1/tz.ashx?q=#{params[:q]}&format=json&key=2c46659bd90a41a0bcf132257162410\"\n @json = ActiveSupport::JSON.decode(open(url).read)\n else\n end\n end"
] | [
"0.68413544",
"0.6764539",
"0.6636776",
"0.6258745",
"0.6257708",
"0.6160771",
"0.61144173",
"0.60796636",
"0.60672235",
"0.60672235",
"0.6063725",
"0.60499007",
"0.60467",
"0.6041673",
"0.60164225",
"0.60097885",
"0.60019594",
"0.5997341",
"0.5968229",
"0.59652334",
"0.5963824",
"0.5948338",
"0.5926077",
"0.5922314",
"0.5913947",
"0.59094244",
"0.590402",
"0.58954054",
"0.58784133",
"0.58724934",
"0.5868133",
"0.5850743",
"0.58463657",
"0.5845802",
"0.5844961",
"0.5839542",
"0.58362335",
"0.58342814",
"0.5834242",
"0.58325803",
"0.5829415",
"0.5824498",
"0.5824036",
"0.5811815",
"0.58083373",
"0.5796225",
"0.578486",
"0.5776265",
"0.57748353",
"0.57606757",
"0.57606757",
"0.5760416",
"0.57603985",
"0.5759146",
"0.5757759",
"0.5751342",
"0.5750258",
"0.5746422",
"0.5731156",
"0.5726502",
"0.5724974",
"0.57242894",
"0.5722514",
"0.57210976",
"0.57191104",
"0.57175624",
"0.5711481",
"0.5707346",
"0.5702575",
"0.5700357",
"0.5699914",
"0.56891435",
"0.56815964",
"0.56812036",
"0.5676233",
"0.56671315",
"0.56629974",
"0.566075",
"0.5657138",
"0.5655393",
"0.5650432",
"0.56451476",
"0.5644088",
"0.5642989",
"0.56403714",
"0.5637049",
"0.5636431",
"0.56357455",
"0.56353855",
"0.56347656",
"0.56296146",
"0.5628021",
"0.56274295",
"0.5621155",
"0.5618631",
"0.5615657",
"0.56137407",
"0.5613109",
"0.5607578",
"0.56066275"
] | 0.7008238 | 0 |
GET /varietywines/1 GET /varietywines/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @variety = Variety.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @variety }\n end\n end",
"def index\n @varietywines = Varietywine.all\n end",
"def index\n @varieties = Variety.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @varieties }\n end\n end",
"def index\n @wine_varieties = WineVariety.all\n end",
"def show\n @wine = Wine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wine }\n end\n end",
"def show\n @wine_type = WineType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wine_type }\n end\n end",
"def show\n @county = County.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @county }\n end\n end",
"def new\n @variety = Variety.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @variety }\n end\n end",
"def show\n @nightclub = Nightclub.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nightclub }\n end\n end",
"def show\n @venue = Venue.find(params[:id])\n\n render json: @venue\n end",
"def show\r\n @venue = Venue.fetch(params[:id])\r\n render json: @venue\r\n end",
"def show\n @mood = Mood.find(params[:id])\n respond_to do |format|\n format.any { render :json => @mood }\n end\n end",
"def show\n @kitchen = Kitchen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kitchen }\n end\n end",
"def index\n @specialties = Specialty.all\n\n render json: @specialties\n end",
"def show\n @mostsmallroad = Mostsmallroad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallroad }\n end\n end",
"def set_varietywine\n @varietywine = Varietywine.find(params[:id])\n end",
"def show\n @forecast_wsize = ForecastWsize.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @forecast_wsize }\n end\n end",
"def show\n @official_tenure = OfficialTenure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @official_tenure }\n end\n end",
"def show\n @love = Love.find(params[:id])\n render json: @love\n end",
"def show\n render \"api/v1/bounties/show\"\n end",
"def show\n @wine = Wine.find(params[:id])\n @bottlings = Bottling.find_all_by_wine_id(params[:id]).sort_by! {|b| b.bottle_size[0..-3].to_i }\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wine }\n end\n end",
"def index\n @witnesses = Witness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @witnesses }\n end\n end",
"def index\n weathers = Weather.all\n render json: weathers, status: 200\n end",
"def show\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venue }\n end\n end",
"def show\n @governor = Governor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @governor }\n end\n end",
"def show\n @thermo_oil_production = ThermoOilProduction.find(params[:id])\n @thermo_oil_production_years = ThermoOilProductionYear.find_all_by_thermoOilProduction_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @thermo_oil_production }\n end\n end",
"def show\n @tenure = Tenure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tenure }\n end\n end",
"def show\n animal = Animal.find(params[:id])\n #return all the sightings for the animal\n render json: animal.to_json(include: :sightings)\nend",
"def set_wine_variety\n @wine_variety = WineVariety.find(params[:id])\n end",
"def show\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @venue }\n end\n end",
"def index\n @wines = handle_sorting(:wine, :vintage, :name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wines }\n end\n end",
"def show\n @weather = Weather.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weather }\n end\n end",
"def show\n @weather = Weather.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weather }\n end\n end",
"def get_json(state, city)\n HTTParty.get(\"http://api.wunderground.com/api/b0938627f87459c4/conditions/q/#{state}/#{city}.json\").parsed_response\nend",
"def show\n @therapist = Therapist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @therapist }\n end\n end",
"def new\n @wine = Wine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wine }\n end\n end",
"def new\n @wine = Wine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wine }\n end\n end",
"def show\n @paper_venue = PaperVenue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @paper_venue }\n end\n end",
"def show\n @cloth_measure = ClothMeasure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cloth_measure }\n end\n end",
"def index\n @loves = Love.all\n render json: @loves\n end",
"def show\n @zombie_sighting = ZombieSighting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zombie_sighting }\n end\n end",
"def show\n @county = Entity.where(id: params[:id]).where(entity_type: 'County').first\n respond_with(@county) do |format|\n format.geojson { render text: @county.to_geojson }\n end\n end",
"def show\n animal = Animal.find(params[:id])\n render json: animal.as_json(include: :sightings) \n end",
"def show\n render json: @tenure\n end",
"def show\n @daily_horoscope = DailyHoroscope.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @daily_horoscope }\n end\n end",
"def show\r\n\r\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/#{params[:id]}/information\")\r\n\r\n http = Net::HTTP.new(url.host, url.port)\r\n http.use_ssl = true\r\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n request = Net::HTTP::Get.new(url)\r\n request[\"x-rapidapi-key\"] = ENV[\"SPOONACULAR_API_KEY\"] # hidden API key\r\n request[\"x-rapidapi-host\"] = 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com'\r\n\r\n response = http.request(request)\r\n @recipe = JSON.parse response.read_body # gets the recipe\r\n\r\n p url_ingredients = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/#{params[:id]}/ingredientWidget.json\")\r\n\r\n http_ingredients = Net::HTTP.new(url_ingredients.host, url_ingredients.port)\r\n http_ingredients.use_ssl = true\r\n http_ingredients.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n request_ingredients = Net::HTTP::Get.new(url_ingredients)\r\n request_ingredients[\"x-rapidapi-key\"] = ENV[\"SPOONACULAR_API_KEY\"]\r\n request[\"x-rapidapi-host\"] = 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com'\r\n\r\n response_ingredients = http.request(request_ingredients)\r\n # puts response_ingredients.read_body\r\n @ingredients = JSON.parse # data is a string (which looks like a hash -> convert to hash) response_ingredients.read_body\r\n p \"RECIPES\"\r\n # p @recipe\r\n p \"INGREDIENTS\"\r\n p @ingredients\r\n\r\n end",
"def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end",
"def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end",
"def show\n hub = Hub.find(params[:id])\n respond_to do |format|\n format.json { render :json => hub.warehouses }\n end\n end",
"def show\n @steam_consumption = SteamConsumption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @steam_consumption }\n end\n end",
"def show\n @vocalium = Vocalium.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @vocalium }\n end\n end",
"def show\n @place = Venue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end",
"def show\n\n @venue = Venue.find(params[:id])\n render :json => @venue, \n :methods => [:average_rating,:user_count],\n :include => [:venue_photos,:parties]\n end",
"def index\n @wines = Wine.all\n end",
"def show\n @idiom = Idiom.find(params[:id])\n @essays = Essay.where(idiom_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idiom }\n end\n end",
"def show\n @economia4 = Economia4.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @economia4 }\n end\n end",
"def index\n @sightings = Sighting.all\n render json: @sightings\n end",
"def show\n @genotype = Genotype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @genotype }\n end\n end",
"def show\n @food = Food.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food }\n end\n end",
"def wines\n client = Square::Client.new(\n access_token: Figaro.env.square_api_key,\n environment: 'production'\n )\n\n result = client.catalog.list_catalog(\n types: \"ITEM\"\n )\n \n if result.success?\n wines = result.data[0].filter {|item| item[:item_data][:name].start_with?(\"20\")}\n wine_data = wines.map do |wine|\n price = wine[:item_data][:variations][0][:item_variation_data][:price_money][:amount]\n {\n \"name\": wine[:item_data][:name],\n \"price\": price\n }\n end\n render json: wine_data.to_json\n elsif result.error?\n warn result.errors\n end\n end",
"def show\n\n @food = Food.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food }\n end\n end",
"def show\n @neighborhood = Neighborhood.find(params[:id])\n\n render json: @neighborhood\n end",
"def show\n @subway = Subway.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subway }\n end\n end",
"def show\n render json: @wellist\n end",
"def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end",
"def rating(food)\n url = 'https://thereportoftheweek-api.herokuapp.com/reports'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n result = JSON.parse(response)\n puts result[7]['product']\n \n end",
"def show\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @specie }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @neuropsychologist }\n end\n end",
"def show\n @voc = Voc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voc }\n end\n end",
"def dayIndex\n render json: Restaurant.restaurantsDay\n end",
"def show\n render json: @sighting\n end",
"def show\n @industry = Industry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @industry }\n end\n end",
"def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end",
"def show\n @skydatum = Skydatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @skydatum }\n end\n end",
"def foods_units\n get('/foods/units.json')\n end",
"def show\n @types_of_apprenticeship = TypesOfApprenticeship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @types_of_apprenticeship }\n end\n end",
"def show\n @bowl = Bowl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bowl }\n end\n end",
"def get\n\t\t\t result = Status.find_by(windmillid: params[:windmillid]) \n \t\t\trender json: [result.as_json(only: [:status,:power,:gen,:frequency,:rotor,:wind,:pitch])]\n\tend",
"def show\n @sighting = Sighting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sighting }\n end\n end",
"def show\n @apprentice = Apprentice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apprentice }\n end\n end",
"def show\n @livingexpense = Livingexpense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @livingexpense }\n end\n end",
"def show\n @mostsmallconstruction = Mostsmallconstruction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallconstruction }\n end\n end",
"def show\n @ethnicity = Ethnicity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ethnicity }\n end\n end",
"def show\n @species = Specie.find(params[:id])\n\n @pets = Pet.where(:specie_id => @species).all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {:secie => @species, :pets => @pets } }\n end\n end",
"def index\n @twenties = Twenty.all\n end",
"def interesting(options = {})\n response = Typhoeus::Request.get(\"#{DARKSKY_API_URL}/interesting/#{@api_key}\", DEFAULT_OPTIONS.dup.merge(options))\n JSON.parse(response.body) if response.code == 200 \n end",
"def show\n @analyst = Analyst.find(params[:id])\n\n render json: @analyst\n end",
"def index\n @cloth_measures = ClothMeasure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cloth_measures }\n end\n end",
"def show\n @socioeconomic_study = SocioeconomicStudy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n\n\n format.json { render json: @socioeconomic_study }\n end\n end",
"def show\n @weather_item = WeatherItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weather_item }\n end\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def show\n @mostsmallitemequipinventory = Mostsmallitemequipinventory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallitemequipinventory }\n end\n end",
"def show\n @rainbow = Rainbow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rainbow }\n end\n end",
"def index\n @weddings = Wedding.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weddings }\n end\n end",
"def show\n @mostsmalltrapinfo = Mostsmalltrapinfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmalltrapinfo }\n end\n end",
"def show\n @grocery = Grocery.find(params[:id])\n\n render json: @grocery\n end",
"def show\n @monit = Monit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monit }\n end\n end",
"def new\n @bowl = Bowl.new\n @dry_fruits = DryFruit.all\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bowl }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venue }\n end\n end"
] | [
"0.7168075",
"0.68508166",
"0.66351855",
"0.6612036",
"0.65247285",
"0.64998865",
"0.6366099",
"0.6282597",
"0.6232104",
"0.6217918",
"0.6194829",
"0.6163426",
"0.61350125",
"0.61146665",
"0.6109532",
"0.6105179",
"0.6096924",
"0.60830396",
"0.60740215",
"0.6067888",
"0.6049387",
"0.60384464",
"0.6035393",
"0.60195404",
"0.60138357",
"0.6013526",
"0.599976",
"0.5998942",
"0.59983593",
"0.59878016",
"0.59856963",
"0.596495",
"0.596495",
"0.59589565",
"0.5955331",
"0.59501153",
"0.59501153",
"0.5941461",
"0.5926118",
"0.5925915",
"0.5916119",
"0.5914636",
"0.59146297",
"0.59110755",
"0.5904596",
"0.5898714",
"0.5898096",
"0.5898096",
"0.5891837",
"0.58873373",
"0.5883883",
"0.58793545",
"0.58744144",
"0.58700854",
"0.58690196",
"0.5867034",
"0.5851537",
"0.58508265",
"0.5845782",
"0.58378994",
"0.58316505",
"0.58312243",
"0.58311",
"0.5827454",
"0.58270127",
"0.582537",
"0.58233154",
"0.5819333",
"0.5805325",
"0.5803779",
"0.5801755",
"0.58016884",
"0.5801419",
"0.57989734",
"0.57980376",
"0.57877785",
"0.57857215",
"0.5781988",
"0.5781495",
"0.57801086",
"0.57798755",
"0.57792836",
"0.5778005",
"0.577788",
"0.5777167",
"0.57731247",
"0.5772721",
"0.5772473",
"0.5772452",
"0.5772354",
"0.57721484",
"0.57721484",
"0.57721484",
"0.5760926",
"0.5759489",
"0.5759228",
"0.5758745",
"0.5757974",
"0.5757767",
"0.57566565",
"0.5755172"
] | 0.0 | -1 |
POST /varietywines POST /varietywines.json | def create
@varietywine = Varietywine.new(varietywine_params)
respond_to do |format|
if @varietywine.save
format.html { redirect_to @varietywine, notice: 'Сорт вина успешно создан.' }
format.json { render :show, status: :created, location: @varietywine }
else
format.html { render :new }
format.json { render json: @varietywine.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @wine_variety = WineVariety.new(wine_variety_params)\n\n respond_to do |format|\n if @wine_variety.save\n format.html { redirect_to @wine_variety, notice: \"Wine variety was successfully created.\" }\n format.json { render :show, status: :created, location: @wine_variety }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @wine_variety.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @variety = Variety.new(params[:variety])\n @variety.company_id = current_user.company_id\n\n respond_to do |format|\n if @variety.save\n format.html { redirect_to varieties_path, notice: \"#{@variety.name} fue creada exitosamente.\" }\n format.json { render json: @variety, status: :created, location: @variety }\n else\n format.html { render action: \"new\" }\n format.json { render json: @variety.errors, status: :unprocessable_entity }\n end\n end\n end",
"def wine_variety_params\n params.require(:wine_variety).permit(:wine_id, :variety_id, :percentage)\n end",
"def create\n @variety = Variety.new(variety_params)\n\n respond_to do |format|\n if @variety.save\n format.html { redirect_to admin_varieties_path, notice: 'La variedad fue creada' }\n format.json { render :show, status: :created, location: @variety }\n format.js{}\n else\n format.html { render :new }\n format.js{}\n format.json { render json: @variety.errors, status: :unprocessable_entity }\n end\n end\n end",
"def varietywine_params\n params.require(:varietywine).permit(:name, :type_of_wine, :color, :aging_in_barrels, :aging_in_bottles,\n {relationships_attributes: [:_destroy, :id, :ratio,\n :grapesort_id, {grapesort_attributes: [:destroy, :id, :name, :place_of_production, :date_of_collection]}\n]}\n)\n end",
"def create\n @variety = Variety.new(variety_params)\n @product_id = params[:variety][:product_id]\n\n respond_to do |format|\n if @variety.save\n format.html { redirect_to @variety, notice: 'Variety was successfully created.' }\n format.json { render :show, status: :created, location: @variety }\n else\n format.html { render :new }\n format.json { render json: @variety.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @variety = Variety.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @variety }\n end\n end",
"def wine_params\n params.require(:wine).permit(:name, :input_region, :body, :sweetness, :sourness, :winetype_id, :year, {:winevariety_ids => []}, :score, :price, {:situation_ids => []}, :winery, :photo)\n end",
"def variety_params\n params.require(:variety).permit(:name)\n end",
"def wine_params\n params.require(:wine).permit(:name, :appellation, :varietal, :year, :tasting_id)\n end",
"def wine_params\n params.require(:wine).permit(:name, :producer, :varietal, tastingData:[\n :name,\n :clarity,\n :intensity_aromatics,\n :color,\n :observations,\n :condition,\n :intensity_palate,\n :aromas_primary,\n :aromas_secondary,\n :aromas_tertiary,\n :development,\n :alcohol,\n :sweetness,\n :acidity,\n :tannin,\n :body,\n :mousse,\n :intensity_flavor,\n :flavor_characteristics_primary,\n :flavor_characteristics_secondary,\n :flavor_characteristics_tertiary,\n :finish,\n :quality_level,\n :ageing_potential,\n \n ]\n\n )\n end",
"def create\n venture = Venture.new(venture_params)\n\n if venture.save \n render json: {venture: venture}, status: :created\n else\n render json: {status: 'Error', message: 'Venture not saved', data: venture.errors}, status: :unprocessable_entity\n end\n end",
"def create\n @wine_type = WineType.new(params[:wine_type])\n\n respond_to do |format|\n if @wine_type.save\n format.html { redirect_to @wine_type, notice: 'Wine type was successfully created.' }\n format.json { render json: @wine_type, status: :created, location: @wine_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wine_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_varietywine\n @varietywine = Varietywine.find(params[:id])\n end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"def set_wine_variety\n @wine_variety = WineVariety.find(params[:id])\n end",
"def index\n @varietywines = Varietywine.all\n end",
"def create\n @wine = Wine.new(params[:wine])\n\n respond_to do |format|\n if @wine.save\n format.html { redirect_to @wine, notice: 'Wine was successfully created.' }\n format.json { render json: @wine, status: :created, location: @wine }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wine = Wine.new(params[:wine])\n\n respond_to do |format|\n if @wine.save\n format.html { redirect_to @wine, notice: 'Wine was successfully created.' }\n format.json { render json: @wine, status: :created, location: @wine }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def wine_params\n params.require(:wine).permit(:brand, :nose, :taste, :varietal_id, :origin_id, :user_id)\n end",
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"def wine_params\n params.require(:wine).permit(:name, :comments, :disqualified, :vivino_score, :price, :year, :invoice, :contest, :grape_id, :contest_id, grape_ids: [])\n end",
"def create\n @wine = Wine.new(wine_params)\n \n respond_to do |format|\n if @wine.save\n format.html { redirect_to @wine, notice: 'Wine was successfully created.' }\n format.json { render :show, status: :created, location: @wine }\n else\n format.html { render :new }\n format.json { render json: @wine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wine = Wine.new(wine_params)\n\n respond_to do |format|\n if @wine.save\n format.html { redirect_to @wine, notice: 'Wine was successfully created.' }\n format.json { render :show, status: :created, location: @wine }\n else\n format.html { render :new }\n format.json { render json: @wine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wine_variety.update(wine_variety_params)\n format.html { redirect_to @wine_variety, notice: \"Wine variety was successfully updated.\" }\n format.json { render :show, status: :ok, location: @wine_variety }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @wine_variety.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @nightclub = Nightclub.new(params[:nightclub])\n\n respond_to do |format|\n if @nightclub.save\n format.html { redirect_to @nightclub, notice: 'Nightclub was successfully created.' }\n format.json { render json: @nightclub, status: :created, location: @nightclub }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nightclub.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product_variety = ProductVariety.new(product_variety_params)\n\n respond_to do |format|\n if @product_variety.save\n format.js\n format.html { redirect_to @product_variety, notice: 'Product variety was successfully created.' }\n format.json { render action: 'show', status: :created, location: @product_variety }\n else\n format.js\n format.html { render action: 'new' }\n format.json { render json: @product_variety.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wine = Wine.new(wine_params)\n\n respond_to do |format|\n if @wine.save\n format.html { redirect_to @wine, notice: 'Wine was successfully created.' }\n format.json { render action: 'show', status: :created, location: @wine }\n else\n format.html { render action: 'new' }\n format.json { render json: @wine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n if(!params[\"venue\"].blank?)\n Venue.save_multiple_venues(@curr_user,params[\"venue\"])\n @status=true\n else\n @status=false\n end\n respond_to do |format|\n if @status\n format.html { redirect_to :action=>:index }\n format.json { render :json => @venues, :status => :created, :location => @venues }\n else\n flash[:error] = 'Please select atleast one checkbox to create venue'\n format.html { redirect_to :action => \"search\"}\n end \n end\n end",
"def create\n @varience = Varience.new(varience_params)\n\n respond_to do |format|\n if @varience.save\n format.html { redirect_to @varience, notice: 'Varience was successfully created.' }\n format.json { render action: 'show', status: :created, location: @varience }\n else\n format.html { render action: 'new' }\n format.json { render json: @varience.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @society = Society.new(society_params)\n\n respond_to do |format|\n if @society.save\n format.html { redirect_to @society, notice: 'Se ha creado exitosamente.' }\n format.json { render :show, status: :created, location: @society }\n else\n format.html { render :new }\n format.json { render json: @society.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 wine_type_params\n params.require(:wine_type).permit(:type, :graphic_url, :food_id)\n end",
"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 varietal_count\n varietal_array = []\n # wine_array = [\"Malbec\", \"Merlot\", \"Syrah\", 'Cabernet Sauvignon', 'Pinot Noir', 'Grenache', 'Sangiovese', 'Tempranillo', 'Montepulcia', 'Petite Syrah', 'Chardonnay', 'Sauvignon blanc', 'Pinot Gris', 'Riesling', 'Semillon', 'Gewurztraminer', 'Chenin Blanc', 'Gruner Veltliner', 'Torrontes']\n country_iso_array = IsoCountryCodes.for_select.to_h\n variety = Wine.where(variety: params[:variety])\n # , \"Pinot Noir\", \"Merlot\", \"Malbec\", \"Syrah\",\"Chardonnay\",\"Sauvignon blanc\",\"Pinot Gris\",\"Riesling\",\"Pinot Noir\"]\n \n countries = []\n count_array = []\n new_hash = {}\n\n countries = variety.map do |wine| \n if wine.country === \"US\"\n country = \"United States of America\"\n country_iso_array[country]\n elsif wine.country === \"England\"\n country = \"United Kingdom of Great Britain and Northern Ireland\"\n country_iso_array[country]\n else \n country_iso_array[wine.country]\n end\n end \n\n \n count_array = countries.each_with_object(Hash.new(0)) {|k, v| v[k] += 1}\n new_array = []\n\n count_array.keys.each do |iso| \n if iso \n hash = {:country => iso, :value => count_array[iso]}\n new_array.push(hash)\n end\n end\n\n new_hash = {:isoCodes => new_array}\n render json: new_hash\n end",
"def create\n @nightclub = Nightclub.new(nightclub_params)\n\n respond_to do |format|\n if @nightclub.save\n format.html { redirect_to @nightclub, notice: 'Nightclub was successfully created.' }\n format.json { render action: 'show', status: :created, location: @nightclub }\n else\n format.html { render action: 'new' }\n format.json { render json: @nightclub.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wedding = Wedding.new(params[:wedding])\n\n respond_to do |format|\n if @wedding.save\n format.html { redirect_to inhabitants_path }\n format.json { render inhabitants_path }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wedding.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vestimentum = Vestimentum.new(vestimentum_params)\n\n respond_to do |format|\n if @vestimentum.save\n format.html { redirect_to @vestimentum, notice: 'Vestimentum was successfully created.' }\n format.json { render :show, status: :created, location: @vestimentum }\n else\n format.html { render :new }\n format.json { render json: @vestimentum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @wine_variety.destroy\n respond_to do |format|\n format.html { redirect_to wine_varieties_url, notice: \"Wine variety was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def index\n @wine_varieties = WineVariety.all\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 wine_winery_params\n params.require(:wine_winery).permit(:wine_id, :winery_id)\n end",
"def create\n @wine_oenologist = WineOenologist.new(wine_oenologist_params)\n\n respond_to do |format|\n if @wine_oenologist.save\n format.html { redirect_to @wine_oenologist, notice: \"Wine oenologist was successfully created.\" }\n format.json { render :show, status: :created, location: @wine_oenologist }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @wine_oenologist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @hood = Hood.new(hood_params)\n\n respond_to do |format|\n if @hood.save\n format.html { redirect_to @hood, notice: 'Hood was successfully created.' }\n format.json { render action: 'show', status: :created, location: @hood }\n else\n format.html { render action: 'new' }\n format.json { render json: @hood.errors, status: :unprocessable_entity }\n end\n end\n end",
"def whitewine_params\n params.require(:redwine).permit(:grape, :color, :fruit, :body, :description, :flavor_profile, :major_regions)\n end",
"def test_all_the_dogs_are_in_one_pack\n @params = {\n packs: [\n {\n dogs: ['Spot', 'Fido', 'Rover'],\n location: 'San Francisco',\n },\n {\n dogs: ['Doggie', 'Lassie'],\n location: 'Canada',\n },\n ],\n }\n\n\n post \"/dogs\", params = @params\n assert_equal 'Spot, Fido, Rover, Doggie, and Lassie are all in one pack. Oh no!', last_response.body\n end",
"def create\n @wod = Wod.new(wod_params)\n\n if @wod.save\n render json: @wod, status: :created\n else\n render json: @wod.errors, status: :unprocessable_entity\n end\n end",
"def create\n @variate = Variate.new(params[:variate])\n\n flash[:notice] = 'Variate was successfully created.' if @variate.save\n respond_with @variate\n end",
"def create\n @nineteen = Nineteen.new(nineteen_params)\n\n respond_to do |format|\n if @nineteen.save\n format.html { redirect_to @nineteen, notice: 'Nineteen was successfully created.' }\n format.json { render action: 'show', status: :created, location: @nineteen }\n else\n format.html { render action: 'new' }\n format.json { render json: @nineteen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @poststudysurvey = Poststudysurvey.new(poststudysurvey_params)\n\n respond_to do |format|\n if @poststudysurvey.save\n format.html { redirect_to @poststudysurvey, notice: 'Poststudysurvey was successfully created.' }\n format.json { render action: 'show', status: :created, location: @poststudysurvey }\n else\n format.html { render action: 'new' }\n format.json { render json: @poststudysurvey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @county = County.new(params[:county])\n\n respond_to do |format|\n if @county.save\n format.html { redirect_to @county, notice: 'County was successfully created.' }\n format.json { render json: @county, status: :created, location: @county }\n else\n format.html { render action: \"new\" }\n format.json { render json: @county.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @my_wine_cellar = MyWineCellar.find(params[:my_wine_cellar_id])\n @my_winery = MyWinery.new(my_winery_params)\n\n respond_to do |format|\n if @my_winery.save\n format.html { redirect_to @my_wine_cellar, notice: \"My winery was successfully created.\" }\n format.json { render :show, status: :created, location: @my_wine_cellar }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @my_wine_cellar.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 create\n @sighting = Sighting.new(sighting_params)\n\n if @sighting.save\n render json: @sighting, status: :created, location: @sighting\n else\n render json: @sighting.errors, status: :unprocessable_entity\n end\n end",
"def new\n @wine = Wine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wine }\n end\n end",
"def new\n @wine = Wine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wine }\n end\n end",
"def create\n @sighting = Sighting.new(sighting_params)\n\n if @sighting.save\n render json: @sighting, status: :created, location: @sighting\n else\n render json: @sighting.errors, status: :unprocessable_entity\n end\n end",
"def wine_params\n params.require(:wine).permit(:brand, :grape_variety, :year, :picture, :rating, :description, :color, :bubbly)\n end",
"def create\n @etymon = Etymon.new(etymon_params)\n\n respond_to do |format|\n if @etymon.save\n format.html { redirect_to @etymon, notice: 'Etymon was successfully created.' }\n format.json { render :show, status: :created, location: @etymon }\n else\n format.html { render :new }\n format.json { render json: @etymon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def product_variety_params\n params.require(:product_variety).permit(:name, :description, :harvest_ids, :selection_ids, :sale_ids, :product_id)\n end",
"def create\n\n @wine = Wine.new(wine_params)\n\n if mobile_check.nil? then\n normalize_wine_data\n respond_to do |format|\n if @wine.save\n wine = {\n id: @wine.id,\n winetype_id: @wine.winetype_id,\n name: @wine.name,\n country_name: @wine.country.name,\n latitude: @wine.latitude.to_f,\n longitude: @wine.longitude.to_f,\n body: @wine.body,\n sweetness: @wine.sweetness,\n winetype_name: @wine.winetype.name,\n year: @wine.year,\n winevarieties: @wine.winevarieties,\n score: @wine.score,\n price: @wine.price,\n winery: @wine.winery,\n user: @wine.user.name,\n user_id: @wine.user.id,\n winelevel: @wine.winelevel,\n worldregion_id: @wine.country.worldregion_id,\n photo: @wine.photo.thumb.url,\n regions: get_regions(@wine)\n }\n format.html { render json: {wine: wine, regions: get_regions(@wine)}, notice: 'Wine was successfully created.' }\n format.json { render :show, status: :created, location: @wine }\n else\n format.html { render json: {wine: @wine, regions: get_regions(@wine), error: @wine.errors} }\n format.json { render json: @wine.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def venue_params\n params.require(:venue).permit(:name, :date_type, :price_rating, :neighborhood, :address, :blove_count, :dinner, :drinks,\n :dessert, :coffee, :mood, :date_day, :user_fbAccessToken, :menu_link, :reservation_link,\n :polaroid_description, :monday_special, :tuesday_special, :wednesday_special, :thursday_special, \n :friday_special, :saturday_special, :sunday_special, :food_drink, :why_blove_heading_1, \n :why_blove_heading_2, :why_blove_heading_3, :why_blove_description_1, :why_blove_description_2,\n :why_blove_description_3, :price_for_two,:monday_hours, :tuesday_hours, :wednesday_hours, \n :thursday_hours, :friday_hours, :saturday_hours, :sunday_hours, :crowd, :dress_code, :parking, \n :reservations, :atmosphere, :keep_in_mind,\n :polaroid_image, :thumbnail_image, :venue_image_1, :venue_image_2, :venue_image_3, :venue_image_4, :venue_image_5)\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 create\n userID = session[:user_id]\n editionID = params[:edition_id]\n price = params[:price]\n\n uri = URI(\"http://107.170.7.58:4567/api/create/sell\")\n parameters = {\"ext\" => \"json\", \"user_id\" => userID, \"edition_id\" => editionID, \"price\" => price, \"start_date\" => Time.now, \"end_date\" => 90.days.from_now}\n response = Net::HTTP.post_form(uri, parameters)\n list = JSON.parse(response.body)\n\n @response = list[0][\"kind\"]\n end",
"def create\n @sinh_vien = SinhVien.new(params[:sinh_vien])\n\n respond_to do |format|\n if @sinh_vien.save \n format.json { render json: @sinh_vien, status: :created, location: @sinh_vien }\n else \n format.json { render json: @sinh_vien.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tenure = Tenure.new(params[:tenure])\n\n respond_to do |format|\n if @tenure.save\n format.html { redirect_to @tenure, notice: 'Tenure was successfully created.' }\n format.json { render json: @tenure, status: :created, location: @tenure }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tenure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wizytum = Wizytum.new(wizytum_params)\n\n respond_to do |format|\n if @wizytum.save\n format.html { redirect_to @wizytum, notice: 'Wizytum was successfully created.' }\n format.json { render :show, status: :created, location: @wizytum }\n else\n format.html { render :new }\n format.json { render json: @wizytum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_item()\n\n request_body = {\n 'name' => 'Milkshake',\n 'variations' => [\n {\n 'name' => 'Small',\n 'pricing_type' => 'FIXED_PRICING',\n 'price_money' => {\n 'currency_code' => 'USD',\n 'amount' => 400\n }\n }\n ]\n }\n\n response = Unirest.post CONNECT_HOST + '/v1/' + LOCATION_ID + '/items',\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully created item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item creation failed'\n puts response.body\n return nil\n end\nend",
"def create\n @novelty_type = NoveltyType.new(novelty_type_params)\n\n respond_to do |format|\n if @novelty_type.save\n format.html { redirect_to @novelty_type, notice: 'Novelty type was successfully created.' }\n format.json { render :show, status: :created, location: @novelty_type }\n else\n format.html { render :new }\n format.json { render json: @novelty_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @forecast_wsize = ForecastWsize.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @forecast_wsize }\n end\n end",
"def create\n @twentyeight = Twentyeight.new(twentyeight_params)\n\n respond_to do |format|\n if @twentyeight.save\n format.html { redirect_to @twentyeight, notice: 'Twentyeight was successfully created.' }\n format.json { render action: 'show', status: :created, location: @twentyeight }\n else\n format.html { render action: 'new' }\n format.json { render json: @twentyeight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def national_outcome_params\n params.require(:national_outcome).permit(:name)\n end",
"def vineyard_params\n params.require(:vineyard).permit(:name, :acreage, :winery_id)\n end",
"def wine_params\n params.require(:wine).permit( :name, :description, :image_url, :price, :country_of_origin, :grape_type, :suitable_for_vegetarians, :bottle_size, :supplier)\n end",
"def create_rounds\n\t\t@rounds = []\n\t\tcase @participant.league.type\n\t\twhen \"Fantasy\"\n\t\t\t@rounds = [\"fantasy\"]\n\t\twhen \"Elimination\"\n\t\t\t@rounds = [\"elimination\"]\n\t\tend\n\t\trender json: @rounds\n\tend",
"def create\n @twenty = Twenty.new(twenty_params)\n\n respond_to do |format|\n if @twenty.save\n format.html { redirect_to @twenty, notice: 'Twenty was successfully created.' }\n format.json { render action: 'show', status: :created, location: @twenty }\n else\n format.html { render action: 'new' }\n format.json { render json: @twenty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wine = Wine.new(params[:wine])\n\n if @wine.save\n redirect_to @wine, notice: 'Wine was successfully created.'\n else\n render action: \"new\"\n end\n end",
"def neighbourhood_params\n params.require(:neighbourhood).permit(:name, :num_businesses, :home_price, :num_child_care)\n end",
"def snowfall_params\n params.require(:snowfall).permit(:title, :location, :amount, :temp)\n end",
"def create\n @kwasny = Kwasny.new(kwasny_params)\n\n respond_to do |format|\n if @kwasny.save\n format.html { redirect_to @kwasny, notice: 'Kwasny was successfully created.' }\n format.json { render action: 'show', status: :created, location: @kwasny }\n else\n format.html { render action: 'new' }\n format.json { render json: @kwasny.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_wine = UserWine.new(user_wine_params)\n\n respond_to do |format|\n if @user_wine.save\n format.html { redirect_to @user_wine, notice: 'User wine was successfully created.' }\n format.json { render :show, status: :created, location: @user_wine }\n else\n format.html { render :new }\n format.json { render json: @user_wine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def wine_params\n params.require(:wine).permit(:name, :image, :long_description, :country, :grape, :vegetarian, :size, :price, :short_description)\n end",
"def createCharities\n\tcharity_list = [\"Direct Relief\", \"Catholic Medical Mission Board\", \"MAP International\", \"United Nations Foundation\", \"The Rotary Foundation of Rotary International\", \"Samaritan's Purse\", \"Institute of International Education\", \"International Rescue Committee\", \"Compassion International\", \"United States Fund for UNICEF\"]\n\tcharity_list.each do |charity|\n\t\tRestClient.post 'http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40', { \"name\": \"#{charity}\"}.to_json, :content_type => :json, :accept => :json\n\tend\nend",
"def create\n @wine_club = WineClub.new(wine_club_params)\n\n respond_to do |format|\n if @wine_club.save\n format.html { redirect_to @wine_club, notice: 'Wine club was successfully created.' }\n format.json { render :show, status: :created, location: @wine_club }\n else\n format.html { render :new }\n format.json { render json: @wine_club.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #create venues trought users controller\n end",
"def wine_club_params\n params.require(:wine_club).permit(:name, :founded, :city)\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\n # @vineyard = Vineyard.new(vineyard_params)\n\n @vineyard = Vineyard.new(vineyard_params)\n @vineyard.user = current_user\n\n if @vineyard.save\n render json: @vineyard, status: :created, location: @vineyard\n else\n render json: @vineyard.errors, status: :unprocessable_entity\n end\n end",
"def create\n @venue = Venue.new(venue_params)\n @venue.blove_count = 0\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 update\n respond_to do |format|\n if @varietywine.update(varietywine_params)\n format.html { redirect_to @varietywine, notice: 'Сорт вина успешно изменен.' }\n format.json { render :show, status: :ok, location: @varietywine }\n else\n format.html { render :edit }\n format.json { render json: @varietywine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @food = @fridge.foods.create(food_params)\n respond_with @food, location: -> { kitchen_board_path }\n end",
"def set_variety\n @variety = Variety.find(params[:id])\n end",
"def create\n @mostsmallroad = Mostsmallroad.new(params[:mostsmallroad])\n\n respond_to do |format|\n if @mostsmallroad.save\n format.html { redirect_to @mostsmallroad, notice: 'Mostsmallroad was successfully created.' }\n format.json { render json: @mostsmallroad, status: :created, location: @mostsmallroad }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mostsmallroad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def postEntityOpening_times( entity_id, monday, tuesday, wednesday, thursday, friday, saturday, sunday, closed, closed_public_holidays)\n params = Hash.new\n params['entity_id'] = entity_id\n params['monday'] = monday\n params['tuesday'] = tuesday\n params['wednesday'] = wednesday\n params['thursday'] = thursday\n params['friday'] = friday\n params['saturday'] = saturday\n params['sunday'] = sunday\n params['closed'] = closed\n params['closed_public_holidays'] = closed_public_holidays\n return doCurl(\"post\",\"/entity/opening_times\",params)\n end",
"def create\n @department = Department.find(params[:department_id])\n @town = @department.towns.new(town_params)\n respond_to do |format|\n if @town.save\n format.json { render json: @town, status: :ok }\n else\n format.json { render json: @town.errors, status: :unprocessable_entity }\n end\n end\n end",
"def venue_params\n params.require(:venue).permit(:name, :venue_type, :email, :foursquare_id, beer_ids: [])\n end",
"def create\n user_params = params[:witness][:user]\n user = User.find(user_params[:id])\n @witness = Witness.where(user_id: user.id).first\n if @witness\n respond_to do |format|\n format.html { redirect_to @witness, notice: 'Witness found.' }\n format.json { render :show, status: :created, location: @witness }\n end\n return\n end\n\n @witness = Witness.new(witness_params)\n puts @witness.to_json\n @witness[:user_id] = user.id\n @witness[:country_region_city_id] = params[:witness][:country_region_city][:city_id]\n\n puts @witness.to_json\n\n respond_to do |format|\n if @witness.save\n format.html { redirect_to @witness, notice: 'Witness was successfully created.' }\n format.json { render :show, status: :created, location: @witness }\n else\n format.html { render :new }\n format.json { render json: @witness.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fooddiary = @food.fooddiaries.new(fooddiary_params)\n @fooddiary.user_id = current_user.id\n @fooddiary.name = @food.name\n @fooddiary.eiweiß = @food.eiweiß\n @fooddiary.fett = @food.fett\n @fooddiary.kohlenhydrate = @food.kohlenhydrate\n @fooddiary.kalorien = @food.kalorien\n respond_to do |format|\n if @fooddiary.save\n format.html { redirect_to foods_path }\n format.json { render :show, status: :created, location: @fooddiary }\n else\n format.html { render :new }\n format.json { render json: @fooddiary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @nightclub = Nightclub.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nightclub }\n end\n end",
"def my_winery_params\n params.require(:my_winery).permit(:my_wine_cellar_id, :winery_id)\n end"
] | [
"0.70168585",
"0.6558002",
"0.634559",
"0.62436247",
"0.6240683",
"0.6120161",
"0.60094005",
"0.5961578",
"0.59249496",
"0.5904131",
"0.59041035",
"0.582339",
"0.5781194",
"0.5768096",
"0.5765113",
"0.57627124",
"0.56880206",
"0.56782246",
"0.56782246",
"0.5673275",
"0.56616485",
"0.5625487",
"0.56241584",
"0.5616168",
"0.5602402",
"0.5601621",
"0.55649465",
"0.55612195",
"0.5558237",
"0.5557078",
"0.5547383",
"0.55247134",
"0.5522683",
"0.55222225",
"0.5521821",
"0.55153036",
"0.54937446",
"0.5491278",
"0.5469991",
"0.5463467",
"0.54576766",
"0.54505867",
"0.5448985",
"0.5445455",
"0.5441657",
"0.54410964",
"0.5432697",
"0.54190004",
"0.54070574",
"0.5397104",
"0.5396956",
"0.53959",
"0.5393831",
"0.5391262",
"0.5389351",
"0.5389351",
"0.5377194",
"0.53713465",
"0.5368171",
"0.53565866",
"0.53205264",
"0.5317447",
"0.5309413",
"0.53053916",
"0.5299998",
"0.52990943",
"0.529629",
"0.529452",
"0.52922636",
"0.528763",
"0.5284167",
"0.5284163",
"0.5283491",
"0.52789104",
"0.5277246",
"0.5275133",
"0.52721775",
"0.52693605",
"0.5251193",
"0.5242337",
"0.52324766",
"0.52310765",
"0.5230328",
"0.52302545",
"0.5229027",
"0.52288955",
"0.5222669",
"0.52216905",
"0.521768",
"0.5216701",
"0.5215971",
"0.52077466",
"0.5198949",
"0.5198271",
"0.51966035",
"0.51963824",
"0.5194653",
"0.5184793",
"0.51808894",
"0.5176973"
] | 0.6889664 | 1 |
PATCH/PUT /varietywines/1 PATCH/PUT /varietywines/1.json | def update
respond_to do |format|
if @varietywine.update(varietywine_params)
format.html { redirect_to @varietywine, notice: 'Сорт вина успешно изменен.' }
format.json { render :show, status: :ok, location: @varietywine }
else
format.html { render :edit }
format.json { render json: @varietywine.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @variety = Variety.find(params[:id])\n\n respond_to do |format|\n if @variety.update_attributes(params[:variety])\n format.html { redirect_to varieties_path, notice: \"#{@variety.name} fue editada exitosamente.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @variety.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @variety.update(variety_params)\n format.html { redirect_to @variety, notice: 'Variety was successfully updated.' }\n format.json { render :show, status: :ok, location: @variety }\n else\n format.html { render :edit }\n format.json { render json: @variety.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wine_variety.update(wine_variety_params)\n format.html { redirect_to @wine_variety, notice: \"Wine variety was successfully updated.\" }\n format.json { render :show, status: :ok, location: @wine_variety }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @wine_variety.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @variety.update(variety_params)\n format.html { redirect_to admin_varieties_path, notice: 'La variedad fue modificada' }\n format.json { render :show, status: :ok, location: @variety }\n else\n format.html { render :edit }\n format.json { render json: @variety.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product_variety.update(product_variety_params)\n format.html { redirect_to @product_variety, notice: 'Product variety was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product_variety.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n @food.update(food_params)\n respond_with @food, location: -> { kitchen_board_path }\n end",
"def update\n respond_to do |format|\n if @thirtyfife.update(thirtyfife_params)\n format.html { redirect_to @thirtyfife, notice: 'Thirtyfive was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @thirtyfife.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n recipe.update(recipe_params)\n render json: recipe\n end",
"def update\n dream = Dream.find params[:id]\n dream.update dream_params\n render json: {dream: dream}\n end",
"def update\n respond_to do |format|\n if @varience.update(varience_params)\n format.html { redirect_to @varience, notice: 'Varience was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @varience.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end",
"def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end",
"def update\n\n check_current_user\n\n normalize_wine_data\n\n respond_to do |format|\n if @wine.update(wine_params)\n format.html { redirect_to root_path }\n format.json { render :show, status: :ok, location: @wine }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wine.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(id, attributes)\n # attributes = {name: 'chocolate and peanuts', calories: 10}\nend",
"def update\n respond_to do |format|\n if @wine.update(wine_params)\n format.html { redirect_to @wine, notice: 'Wine was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @wine = Wine.find(params[:id])\n\n respond_to do |format|\n if @wine.update_attributes(params[:wine])\n format.html { redirect_to @wine, notice: 'Wine was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @thirtyeight.update(thirtyeight_params)\n format.html { redirect_to @thirtyeight, notice: 'Thirtyeight was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @thirtyeight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @wine = Wine.find(params[:id])\n\n respond_to do |format|\n if @wine.update_attributes(params[:wine])\n format.html { redirect_to @wine, notice: 'Wine was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @society.update(society_params)\n format.html { redirect_to @society, notice: 'Society was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @society.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n if @specie.update_attributes(params[:specie])\n format.html { redirect_to @specie, notice: 'Specie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @wine_type = WineType.find(params[:id])\n\n respond_to do |format|\n if @wine_type.update_attributes(params[:wine_type])\n format.html { redirect_to @wine_type, notice: 'Wine type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wine_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n woof = Woof.find params[:id]\n woof.update woof_params\n redirect_to root_path\n end",
"def update\n @animal.update(animal_params)\n respond_with(@shelter)\n end",
"def update\n respond_to do |format|\n if @society.update(society_params)\n format.html { redirect_to @society }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @society.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @clothing.update(clothing_params)\n format.html { redirect_to @clothing, notice: 'Clothing was successfully updated.' }\n format.json { render :show, status: :ok, location: @clothing }\n else\n format.html { render :edit }\n format.json { render json: @clothing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @food = Food.find(params[:id])\n\n respond_to do |format|\n if @food.update_attributes(params[:food])\n format.html { redirect_to foods_path(), notice: 'Food was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n @county = County.find(params[:id])\n\n respond_to do |format|\n if @county.update_attributes(params[:county])\n format.html { redirect_to @county, notice: 'County was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @county.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @porkbeef.update(porkbeef_params)\n format.html { redirect_to @porkbeef, notice: 'Porkbeef was successfully updated.' }\n format.json { render :show, status: :ok, location: @porkbeef }\n else\n format.html { render :edit }\n format.json { render json: @porkbeef.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @housing_feature = HousingFeature.find(params[:id])\n\n respond_to do |format|\n if @housing_feature.update_attributes(params[:housing_feature])\n format.html { redirect_to @housing_feature, notice: 'Housing feature was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @housing_feature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @kata.update(kata_params)\n format.html { redirect_to @kata, notice: 'Kata was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kata.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @nightclub.update(nightclub_params)\n format.html { redirect_to @nightclub, notice: 'Nightclub was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @nightclub.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @specialty = Specialty.find(params[:id])\n\n if @specialty.update(specialty_params)\n head :no_content\n else\n render json: @specialty.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @ingredients_nutrient.update(ingredients_nutrient_params)\n format.html { redirect_to @ingredients_nutrient, notice: 'Ingredients nutrient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ingredients_nutrient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @beef.update(beef_params)\n format.html { redirect_to @beef, notice: 'Beef was successfully updated.' }\n format.json { render :show, status: :ok, location: @beef }\n else\n format.html { render :edit }\n format.json { render json: @beef.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sinh_vien = SinhVien.find(params[:id])\n\n respond_to do |format|\n if @sinh_vien.update_attributes(params[:sinh_vien]) \n format.json { head :no_content }\n else \n format.json { render json: @sinh_vien.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @interesting = Interesting.find(params[:id])\n\n respond_to do |format|\n if @interesting.update_attributes(params[:interesting])\n format.html { redirect_to @interesting, notice: 'Interesting was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interesting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @vehicle_fine_types = VehicleFineType.all\n @vehicle_fine_type = VehicleFineType.find(params[:id])\n respond_to do |format|\n if @vehicle_fine_type.update(vehicle_fine_type_params)\n format.html { redirect_to @vehicle_fine_type, notice: 'Vehicle fine type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_fine_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n @place = Venue.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:venue])\n format.html { redirect_to @place, notice: 'Venue.was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n feature.update_attributes(feature_params)\n\n respond_with(feature)\n end",
"def update\n @monkey = Monkey.find(params[:id])\n\n respond_to do |format|\n if @monkey.update_attributes(params[:monkey])\n format.html { redirect_to @monkey, notice: 'Monkey was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @monkey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @body_profile_nutrient = BodyProfileNutrient.find(params[:id])\n\n respond_to do |format|\n if @body_profile_nutrient.update_attributes(params[:body_profile_nutrient])\n format.html { redirect_to @body_profile_nutrient, notice: 'Body profile nutrient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @body_profile_nutrient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tenancy.update(tenancy_params)\n format.html { redirect_to @tenancy, notice: 'Tenancy was successfully updated.' }\n format.json { render :show, status: :ok, location: @tenancy }\n else\n format.html { render :edit }\n format.json { render json: @tenancy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @kitchen = Kitchen.find(params[:id])\n\n respond_to do |format|\n if @kitchen.update_attributes(params[:kitchen])\n format.html { redirect_to @kitchen, notice: 'Kitchen was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kitchen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wine.update(wine_params)\n format.html { redirect_to @wine, notice: 'Wine was successfully updated.' }\n format.json { render :show, status: :ok, location: @wine }\n else\n format.html { render :edit }\n format.json { render json: @wine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wine.update(wine_params)\n format.html { redirect_to @wine, notice: 'Wine was successfully updated.' }\n format.json { render :show, status: :ok, location: @wine }\n else\n format.html { render :edit }\n format.json { render json: @wine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contractor_feature = ContractorFeature.find(params[:id])\n\n respond_to do |format|\n if @contractor_feature.update_attributes(params[:contractor_feature])\n format.html { redirect_to @contractor_feature, notice: 'Contractor feature was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contractor_feature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # respond_to do |format|\n # if @kitchen.update_attributes(post_params)\n # format.html { redirect_to @kitchen, notice: 'Kitchen was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: 'edit' }\n # format.json { render json: @kitchen.errors, status :unprocessable_entity }\n # end\n # end\n end",
"def update\n respond_to do |format|\n if @food_truck.update(food_truck_params)\n format.html { redirect_to @food_truck, notice: 'Food truck was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @food_truck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @my_winery.update(my_winery_params)\n format.html { redirect_to @my_winery, notice: \"My winery was successfully updated.\" }\n format.json { render :show, status: :ok, location: @my_winery }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @my_winery.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @flat_happening = FlatHappening.find(params[:id])\n\n if @flat_happening.update_attributes(params[:flat_happening])\n head :no_content\n else\n render json: @flat_happening.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @lunch.update(lunch_params)\n format.html { redirect_to @lunch, notice: 'Lunch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lunch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @thirtyone.update(thirtyone_params)\n format.html { redirect_to @thirtyone, notice: 'Thirtyone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @thirtyone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @servicetype = Servicetype.find(params[:id])\n\n respond_to do |format|\n if @servicetype.update_attributes(params[:servicetype])\n format.html { redirect_to @servicetype, :notice => 'Servicetype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicetype.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 @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 @species = Species.find(params[:id])\n @species.update_attributes(params[:species])\n \n respond_with(@species, :location => admin_species_path(@species))\n end",
"def update\n respond_to do |format|\n if @mystock.update(mystock_params)\n format.html { redirect_to @mystock, notice: 'mystock was successfully updated.' }\n format.json { render :show, status: :ok, location: @mystock }\n else\n format.html { render :edit }\n format.json { render json: @mystock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n standard_update(Interest, params[:id], interest_params)\n end",
"def update\n respond_to do |format|\n if @pine.update(pine_params)\n format.html { redirect_to @pine, notice: 'Pine was successfully updated.' }\n format.json { render :show, status: :ok, location: @pine }\n else\n format.html { render :edit }\n format.json { render json: @pine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end",
"def update\n @fixture = Fixture.find(params[:id])\n\n respond_to do |format|\n if @fixture.update_attributes(fixture_params)\n format.json { head :no_content }\n else\n format.json { render json: @fixture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @supermarket = Supermarket.find(params[:id]) \n respond_to do |format|\n if @supermarket.update(supermarket_params)\n format.json { render json: @supermarket, status: :ok }\n end\n end\n end",
"def update\n @mostsmallroad = Mostsmallroad.find(params[:id])\n\n respond_to do |format|\n if @mostsmallroad.update_attributes(params[:mostsmallroad])\n format.html { redirect_to @mostsmallroad, notice: 'Mostsmallroad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mostsmallroad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @nightclub = Nightclub.find(params[:id])\n\n respond_to do |format|\n if @nightclub.update_attributes(params[:nightclub])\n format.html { redirect_to @nightclub, notice: 'Nightclub was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @nightclub.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @serving = Serving.find(params[:id])\n\n respond_to do |format|\n if @serving.update_attributes(params[:serving])\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @society.update(society_params)\n format.html { redirect_to @society, notice: 'society was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @society.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hood.update(hood_params)\n format.html { redirect_to @hood, notice: 'Hood was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @hood.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @funny.update(funny_params)\n format.html { redirect_to @funny, notice: 'Funny was successfully updated.' }\n format.json { render :show, status: :ok, location: @funny }\n else\n format.html { render :edit }\n format.json { render json: @funny.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @kristine_toy.update(kristine_toy_params)\n format.html { redirect_to @kristine_toy, notice: 'Kristine toy was successfully updated.' }\n format.json { render :show, status: :ok, location: @kristine_toy }\n else\n format.html { render :edit }\n format.json { render json: @kristine_toy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n animal = Animal.find(params[:id])\n\n if validate_params(animal_params)\n animal.update(animal_params)\n render json: animal, status: 200, location: [:api, animal]\n else\n render json: { errors: animal.errors }, status: 422\n end\n end",
"def update\n @servicetype = Servicetype.find(params[:id])\n\n respond_to do |format|\n if @servicetype.update_attributes(params[:servicetype])\n format.html { redirect_to @servicetype, notice: 'Servicetype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @servicetype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @kwasny.update(kwasny_params)\n format.html { redirect_to @kwasny, notice: 'Kwasny was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kwasny.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n put :update\n end",
"def update\n respond_to do |format|\n if @species.update(species_params)\n format.html { redirect_to @species, notice: 'Species was successfully updated.' }\n format.json { render :show, status: :ok, location: @species }\n else\n format.html { render :edit }\n format.json { render json: @species.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @interest = Interest.find(params[:id])\n \n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.json { head :ok }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @analyst = Analyst.find(params[:id])\n\n if @analyst.update(params[:analyst])\n head :no_content\n else\n render json: @analyst.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cow.update(cow_params)\n format.html { redirect_to @cow, notice: 'Cow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle_fine.update(vehicle_fine_params)\n format.html { redirect_to @vehicle_fine, notice: 'Vehicle fine was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_fine }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_fine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @nineteen.update(nineteen_params)\n format.html { redirect_to @nineteen, notice: 'Nineteen was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @nineteen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @housing.update(housing_params)\n format.html {\n redirect_to housings_url, notice: 'Housing was successfully updated.' }\n format.json {\n render json: {}, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @housing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @subway = Subway.find(params[:id])\n\n respond_to do |format|\n if @subway.update_attributes(params[:subway])\n format.html { redirect_to @subway, notice: 'Subway was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subway.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @taxinomy = Taxinomy.find(params[:id])\n\n respond_to do |format|\n if @taxinomy.update_attributes(params[:taxinomy])\n format.html { redirect_to @taxinomy, notice: 'Taxinomy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxinomy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vacancy.update(vacancy_params)\n update_skills\n format.html { redirect_to @vacancy, notice: 'Vacancy was successfully updated.' }\n format.json { render :show, status: :ok, location: @vacancy }\n else\n format.html { render :edit }\n format.json { render json: @vacancy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end",
"def update\n respond_to do |format|\n if @twenty.update(twenty_params)\n format.html { redirect_to @twenty, notice: 'Twenty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @twenty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @nutrient.update(nutrient_params)\n format.html { redirect_to @nutrient, notice: 'Nutrient was successfully updated.' }\n format.json { render :show, status: :ok, location: @nutrient }\n else\n format.html { render :edit }\n format.json { render json: @nutrient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @genotype = Genotype.find(params[:id])\n\n respond_to do |format|\n if @genotype.update_attributes(params[:genotype])\n format.html { redirect_to @genotype, notice: 'Genotype was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @genotype.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6773086",
"0.6761199",
"0.665296",
"0.6434668",
"0.62807226",
"0.6183346",
"0.6055935",
"0.60461706",
"0.60333604",
"0.6010276",
"0.60008746",
"0.59948",
"0.59894156",
"0.59771764",
"0.5968626",
"0.59674877",
"0.5958009",
"0.59564215",
"0.5940687",
"0.59325504",
"0.593139",
"0.5924938",
"0.5923837",
"0.592187",
"0.5921577",
"0.59212226",
"0.5917458",
"0.5893792",
"0.58930755",
"0.58811516",
"0.5880291",
"0.58785",
"0.5874399",
"0.58657193",
"0.58610165",
"0.58537406",
"0.58379585",
"0.5833324",
"0.5831598",
"0.5827698",
"0.5820844",
"0.58184314",
"0.58144397",
"0.5812491",
"0.5809365",
"0.58082724",
"0.5803479",
"0.58032674",
"0.5799807",
"0.57995963",
"0.57983583",
"0.57899445",
"0.57835567",
"0.57835567",
"0.57827336",
"0.5779737",
"0.5776053",
"0.5769304",
"0.57690704",
"0.57675046",
"0.5764185",
"0.57639635",
"0.5762302",
"0.5761519",
"0.5761258",
"0.57612073",
"0.57591623",
"0.57574165",
"0.5756285",
"0.5753642",
"0.57531434",
"0.5752874",
"0.5751248",
"0.57511955",
"0.5749733",
"0.5743479",
"0.5742451",
"0.5741419",
"0.57344806",
"0.5731933",
"0.57313377",
"0.5730931",
"0.5730567",
"0.5729828",
"0.57287353",
"0.57259166",
"0.57256514",
"0.5724033",
"0.5721418",
"0.57214165",
"0.5719872",
"0.57128555",
"0.5710679",
"0.57076025",
"0.5705805",
"0.5704977",
"0.5704844",
"0.56991446",
"0.5698981",
"0.5697675"
] | 0.6614275 | 3 |
DELETE /varietywines/1 DELETE /varietywines/1.json | def destroy
@varietywine.destroy
respond_to do |format|
format.html { redirect_to varietywines_url, notice: 'Сорт вина успешно удален.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @variety = Variety.find(params[:id])\n @variety.destroy\n\n respond_to do |format|\n format.html { redirect_to varieties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wine_variety.destroy\n respond_to do |format|\n format.html { redirect_to wine_varieties_url, notice: \"Wine variety was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @variety.destroy\n respond_to do |format|\n format.html { redirect_to varieties_url, notice: 'Variety was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @variety.destroy\n respond_to do |format|\n format.html { redirect_to admin_varieties_path, notice: 'La variedad fue eliminada' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nightclub.destroy\n respond_to do |format|\n format.html { redirect_to nightclubs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wine = Wine.find(params[:id])\n @wine.destroy\n\n respond_to do |format|\n format.html { redirect_to wines_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @wine = Wine.find(params[:id])\n @wine.destroy\n\n respond_to do |format|\n format.html { redirect_to wines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wine.destroy\n respond_to do |format|\n format.html { redirect_to wines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wine.destroy\n respond_to do |format|\n format.html { redirect_to wines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @society.destroy\n respond_to do |format|\n format.html { redirect_to societies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nightclub = Nightclub.find(params[:id])\n @nightclub.destroy\n\n respond_to do |format|\n format.html { redirect_to nightclubs_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 soccer_delete\n base_delete(params, \"Soccer\")\n end",
"def destroy\n @county = County.find(params[:id])\n @county.destroy\n\n respond_to do |format|\n format.html { redirect_to counties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mostsmallroad = Mostsmallroad.find(params[:id])\n @mostsmallroad.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallroads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unique_whiteline.destroy\n respond_to do |format|\n format.html { redirect_to unique_whitelines_url }\n format.json { head :no_content }\n end\n end",
"def 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 @thirtyfife.destroy\n respond_to do |format|\n format.html { redirect_to thirtyfives_url }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @thirtyeight.destroy\n respond_to do |format|\n format.html { redirect_to thirtyeights_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @wine_type = WineType.find(params[:id])\n @wine_type.destroy\n\n respond_to do |format|\n format.html { redirect_to wine_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cow.destroy\n respond_to do |format|\n format.html { redirect_to kine_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @economia4 = Economia4.find(params[:id])\n @economia4.destroy\n\n respond_to do |format|\n format.html { redirect_to economia4s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @taxinomy = Taxinomy.find(params[:id])\n @taxinomy.destroy\n\n respond_to do |format|\n format.html { redirect_to taxinomies_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\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 @ninja = Ninja.find(params[:id])\n @ninja.destroy\n\n respond_to do |format|\n format.html { redirect_to ninjas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hood.destroy\n respond_to do |format|\n format.html { redirect_to hoods_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @twenty.destroy\n respond_to do |format|\n format.html { redirect_to twenties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wine.destroy\n respond_to do |format|\n format.html { redirect_to wines_url, notice: 'Wine was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @goody = Goody.find(params[:id])\n @goody.destroy\n\n respond_to do |format|\n format.html { redirect_to goodies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vocalium = Vocalium.find(params[:id])\n @vocalium.destroy\n\n respond_to do |format|\n format.html { redirect_to vocalia_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @thirtyone.destroy\n respond_to do |format|\n format.html { redirect_to thirtyones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subway.destroy\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @thirtythree.destroy\n respond_to do |format|\n format.html { redirect_to thirtythrees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @society.destroy\n respond_to do |format|\n format.html { redirect_to societies_url, notice: 'Society was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @thirtyfour.destroy\n respond_to do |format|\n format.html { redirect_to thirtyfours_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @twentyfour.destroy\n respond_to do |format|\n format.html { redirect_to twentyfours_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nineteen.destroy\n respond_to do |format|\n format.html { redirect_to nineteens_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ruby.destroy\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @taxon_determination.destroy\n respond_to do |format|\n format.html { redirect_to taxon_determinations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @society.destroy\n respond_to do |format|\n format.html { redirect_to societies_url, notice: 'Se ha eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @investigated.destroy\n respond_to do |format| \n format.json { head :no_content }\n end\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 destroy\n @genotype = Genotype.find(params[:id])\n @genotype.destroy\n\n respond_to do |format|\n format.html { redirect_to genotypes_url }\n format.json { head :ok }\n end\n end",
"def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @dinosaur = Dinosaur.find(params[:id])\n @dinosaur.destroy\n\n respond_to do |format|\n format.html { redirect_to dinosaurs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @six.destroy\n respond_to do |format|\n format.html { redirect_to sixes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @specie = Specie.find(params[:id])\n @specie.destroy\n\n respond_to do |format|\n format.html { redirect_to species_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @night.destroy\n respond_to do |format|\n format.html { redirect_to nights_url, notice: 'Night was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @dish_mixture.destroy\n respond_to do |format|\n format.html { redirect_to dish_mixtures_url }\n format.json { head :no_content }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @moonwalk.destroy\n respond_to do |format|\n format.html { redirect_to moonwalks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subway = Subway.find(params[:id])\n @subway.destroy\n\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @sinh_vien = SinhVien.find(params[:id])\n @sinh_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @forest = Forest.find(params[:id])\n @forest.destroy\n\n respond_to do |format|\n format.html { redirect_to forests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tea_club.destroy\n respond_to do |format|\n format.html { redirect_to tea_clubs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @varience.destroy\n respond_to do |format|\n format.html { redirect_to variences_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @raw_food.destroy\n respond_to do |format|\n format.html { redirect_to raw_foods_url, notice: 'Raw food was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diet_dish.destroy\n respond_to do |format|\n format.html { redirect_to diet_dishes_url }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n request(:delete, \"/recipes/#{id}.json\")\n end",
"def destroy\n @therapist = Therapist.find(params[:id])\n @therapist.destroy\n\n respond_to do |format|\n format.html { redirect_to therapists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @county = County.find(params[:id])\n @county.destroy\n\n respond_to do |format|\n format.html { redirect_to(counties_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def DeleteView id\n \n APICall(path: \"views/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n @food_truck.destroy\n respond_to do |format|\n format.html { redirect_to food_trucks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fooddiary.destroy\n respond_to do |format|\n format.html { redirect_to food_fooddiaries_url(@food.id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @zombie_sighting = ZombieSighting.find(params[:id])\n @zombie_sighting.destroy\n\n respond_to do |format|\n format.html { redirect_to zombie_sightings_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @mostsmalltrapinfo = Mostsmalltrapinfo.find(params[:id])\n @mostsmalltrapinfo.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmalltrapinfos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bow.destroy\n respond_to do |format|\n format.html { redirect_to bows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @twentytwo.destroy\n respond_to do |format|\n format.html { redirect_to twentytwos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_sex = ClientSex.find(params[:id])\n @client_sex.destroy\n\n respond_to do |format|\n format.html { redirect_to client_sexes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @unit.destroy\n respond_to do |format|\n format.html { redirect_to new_food_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fixture = Fixture.find(params[:id])\n @fixture.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @medium_road = MediumRoad.find(params[:id])\n @medium_road.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_roads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @daily_horoscope = DailyHoroscope.find(params[:id])\n @daily_horoscope.destroy\n\n respond_to do |format|\n format.html { redirect_to daily_horoscopes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @baton = Baton.find(params[:id])\n @baton.destroy\n\n respond_to do |format|\n format.html { redirect_to batons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_studio_client = MyStudio::Client.find(params[:id])\n @my_studio_client.destroy\n\n respond_to do |format|\n format.html { redirect_to my_studio_clients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @ingredients_nutrient.destroy\n respond_to do |format|\n format.html { redirect_to ingredients_nutrients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asthenium.destroy\n respond_to do |format|\n format.html { redirect_to asthenia_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @data = @recipe.delete(params[:id])\n render json: @data\n end",
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def destroy\n @ruby = Ruby.find(params[:id])\n @ruby.destroy\n\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @railway = Railway.find(params[:id])\n @railway.destroy\n\n respond_to do |format|\n format.html { redirect_to railways_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kwasny.destroy\n respond_to do |format|\n format.html { redirect_to kwasnies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @thirtytwo.destroy\n respond_to do |format|\n format.html { redirect_to thirtytwos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @interest = Interest.find(params[:id])\n @interest.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end \n end"
] | [
"0.7149215",
"0.7103098",
"0.69729066",
"0.69283015",
"0.68396616",
"0.6832204",
"0.6773126",
"0.6759269",
"0.6757947",
"0.6755335",
"0.6755335",
"0.6710257",
"0.67088175",
"0.67017597",
"0.669993",
"0.66856974",
"0.66772956",
"0.66488045",
"0.66441053",
"0.66403",
"0.6637773",
"0.6632894",
"0.66144305",
"0.66144305",
"0.6612864",
"0.6611757",
"0.65961695",
"0.65953887",
"0.6593406",
"0.65903395",
"0.6582813",
"0.6582813",
"0.6582813",
"0.6582813",
"0.6573497",
"0.6573417",
"0.65733725",
"0.65732974",
"0.65721333",
"0.6564812",
"0.6555668",
"0.6549734",
"0.6541276",
"0.65332955",
"0.6525489",
"0.6522003",
"0.65217817",
"0.652128",
"0.6519051",
"0.65136296",
"0.65132034",
"0.6510632",
"0.6508737",
"0.65082276",
"0.650411",
"0.65007216",
"0.65002435",
"0.64959955",
"0.649246",
"0.64895755",
"0.64863205",
"0.6485342",
"0.64828193",
"0.6478456",
"0.64761674",
"0.6473914",
"0.64728034",
"0.6471487",
"0.6463166",
"0.6458258",
"0.64574146",
"0.64552295",
"0.64548844",
"0.6454798",
"0.6446651",
"0.6444743",
"0.6441604",
"0.6441399",
"0.6437087",
"0.64366615",
"0.64364225",
"0.643499",
"0.64341545",
"0.6433574",
"0.6433266",
"0.64271086",
"0.64227515",
"0.6422623",
"0.6421426",
"0.6421319",
"0.6418662",
"0.6416774",
"0.6415614",
"0.64144015",
"0.6414098",
"0.64130336",
"0.6413012",
"0.64108443",
"0.6408846",
"0.64063674"
] | 0.715729 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_varietywine
@varietywine = Varietywine.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 varietywine_params
params.require(:varietywine).permit(:name, :type_of_wine, :color, :aging_in_barrels, :aging_in_bottles,
{relationships_attributes: [:_destroy, :id, :ratio,
:grapesort_id, {grapesort_attributes: [:destroy, :id, :name, :place_of_production, :date_of_collection]}
]}
)
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 |
set the volume of the audio resource to value between 0 and 1 | def volume=(vol)
`#{@sound}.volume = #{vol}`
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def music_volume=(value)\n return unless value.between?(0, 100)\n @music_volume = Audio.music_volume = value\n end",
"def sound_volume(value)\n @ole.SoundVolume = value\n nil\n end",
"def music_volume=(value)\n value = value.to_i.abs\n @music_volume = value < 101 ? value : 100\n end",
"def sfx_volume=(value)\n return unless value.between?(0, 100)\n @sfx_volume = Audio.sfx_volume = value\n end",
"def mute\n @volume = 0\n end",
"def sfx_volume=(value)\n value = value.to_i.abs\n @sfx_volume = value < 101 ? value : 100\n end",
"def master_volume=(value)\n self.music_volume = value\n self.sfx_volume = value\n end",
"def volume\n `#{@sound}.volume`\n end",
"def on_sound_volume_changed(newVolume)\n end",
"def set_Volume(value)\n set_input(\"Volume\", value)\n end",
"def sound_volume\n @ole.SoundVolume\n end",
"def volume=(volume)\n validator = EnumAttributeValidator.new('String', ['Mute', 'Low', 'Medium', 'Loud', 'Mixed'])\n unless validator.valid?(volume)\n fail ArgumentError, 'invalid value for \"volume\", must be one of #{validator.allowable_values}.'\n end\n @volume = volume\n end",
"def volume=(setting)\n app.speakers.ID(@id).volume.set setting\n volume\n end",
"def soundVolume \n \"soundVolume\" \n end",
"def update(mute, volume)\n if mute\n vol = 0\n @cMuteLabel.visible = true\n @cVolumeValue.visible = false\n else\n vol = 100 - volume\n @cMuteLabel.visible = false\n @cVolumeValue.visible = true\n end\n @cVolumeValue.text = sprintf(MENU_CONFIG::VOL_PATTERN, vol)\n @ucVolumeBar.value = vol\n end",
"def update(mute, volume)\n if mute\n vol = 0\n @cMuteLabel.visible = true\n @cVolumeValue.visible = false\n else\n vol = 100 - volume\n @cMuteLabel.visible = false\n @cVolumeValue.visible = true\n end\n @cVolumeValue.text = sprintf(MENU_CONFIG::VOL_PATTERN, vol)\n @ucVolumeBar.value = vol\n end",
"def volume=(level)\n send_packet(:volume, {\n volume: level.clamp(0, 1000)\n })\n end",
"def music_volume\n return @music_volume\n end",
"def set_volume\n @volume = Volume.find(params[:id])\n end",
"def set_volume\n @volume = Volume.find(params[:id])\n end",
"def volume_up(increase = 1)\n if (@volume + increase) >= 100\n @volume = 100\n else\n @volume += increase\n end\n end",
"def set_bunny_volume vol\n @exch.publish(vol.to_i) \n end",
"def set_volume(volume)\n %x{#{echo()} volume #{volume} 1 > #{fifo()}} if running?\n end",
"def volume; property('volume'); end",
"def adjust_engine_volume(direction)\n case direction\n when \"up\"\n if @current_engine_volume < 1\n @current_engine_volume += 0.025\n @engine_sound.volume = @current_engine_volume\n end\n when \"down\"\n if @current_engine_volume > 0\n @current_engine_volume *= 0.95\n @current_engine_volume = 0 unless @current_engine_volume > 0.05\n @engine_sound.volume = @current_engine_volume\n end\n end\n end",
"def volume\n app.speakers.ID(@id).volume.get\n end",
"def switch_audio _value=0\n send_cmd(\"switch_audio #{_value}\")\n end",
"def musicVolume \n \"musicVolume\" \n end",
"def volume_down(reduction = 1)\n if (@volume - reduction) <= 0\n mute\n else\n @volume -= reduction\n end\n end",
"def set_volume(volume)\n puts \"Setting volume to #{volume}\" if $verbose\n v='AG'+(('000'+volume.to_s)[-3..-1])+';'\n puts v if $verbose\n ret=send_cmd(v,'AG;',v,0.5,1.5,3)\n if(ret)\n return(ret.gsub(/^AG/,'').gsub(/;$/,'').to_i)\n else\n return(nil)\n end\nend",
"def volume _value, _abs=0\n send_cmd(\"volume #{_value} #{_abs}\")\n end",
"def volume_adjustment(value)\n @ole.VolumeAdjustment = value\n nil\n end",
"def volume_ramp_seconds=(f)\n raise ArgumentError, \"Volume ramp time must be 0.0 or greater\" unless f.to_f >= 0.0\n set_audio_queue_param KAudioQueueParam_VolumeRampTime, f.to_f\n self\n end",
"def sound_volume obj1, obj2 = @player\n ##pos = -((pos.dist(obj.pos)/3) * 0.001)+0.1\n #obj1 = -((obj1.dist(obj2.pos)/7) * 0.001)+0.1\n (obj1 = 0.1 - ((obj1.dist(obj2.pos)/7) * 0.001)) < 0 ? nil : obj1\n end",
"def vu(value=1)\n @music.vu(value.to_i)\n end",
"def sfx_volume\n return @sfx_volume\n end",
"def set_volume_cuft\n self.volume_cuft = (self.length_ins/12) * (self.width_ins/12) * (self.height_ins/12)\n end",
"def sound_volume_control_enabled\n @ole.SoundVolumeControlEnabled\n end",
"def volume(x)\n\t\tsynchronized do\n\t\t\[email protected] \"volume #{x}\"\n\t\tend\n\tend",
"def do_volume(num)\n\n fail CvlcClientError, \"The 'volume' command requires an integer value between 0 and 300...\" unless num.between?(0, 300)\n do_command(\"requests/status.json?command=volume&val=#{num}\")\n sleep STATUS_PAUSE\n return pretty_status(current_status)\n end",
"def get_volume\n @volume\n end",
"def volume; self.class.volume; end",
"def volume_increase(button)\n\t\t if @volumes < 10\n\t\t\t@volumes += 1\n\t\t\tputs \"press #{button}! leaves volume bar level at: #{@volumes}.\"\n\t\telse\n\t\t\tputs \"Volume Max!...Pls reduce Volume \"\n\t\tend\n\tend",
"def volume\n player_iface['Volume']\n end",
"def vol_incr\n %x[pactl set-sink-input-volume #{self.input_id} -- +5%]\n new_vol = vol_perc + 5\n new_vol = 100 if new_vol > 100\n @args[:props][\"volume\"] = \"0: #{new_vol}% 1: #{new_vol}%\"\n return nil\n end",
"def volume_calc(length,width,height)\n volume = length * width * height\n end",
"def volume\n @length * @width * @depth\n end",
"def volume \n puts \"The volume is #{@length * @width * @height}\"\n end",
"def volume(percent)\n url = \"me/player/volume?volume_percent=#{percent}\"\n User.oauth_put(@user.id, url, {})\n end",
"def setup_audio!\n self.gun_sound = AudioNode.new($asset_manager, \"Sound/Effects/Gun.wav\", false)\n gun_sound.positional = false\n gun_sound.looping = false\n gun_sound.volume = 3\n root_node.attach_child(gun_sound)\n\n self.ambient_noise = AudioNode.new(asset_manager, \"assets/sound/lost.ogg\", false)\n ambient_noise.looping = true\n ambient_noise.positional = true\n ambient_noise.local_translation = Vector3f::ZERO.clone\n ambient_noise.volume = 2\n root_node.attach_child(ambient_noise)\n ambient_noise.play\n end",
"def mute()\n self.post(\"/devices/#{@volume_device}/commands/mute\")\n end",
"def volume\n return (4.0/3.0) * Math::PI * self.radius**3\n end",
"def fade_volume_to(new_vol, rbot)\n\t\told_vol = @itunes.sound_volume\n\t\tnew_vol = [[new_vol.to_i, 0].max, 100].min\n\t\tif old_vol == new_vol\n\t\t\trbot.reply \"Volume is already at #{new_vol == 0 ? 'minimum' : 'maximum'}!\"\n\t\t\treturn\n\t\tend\n\t\tif old_vol > new_vol\n\t\t\told_vol.downto(new_vol) do |v|\n\t\t\t\[email protected]_volume = v\n\t\t\t\tsleep VolumeFadeStepDelay\n\t\t\tend\n\t\telse\n\t\t\told_vol.upto(new_vol) do |v|\n\t\t\t\[email protected]_volume = v\n\t\t\t\tsleep VolumeFadeStepDelay\n\t\t\tend\n\t\tend\n\t\trbot.reply \"Volume from #{old_vol} to #{new_vol}\"\n\tend",
"def vd(value=1)\n @music.vd(value.to_i)\n end",
"def volume(level = nil)\n level.nil? ? Integer(connection.write(\"volume\", false)) : connection.write(\"volume #{Integer(level)}\")\n rescue ArgumentError\n level.nil? ? 0 : nil\n end",
"def set_audio\n @audio = Audio.find(params[:id])\n end",
"def audio; end",
"def set_volume\n @volume = services.block_storage.get_volume(params[:id])\n end",
"def vol_decr\n %x[pactl set-sink-input-volume #{self.input_id} -- -5%]\n new_vol = vol_perc - 5\n new_vol = 0 if new_vol < 0\n @args[:props][\"volume\"] = \"0: #{new_vol}% 1: #{new_vol}%\"\n return nil\n end",
"def volume(volume_name, attrs={}, &block)\n volumes[volume_name] ||= Ironfan::Volume.new(:parent => self, :name => volume_name)\n volumes[volume_name].configure(attrs, &block)\n volumes[volume_name]\n end",
"def update\n en_ee_ge_u\n if @sound.nil? && @page && [email protected]?\n @sound = RPG::BGS.new(@page.sound[0], volume(*@page.sound[1..2]), 100)\n @sound.play\n end\n if @sound\n @sound.volume = volume(@page.sound[1], @page.sound[2]) and @sound.play\n end\n end",
"def set_actual_volume\n @actual_volume = ActualVolume.find(params[:id])\n end",
"def volume\n @cr[0xe] & 0x0f\n end",
"def enable_audio(on: true)\n\n # Set the flag\n @audio_handler.audio = on\n\n # Update the icon\n @audio_sprite.path =\n if @audio_handler.audio\n 'vertices/sprites/audioOn.png'\n else\n 'vertices/sprites/audioOff.png'\n end\n\n end",
"def volume(options)\n options[:width] * options[:height] * options[:depth]\nend",
"def volume (l, w, h)\n\tl * w * h\nend",
"def add_audio\n update_attribute(:audio, true)\n end",
"def volume\n return @width * @height / @depth\n end",
"def emit_sound(reference, volume = 1.0, pitch = 1.0)\n game_state.manager(:sound).play_sound(reference, volume, pitch)\n end",
"def volume(level = nil)\n return Integer(connection.write(\"volume\", false)) if level.nil?\n connection.write(\"volume #{Integer(level)}\")\n rescue ArgumentError\n level.nil? ? 0 : nil\n end",
"def volume(level = nil)\n return Integer(connection.write(\"volume\", false)) if level.nil?\n connection.write(\"volume #{Integer(level)}\")\n rescue ArgumentError\n level.nil? ? 0 : nil\n end",
"def mute _value=0\n send_cmd(\"mute #{_value}\")\n end",
"def set_mixer\n @mixer = Mixer.find(params[:id])\n end",
"def show_vol()\n\t\tvm = get_vol\n\t\[email protected]=$muted_colors[vm[:mute]]\n\t\[email protected]='Volume'\n\t\[email protected] += ' (Muted)' if vm[:mute]\n\t\[email protected]=vm[:vol]\n\t\[email protected]=5\n\tend",
"def peak_volume(type=TagLib::ID3v2::RelativeVolumeFrame::MasterVolume)\n end",
"def volume_ft3\n self.volume\n end",
"def volume\n { bid: bid_volume, ask: ask_volume }\n end",
"def audiences=(value)\n @audiences = value\n end",
"def set_audio_clip\n @audio_clip = AudioClip.find(params[:id])\n end",
"def sound; end",
"def set_audio\n @audio = Audio.find(params[:id])\n end",
"def series_volume\n end",
"def volume_type=(value)\n @volume_type = value\n end",
"def volume_adjustment\n @ole.VolumeAdjustment\n end",
"def volume_reduce(button)\n\t\tif @volumes > 0\n\t\t\t@volumes -= 1\n\t\t\tputs \"press #{button}! leaves volumes bar level at: #{@volumes}.\"\n\t\telse\n\t\t\tputs \" Volume bar level is at 0\"\n\t\tend\n\tend",
"def mute()\n update(:mute => true)\n end",
"def active=(active)\n @active = active\n @cVolumeLabel.active = active\n @cMuteLabel.active = active\n @ucVolumeBar.active = active\n @cVolumeValue.active = active\n end",
"def active=(active)\n @active = active\n @cVolumeLabel.active = active\n @cMuteLabel.active = active\n @ucVolumeBar.active = active\n @cVolumeValue.active = active\n end",
"def effectiveness_sound(effectiveness)\n if effectiveness == 1\n Audio.se_play('Audio/SE/hit')\n elsif effectiveness > 1\n Audio.se_play('Audio/SE/hitplus')\n else\n Audio.se_play('Audio/SE/hitlow')\n end\n end",
"def mute(value)\n @ole.Mute = value\n nil\n end",
"def set_peak_volume(peak, type=TagLib::ID3v2::RelativeVolumeFrame::MasterVolume)\n end",
"def set_maudio\n @maudio = Maudio.find(params[:id])\n end",
"def set_sound\n @sound = Sound.find(params[:id])\n end",
"def volume\n $redis_pool.with { |redis| redis.get('warble:volume').to_i }\n end",
"def teleported_volume; self.class.teleported_volume(level); end",
"def fade(raw_val, interval: @fade_interval)\n\n val = raw_val.to_i\n return 'volume must be between 0 and 100' if val < 0 or val > 100\n \n @volume.method(val > @volume ? :upto : :downto).call(val.to_i).each do |x|\n sleep interval; setvol(x.to_s + '%')\n end\n\n @volume\n\n end",
"def audio\n @audio ||= (\n id = @params[:audio_track]\n ::Audio.find(id) if id\n )\n end",
"def setSoundEffect _obj, _args\n \"_obj setSoundEffect _args;\" \n end",
"def radioVolume \n \"radioVolume\" \n end",
"def volume_m3\n ft3_to_m3(self.volume)\n end"
] | [
"0.8131661",
"0.7935762",
"0.7846314",
"0.7821399",
"0.76464224",
"0.7587407",
"0.7165034",
"0.70305187",
"0.69783235",
"0.6925852",
"0.69167805",
"0.6750622",
"0.6718642",
"0.6671523",
"0.663774",
"0.663774",
"0.65343374",
"0.6513619",
"0.6461154",
"0.6461154",
"0.6449806",
"0.6404994",
"0.6371601",
"0.6320467",
"0.6296718",
"0.62865293",
"0.62370527",
"0.6221849",
"0.6197068",
"0.6166809",
"0.6146702",
"0.6123144",
"0.6106631",
"0.6087441",
"0.6072342",
"0.6022884",
"0.60127574",
"0.59499854",
"0.5949067",
"0.594679",
"0.5932395",
"0.5923728",
"0.58939487",
"0.58483946",
"0.5818096",
"0.5810322",
"0.580971",
"0.5804778",
"0.5794269",
"0.5771716",
"0.5752713",
"0.5730475",
"0.5722381",
"0.56602585",
"0.5659117",
"0.5654089",
"0.56444776",
"0.5643509",
"0.5642519",
"0.56403995",
"0.5636333",
"0.5634526",
"0.5603219",
"0.5598916",
"0.5591611",
"0.55896115",
"0.55631423",
"0.5560155",
"0.55426866",
"0.55326825",
"0.55326825",
"0.5531969",
"0.5505337",
"0.5504731",
"0.55011994",
"0.548758",
"0.54846",
"0.544445",
"0.54408985",
"0.54400945",
"0.5436126",
"0.543426",
"0.5434207",
"0.54314446",
"0.54291743",
"0.54266244",
"0.5409634",
"0.5409634",
"0.5398492",
"0.5394546",
"0.5359656",
"0.5346487",
"0.53417015",
"0.5340179",
"0.5316223",
"0.53035253",
"0.52864504",
"0.5273988",
"0.5269101",
"0.5263326"
] | 0.7966775 | 1 |
retrieve the current volume of the audio resource | def volume
`#{@sound}.volume`
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def volume\n app.speakers.ID(@id).volume.get\n end",
"def music_volume\n return @music_volume\n end",
"def get_volume\n @volume\n end",
"def sound_volume\n @ole.SoundVolume\n end",
"def volume; property('volume'); end",
"def volume; self.class.volume; end",
"def volume\n player_iface['Volume']\n end",
"def sfx_volume\n return @sfx_volume\n end",
"def soundVolume \n \"soundVolume\" \n end",
"def musicVolume \n \"musicVolume\" \n end",
"def volume\n return @width * @height / @depth\n end",
"def sound_volume(value)\n @ole.SoundVolume = value\n nil\n end",
"def get_volume\n return get_floor_height.to_f * get_area.to_f\n end",
"def volume=(vol)\n `#{@sound}.volume = #{vol}`\n end",
"def volume\n @length * @width * @depth\n end",
"def volume\n $redis_pool.with { |redis| redis.get('warble:volume').to_i }\n end",
"def get_audio\n return @audio\n end",
"def volume_ft3\n self.volume\n end",
"def music_volume=(value)\n return unless value.between?(0, 100)\n @music_volume = Audio.music_volume = value\n end",
"def volume\n @cr[0xe] & 0x0f\n end",
"def volume\n return (4.0/3.0) * Math::PI * self.radius**3\n end",
"def current_volume(volume)\n\t\t\"The current volume is #{@volume}\"\n\tend",
"def volume\n { bid: bid_volume, ask: ask_volume }\n end",
"def traded_volume\n data.fetch('tradedVolume')\n end",
"def total_volume\n quantity * Item.find(item_id).volume\n end",
"def get_volume\n\n # get the keyword value of \"SHAPE\"\n shape = get_keyword_value(\"SHAPE\")\n\n # if the shape value returns nil, or is defined as \"NO-SHAPE\", the volume is\n # given directly\n if ( shape == nil || shape == \"NO-SHAPE\")\n volume = get_keyword_value(\"VOLUME\")\n volume = volume.to_f\n return volume\n\n # if the shape is defined as a \"BOX\", the values for height, width, and\n # depth are given, from which you can get the volume\n elsif ( shape == \"BOX\" )\n height = get_keyword_value(\"HEIGHT\")\n width = get_keyword_value(\"WIDTH\")\n depth = get_keyword_value(\"DEPTH\")\n height = height.to_f\n width = width.to_f\n depth = depth.to_f\n return height * width * depth\n\n # if the shape is defined as a \"POLYGON\", the get_area is defined as the area\n # of the polygon, and the height is given by the value of \"HEIGHT\"\n elsif ( shape == \"POLYGON\")\n height = getKeywordvalue(\"HEIGHT\")\n temp = get_keyword_value(\"POLYGON\")\n height = height.to_f\n @polygon.utype = temp\n return @polygon.get_area * height\n else\n raise \"Error: The volume could not be evaluated. Please check inputs\\n \"\n\n end\n\n end",
"def volume \n puts \"The volume is #{@length * @width * @height}\"\n end",
"def peak_volume(type=TagLib::ID3v2::RelativeVolumeFrame::MasterVolume)\n end",
"def volume_calc(length,width,height)\n volume = length * width * height\n end",
"def on_sound_volume_changed(newVolume)\n end",
"def music_volume=(value)\n value = value.to_i.abs\n @music_volume = value < 101 ? value : 100\n end",
"def get_max_volume(file)\n output = `ffmpeg -i '#{file}' -af \"volumedetect\" -f null /dev/null 2>&1`\n raise \"Error getting audio volume from #{file} (#{$CHILD_STATUS})\" unless $CHILD_STATUS.success?\n s = output.encode(\"UTF-16be\", :invalid=>:replace, :replace=>\"?\").encode('UTF-8')\n @sound_volume = s.scan(/max_volume: ([\\-\\d\\.]+) dB/).flatten.first\n end",
"def master_volume=(value)\n self.music_volume = value\n self.sfx_volume = value\n end",
"def get_volume()\n return(get_cmd('AG;',0.1,0.5,3).gsub(/^AG/,'').gsub(/;$/,'').to_i)\nend",
"def sound_volume obj1, obj2 = @player\n ##pos = -((pos.dist(obj.pos)/3) * 0.001)+0.1\n #obj1 = -((obj1.dist(obj2.pos)/7) * 0.001)+0.1\n (obj1 = 0.1 - ((obj1.dist(obj2.pos)/7) * 0.001)) < 0 ? nil : obj1\n end",
"def volume=(setting)\n app.speakers.ID(@id).volume.set setting\n volume\n end",
"def radioVolume \n \"radioVolume\" \n end",
"def volume\n return nil if dimension_u.nil? || dimension_v.nil? || dimension_w.nil?\n (dimension_u * dimension_v * dimension_w) / 1_000_000_000.0\n end",
"def sfx_volume=(value)\n return unless value.between?(0, 100)\n @sfx_volume = Audio.sfx_volume = value\n end",
"def volume_adjustment\n @ole.VolumeAdjustment\n end",
"def volume_params\n params[:volume]\n end",
"def series_volume\n end",
"def audio\n @audio ||= (\n id = @params[:audio_track]\n ::Audio.find(id) if id\n )\n end",
"def do_volume(num)\n\n fail CvlcClientError, \"The 'volume' command requires an integer value between 0 and 300...\" unless num.between?(0, 300)\n do_command(\"requests/status.json?command=volume&val=#{num}\")\n sleep STATUS_PAUSE\n return pretty_status(current_status)\n end",
"def get_volume(volume_id)\n get(\"cloud-instances/#{guid}/volumes/#{volume_id}\")\n end",
"def volume(level = nil)\n return Integer(connection.write(\"volume\", false)) if level.nil?\n connection.write(\"volume #{Integer(level)}\")\n rescue ArgumentError\n level.nil? ? 0 : nil\n end",
"def volume(level = nil)\n return Integer(connection.write(\"volume\", false)) if level.nil?\n connection.write(\"volume #{Integer(level)}\")\n rescue ArgumentError\n level.nil? ? 0 : nil\n end",
"def volume(level = nil)\n level.nil? ? Integer(connection.write(\"volume\", false)) : connection.write(\"volume #{Integer(level)}\")\n rescue ArgumentError\n level.nil? ? 0 : nil\n end",
"def set_volume\n @volume = Volume.find(params[:id])\n end",
"def set_volume\n @volume = Volume.find(params[:id])\n end",
"def sample_rate\n mediainfo.audio.samplingrate\n end",
"def determine_volume\n vol = currently_attached_volume(instance_id, new_resource.device)\n vol_id = new_resource.volume_id || volume_id_in_node_data || ( vol ? vol[:aws_id] : nil )\n raise \"volume_id attribute not set and no volume id is set in the node data for this resource (which is populated by action :create) and no volume is attached at the device\" unless vol_id\n\n # check that volume exists\n vol = volume_by_id(vol_id)\n raise \"No volume with id #{vol_id} exists\" unless vol\n\n vol\n end",
"def get_vol\n\t\tIO::popen('amixer sget Master') do |f|\n\t\t\tf.read.scan(/Front Left.*?\\[(\\d+)%\\].*?\\[(on|off)\\]\\n/) do |pc, on_or_off|\n\t\t\t\treturn {\n\t\t\t\t\t:vol => pc.to_i,\n\t\t\t\t\t:mute => 'off' == on_or_off\n\t\t\t\t}\n\t\t\tend\n\t\tend\n\t\treturn { :vol => -1, :mute => false }\n\tend",
"def sfx_volume=(value)\n value = value.to_i.abs\n @sfx_volume = value < 101 ? value : 100\n end",
"def mute\n @volume = 0\n end",
"def volume(volume_id)\n volumes(volume_id)[0]\n end",
"def volume\n a, b, c, d = @points\n ((a - d) % ((b - d) * (c - d))) / 6\n end",
"def volume_type\n return @volume_type\n end",
"def volume(options)\n options[:width] * options[:height] * options[:depth]\nend",
"def sound_volume_control_enabled\n @ole.SoundVolumeControlEnabled\n end",
"def set_volume\n @volume = services.block_storage.get_volume(params[:id])\n end",
"def audio\n first_stream_of :audio\n end",
"def volume(x)\n\t\tsynchronized do\n\t\t\[email protected] \"volume #{x}\"\n\t\tend\n\tend",
"def teleported_volume; self.class.teleported_volume(level); end",
"def series_volume(field = nil)\n find_record_value(field, clean: false) if field\n end",
"def volume _value, _abs=0\n send_cmd(\"volume #{_value} #{_abs}\")\n end",
"def volume(result)\n return result['trades']['entries'].collect do |data|\n volume = data[1].to_f\n end\n end",
"def volume (l, w, h)\n\tl * w * h\nend",
"def pints\n Measurements::USVolume.new(self, :pint)\n end",
"def get_vibration\n $game_system.vibration_rate\n end",
"def storage_volume\n chs = cumulative_surplus\n chs_min = chs.min\n\n chs.map { |val| val - chs_min }\n end",
"def name\n self['VolumeName']\n end",
"def volume(volume_name, attrs={}, &block)\n volumes[volume_name] ||= Ironfan::Volume.new(:parent => self, :name => volume_name)\n volumes[volume_name].configure(attrs, &block)\n volumes[volume_name]\n end",
"def volume_m3\n ft3_to_m3(self.volume)\n end",
"def cVolume r,l,m\n return 0 if r == 0\n z = r-m\n l*(r*r * Math.acos(z/r)-z*(2*r*m - m*m)**0.5)\nend",
"def fetch_volume_by_id\n vol = storage_api.find_by_id(volume_id)\n data = vol.body.fetch(\"volume\")\n @name = data.fetch('display_name')\n @volume_type = data.fetch('volume_type')\n @size = data.fetch('size')\n\n # Sometimes the Rackspace API takes time to update,\n # and newly-attached volumes don't report any attachments\n # yet.\n attachments = data.fetch('attachments')\n if attachments.any?\n @device = attachments.first.fetch('device')\n end\n end",
"def volume_size\n # If not user-specified, I'm using a fudge factor of 1.5 on the volume size -- arbitrarily chosen\n @volume_size || (`du -x #{volume_to_bundle}`.split(/\\n/)[-1].split[0].to_f * 1.5 / 1024).ceil\n end",
"def current_space\n if @parcels.empty?\n @volume.to_i\n else\n sum = 0\n @parcels.each do |parcel|\n sum += parcel.volume.to_i\n end\n @volume.to_i - sum\n end\n end",
"def volume_weight(dimension: nil)\n if self.custom_volume_weight_enabled && self.volume_weight_factor\n factor = self.volume_weight_factor\n volume_weight = Float((dimension.length * dimension.width * dimension.height)) / Float(factor)\n\n return volume_weight\n else\n return 0\n end\n end",
"def show_vol()\n\t\tvm = get_vol\n\t\[email protected]=$muted_colors[vm[:mute]]\n\t\[email protected]='Volume'\n\t\[email protected] += ' (Muted)' if vm[:mute]\n\t\[email protected]=vm[:vol]\n\t\[email protected]=5\n\tend",
"def get_audio_bitrate \n send_cmd(\"get_audio_bitrate\")\n end",
"def audio; end",
"def volume(percent)\n url = \"me/player/volume?volume_percent=#{percent}\"\n User.oauth_put(@user.id, url, {})\n end",
"def adjust_engine_volume(direction)\n case direction\n when \"up\"\n if @current_engine_volume < 1\n @current_engine_volume += 0.025\n @engine_sound.volume = @current_engine_volume\n end\n when \"down\"\n if @current_engine_volume > 0\n @current_engine_volume *= 0.95\n @current_engine_volume = 0 unless @current_engine_volume > 0.05\n @engine_sound.volume = @current_engine_volume\n end\n end\n end",
"def vol_perc\n if match = @args[:props][\"volume\"].to_s.match(/(\\d+):\\s*([\\d\\.]+)%/)\n return match[2].to_i\n end\n \n raise \"Could not figure out the volume from properties: '#{@args[:props]}'.\"\n end",
"def volume(max_vol, max_dist)\n if distance_from($game_player) > max_dist then 0 \n else [max_vol,\n (max_vol / max_dist) * (max_dist+1 - distance_from($game_player))].min\n end\n end",
"def get_audio_samples \n send_cmd(\"get_audio_samples\")\n end",
"def volume_of_sphere(radius)\n return 3.14 * 4 / 3 * (radius ** 3)\n return volume\nend",
"def calc_sphere_volume(radius)\n answer = (4.0/3.0)*Math::PI*(radius**3)\n return answer.round(1)\nend",
"def voltage\n raw_voltage = File.read('/sys/bus/iio/devices/iio:device0/in_voltage0_raw').strip.to_f\n scale = File.read('/sys/bus/iio/devices/iio:device0/in_voltage_scale').strip.to_f\n @voltage = raw_voltage * scale\n end",
"def set_actual_volume\n @actual_volume = ActualVolume.find(params[:id])\n end",
"def total_volume(with_unit)\n if with_unit\n (quantity * volume.to_d).to_s + unit\n else\n quantity * volume.to_d\n end\n end",
"def audio\n @streams.select { |stream| stream.is_a? AudioStream }\n end",
"def to_wav\n @audio\n end",
"def audio_stream\n @audio_stream ||= streams.find do |stream|\n stream.codec_context.codec_type == :AUDIO\n end\n end",
"def update(mute, volume)\n if mute\n vol = 0\n @cMuteLabel.visible = true\n @cVolumeValue.visible = false\n else\n vol = 100 - volume\n @cMuteLabel.visible = false\n @cVolumeValue.visible = true\n end\n @cVolumeValue.text = sprintf(MENU_CONFIG::VOL_PATTERN, vol)\n @ucVolumeBar.value = vol\n end",
"def update(mute, volume)\n if mute\n vol = 0\n @cMuteLabel.visible = true\n @cVolumeValue.visible = false\n else\n vol = 100 - volume\n @cMuteLabel.visible = false\n @cVolumeValue.visible = true\n end\n @cVolumeValue.text = sprintf(MENU_CONFIG::VOL_PATTERN, vol)\n @ucVolumeBar.value = vol\n end",
"def volume_of_sphere(radius)\n volume = (4.0/3.0)*3.141592654*(radius**3)\n return volume.to_i\nend",
"def voltage\n lfac_device = '/sys/bus/iio/devices/iio:device0/'\n raw_voltage = File.read(File.join(lfac_device, 'in_voltage0_raw')).strip.to_f\n scale = File.read(File.join(lfac_device, 'in_voltage_scale')).strip.to_f\n @voltage = raw_voltage * scale\n end",
"def get_road_volume\n @volumes_east = RoadVolume.get_road_volume('East')\n @volumes_west = RoadVolume.get_road_volume('West')\n end"
] | [
"0.8180773",
"0.80607337",
"0.80332917",
"0.7998777",
"0.74877846",
"0.7463108",
"0.74621826",
"0.74368846",
"0.73177254",
"0.709422",
"0.68999285",
"0.6895582",
"0.6848924",
"0.68354607",
"0.6809705",
"0.6801501",
"0.67704874",
"0.6693433",
"0.6636842",
"0.6629667",
"0.6619651",
"0.65833956",
"0.65218556",
"0.6505475",
"0.64469737",
"0.64408684",
"0.6399452",
"0.6349836",
"0.634928",
"0.6344599",
"0.6321736",
"0.63122785",
"0.6272674",
"0.62698805",
"0.6258616",
"0.62129796",
"0.62060297",
"0.61889565",
"0.6155347",
"0.6151291",
"0.61494285",
"0.6144395",
"0.6126024",
"0.61245716",
"0.611589",
"0.61066705",
"0.61066705",
"0.607569",
"0.6042569",
"0.6042569",
"0.60382783",
"0.6038191",
"0.601507",
"0.59912294",
"0.5985829",
"0.5984986",
"0.59600365",
"0.59454936",
"0.59424335",
"0.5925004",
"0.5891887",
"0.5858064",
"0.5845823",
"0.5842825",
"0.58184963",
"0.5787909",
"0.57637453",
"0.57615",
"0.5751499",
"0.5713879",
"0.56980884",
"0.5692467",
"0.5686589",
"0.56757694",
"0.56500894",
"0.56094027",
"0.5574159",
"0.5556344",
"0.5555762",
"0.55414236",
"0.55297136",
"0.55046374",
"0.5498685",
"0.5497107",
"0.5495415",
"0.54837584",
"0.5481801",
"0.5476173",
"0.54756254",
"0.5473367",
"0.5472746",
"0.5470082",
"0.5454163",
"0.54394794",
"0.5438117",
"0.54336804",
"0.54336804",
"0.5429985",
"0.539487",
"0.53924114"
] | 0.80826336 | 1 |
play the audio resource in the window/tab it was created in if resource was paused, it will start playing from where it left off | def play
@sound += 1
@sound %= @overlap
`#{@sounds[@sound]}.play()`
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play\n @playing = true\n Audio.play_wav(@audio)\n @playing = false\n end",
"def play\n Audio::Out.add @cpg\n @is_playing = true\n #Audio::Out.add @actuator\n end",
"def main_audio\r\n super\r\n # Stop BGM and BGS\r\n $game_system.bgm_play(nil)\r\n $game_system.bgs_play(nil)\r\n # Play game over ME\r\n $game_system.me_play($data_system.gameover_me)\r\n end",
"def play\n synchronize do\n @starved = false\n @source.play\n end\n end",
"def play_song(id)\n @pause_play = \"pause\" # Resets pause button\n @song_settings.stop rescue nil # Makes sure no other song is playing\n begin\n path = @data_array[@selected_album].songs[id.to_i].location\n wave = WaveInfo.new(path) # Uses wave info gem to grab info from wav\n @song_length = wave.duration # Broadcasts song duration\n @tick = Gosu.milliseconds # Resets ticker so that @count_up starts at 0\n @currently_playing = id # Broadcasts currently playing song\n @playing_album_name = @data_array[@selected_album].title.upcase\n @playing_song_name = @data_array[@selected_album].songs[id].name.upcase\n @playing_thumbnail = @data_array[@selected_album].cover\n song = Gosu::Sample.new(path) # Sample plays wav file from path\n @song_settings = song.play(100,1,false)\n @show_playbar = true\n rescue\n @show_player = false\n stop_song()\n puts \"SONG WAS NOT FOUND\".red\n end\nend",
"def play(&blk)\n start_playing\n blk.call\n ensure\n stop_playing\n end",
"def start_playbar\n if @pause_play == \"pause\"\n @count_up = (Gosu.milliseconds - @tick)\n seconds = @count_up / 1000\n @progress = seconds * WIDTH / @song_length # Fits relative progress to window width\n\n # Statements handle song repeating and or next\n # track functionality\n if seconds >= @song_length.to_i && @repeat_song\n play_song(@currently_playing)\n elsif seconds >= @song_length.to_i\n play_song(@currently_playing + 1)\n end\n else\n @tick = Gosu.milliseconds - @count_up # pauses counter at current time\n end\nend",
"def load_song\n location = File.expand_path(\"..\", Dir.pwd) + \"/res/five.mid\"\n\t#location = location.gsub('/', '\\\\')\n\t#puts location\n\t@btn_play.enable\n\t@btn_pause.enable\n\t@btn_stop.enable\n\t\n @mc.load(location)\n\t\n\t#play_song\n end",
"def main_audio\r\n super\r\n # Play title BGM\r\n $game_system.bgm_play($data_system.title_bgm)\r\n # Stop playing ME and BGS\r\n Audio.me_stop\r\n Audio.bgs_stop\r\n end",
"def play_action\n @status.playback_state = :playing\n update_status\n end",
"def play()\n @ole.Play()\n end",
"def play()\n @ole.Play()\n end",
"def play!\n if @file\n fork do\n begin\n system \"play #{@file}\" # exec\n rescue\n \t puts \"error playing sound\"\n end\n end\n end\n end",
"def play_title_music\r\n\r\n$data_system.title_bgm.play\r\n\r\nRPG::BGS.stop\r\n\r\nRPG::ME.stop\r\n\r\nend",
"def play_song(sender)\n clicked_pos = self.songs_view.clickedRow\n if clicked_pos == -1 # first song or same song\n if @current_song.try(:song).try(:playing?) # same song\n clicked_pos = @current_song.position\n else\n clicked_pos = 0\n end\n end\n @current_song.song.stop if @current_song\n\n filename = @display_filenames[clicked_pos]\n @current_song = Song.new(filename, clicked_pos, self)\n @current_song.song.play\n end",
"def update\n\n # Can't do anything if the music isn't turned on, with a track queued\n return unless @active_track && @track_queued && @music && @audio\n\n # Also, if music is already playing we don't have to do anything.\n # This shouldn't be possible, but worth guarding against anyway\n return if @music_playing\n\n # So, start the music playing\n $gtk.args.outputs.sounds << @active_track\n\n # And set the flags right\n @track_queued = false\n @music_playing = true\n\n end",
"def process_ok\n Sound.play_ok\n super\n end",
"def pause\n `#{@sound}.pause()`\n end",
"def startPlayback\n end",
"def playFromLocalFileButtonTouched\n self.delegate.audioPlayerViewPlayFromLocalFileSelected(self)\n end",
"def play\n end",
"def play; end",
"def run_player_for(audio_file)\n @mp = JavaMusicPlayer.new(audio_file)\n @mp.play\n end",
"def play \n end",
"def play\n self\n end",
"def p\n $is_last_recording_playing = !$is_last_recording_playing\n if $is_last_recording_playing\n Thread.new do\n path = File.most_recently_edited(\"./recording/*.mp3\")\n Thread.new do\n unless path.blank?\n while $is_last_recording_playing\n Sounds::Base.play_file_with_mpg123 path \n end\n end\n end\n puts \"playing #{path}\"\n end\n else\n puts \"stopped playback\"\n end\n end",
"def play\n end",
"def play\n end",
"def play\n end",
"def play\n end",
"def play\n \n end",
"def play(amplitude)\n play_tone(self, amplitude)\n end",
"def play\n idx = rand(audio_file_count)\n audio_file = audio_file_from_list(idx)\n run_player_loop_for(audio_file)\n end",
"def play\n @@plays += 1\n end",
"def play\n unless @av_player.nil?\n @av_player.currentTime = 0.0\n @av_player.play\n end\n end",
"def run_player_loop_for(audio_file)\n @mp = JavaMusicPlayer.new(audio_file)\n @mp.play_loop\n end",
"def play_title_music\n $data_system.title_bgm.play\n RPG::BGS.stop\n RPG::ME.stop\n end",
"def play_title_music\n $data_system.title_bgm.play\n RPG::BGS.stop\n RPG::ME.stop\n end",
"def play_sound(index)\n Audio.me_play(ME_TO_PLAY) if index == 0\n end",
"def music=(flag)\n\n # Save the flag\n @music = flag\n\n # If we've turned music on, resume any music that's paused\n if @music\n resume\n # Otherwise, pause which will stop anything that's currently playing\n else\n pause\n end\n\n end",
"def play\n\t\t\"playing #{title}\"\n\tend",
"def play_sound\n system 'afplay ./app/sounds/test_sound.mp3 &'\n end",
"def play_pause()\n @ole.PlayPause()\n end",
"def play_sound \n system\"play #{@sound_file}\"\n end",
"def play\n\tend",
"def started_playing(player_data)\n return self\n end",
"def setup_sound\n return unless PONY::ERRNO::check_sequence(current_act)\n name = @acts[1]\n vol = @acts[2] || 100\n pitch = @acts[3] || 100\n RPG::SE.new(name,vol,pitch).play\n end",
"def process_x\n if current_item_enabled?\n Sound.play_ok\n super\n else\n Sound.play_buzzer\n end\n end",
"def play\n puts 'Playing'\n end",
"def play_select_active_sound\n if FileTest.exist?('Audio/SE/SelectActive.mp3') or \n FileTest.exist?('Audio/SE/SelectActive.wav') or FileTest.exist?('Audio/SE/SelectActive.ogg')\n Audio.se_play('Audio/SE/SelectActive', 100, 100)\n end\n end",
"def play_sound(soundName)\r\n\t\texec(\"playback\", soundName)\r\n\tend",
"def play_audio(data)\n @client.make_request(:post, @client.concat_user_path(\"#{CALL_PATH}/#{id}/audio\"), data)[0]\n end",
"def playSound _args\n \"playSound _args;\" \n end",
"def play_music\n $game_system.bgm_memorize2\n Audio.bgm_stop\n Audio.bgm_play(Evolve::EVOLVE_MUSIC)\n end",
"def im_done(playlist)\n #Stop the playlist\n Process.kill @music_pid\n #Grab and play the next playist, if there is one\n @current_playlist = @queue.shift and play @current_playlist \n end",
"def started_playing(player_data)\n do_started_playing(self, player_data)\n end",
"def buz; Sound.play_buzzer; end",
"def commandnewgame_audio\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Stop BGM\r\n Audio.bgm_stop\r\n end",
"def pause\n @paused = true\n end",
"def pause\n @paused = true\n end",
"def play(filename, options = {})\n # Needs a key, and a filename. Use the filename as the key\n key = filename\n $window.Crafty.audio.add(key, filename)\n loop = options[:loop] || false\n loop = (loop == true) ? -1 : 1\n $window.Crafty.audio.play(key, loop)\n end",
"def play(event)\n # Determine the path to the event mp3 and spawn mplayer to play it.\n file = File.expand_path(File.join(TRACK_BASE, \"#{event}.mp3\"))\n\n if (!File.exist?(file))\n puts \"No file to play: #{file}\"\n return false\n end\n\n # Load (play) the file after stopping any previous one\n stop()\n %x{#{echo()} loadfile \"#{file}\" > #{fifo()}} if running?\n system \"stty #{$app.old_stty}\" # restore stty settings\n end",
"def play_tone(tone, amplitude)\n open_tone_clip(tone, amplitude, clip)\n clip.start\n clip.drain\n clip.close\n end",
"def play_tone(tone, amplitude)\n player.play_tone(tone, amplitude)\n end",
"def play\r\n return if self.finished?\r\n self.update\r\n end",
"def play_sound(type)\r\n @log.debug(\"Play sound #{type}, os: #{$g_os_type}\")\r\n sound = get_sound_source(type)\r\n \r\n #p @sound_enabled\r\n @linux_sound_stoppped[type] = false\r\n if sound and @sound_enabled == true\r\n Thread.new{\r\n if $g_os_type == :win32_system\r\n Sound.play(sound, @duration_win[type] )\r\n end\r\n if $g_os_type == :linux\r\n while !@linux_sound_stoppped[type]\r\n system(\"aplay -q \" + sound)\r\n break if @duration_linux[type] != :loop\r\n end\r\n end \r\n }\r\n end\r\n end",
"def pause\n @paused += 1\n end",
"def playing?\n self.play_start != nil\n end",
"def enable_audio(on: true)\n\n # Set the flag\n @audio_handler.audio = on\n\n # Update the icon\n @audio_sprite.path =\n if @audio_handler.audio\n 'vertices/sprites/audioOn.png'\n else\n 'vertices/sprites/audioOff.png'\n end\n\n end",
"def play_audio(data)\n @client.make_request(:post, @client.concat_user_path(\"#{CONFERENCE_PATH}/#{id}/audio\"), data)[0]\n end",
"def pause\n @av_player.pause unless @av_player.nil?\n end",
"def play_se_for_item\n # Don't play the sound\n end",
"def play(playlist)\n playlist.run\n @music_pid = fork do\n exec \"mplayer\", \"-cache\", \"1024\", \"-really-quiet\", \"-noconsolecontrols\", \n \"-ao\", \"alsa:device=hw=#{@number}.0\", playlist.url \n end\n end",
"def play\n each do |playable|\n if playable.respond_to?(:play)\n playable.play\n end\n end\n end",
"def audio; end",
"def play_music\n pid = fork{ exec 'afplay', \"app/models/coffee_music.mp3\" }\nend",
"def on\n loop do\n while @count < @playlist.size\n self.play_music\n self.wait\n end\n if (@repeat) # If @repeat is true, resets playlist and loops through again\n @count = 0\n else\n break\n end\n end\n @count = 0\n end",
"def play_track(path)\r\n @song = Gosu::Song.new(path)\r\n @song.play(false)\r\n end",
"def play(song_name,options={})\n draw song_name, options.merge(model: \"metro::audio::song\")\n end",
"def main_audio ; end",
"def play\n must_be_ready!\n stop if running?\n \n info \"PLAY: #{opts[:path]}\"\n worker.startup!\n end",
"def play_sound(filename)\n path = Java::limelight.Context.fs.path_to(scene.path, filename)\n @peer.play_sound(path)\n end",
"def play_sound\n case @type\n when 1; Sound.play_forge_item\n when 2; Sound.play_forge_weapon\n when 3; Sound.play_forge_armor\n else; Sound.play_use_item\n end\n end",
"def play_first_track()\n @ole.PlayFirstTrack()\n end",
"def play_first_track()\n @ole.PlayFirstTrack()\n end",
"def run\n @music.play(:repeats => -1)\n\thook_run()\n\thook_quit()\n\t# Handling input\n\tloop do\n\t @queue.each do |event|\n\t\thandle(event)\n end\n\t# Draw the image to screen\n\t@intro_screen.blit(@screen,[0,0])\n\[email protected]()\n end\n end",
"def audio\n \t@playlist = Playlist.last\n send_glued_audio('list', :playlist => @playlist)\n end",
"def bubble_sound\n pid = fork{exec 'afplay', \"lib/Large_bubble_sound.mp3\"}\n end",
"def sound; end",
"def play\n\t\tgame_loop\n\tend",
"def play!\n update_attributes!(:status => :playing, :played_at => Time.now)\n self\n end",
"def play_audio(data)\n @client.make_request(:post, @client.concat_user_path(\"#{BRIDGE_PATH}/#{id}/audio\"), data)[0]\n end",
"def play!\n @playlist.shift\n end",
"def start_music\n pid = fork { Play::Client.loop }\n Process.detach(pid)\nend",
"def call\n if context.dj.player.stopped?\n related = context.dj.add_related\n if related\n context.dj.switch!\n context.message = [ \"Autoplaying.. #{ related }\" ].join(\" \")\n else\n context.errors = \"Failed getting related video.\"\n context.fail!\n end\n else\n current_video = context.dj.current_video\n context.message = \"Skipping!\"\n next_title = context.dj.switch!\n if next_title\n context.message = [ context.message, \"Playing #{ next_title }\" ].join(\" \")\n else\n context.message = \"Nothing to play, add some songs to playlist.\"\n end\n end\n end",
"def run_play(source, devices, player, storage)\n devices.tv_on\n\n start = Time.now\n player.play(source)\n run_alarm_fallback if Time.now - start < 5.0\n\n devices.tv_off\n storage.remove_sources(source)\n devices.storage_unmount\n sleep 5\n devices.storage_sleep\n end",
"def Animate_Play(hwnd, from, to, rep)\r\n send_animation_message(hwnd, :PLAY, wparam: rep, lparam: MAKELONG(from, to))\r\n end",
"def play_songs\n MusicImporter.new(path).play_song\n end",
"def play\n @hungry = true\n #p \"play method called\" #print notification to console\n end",
"def play what\n case Avalon::Config[:alert_sounds]\n when false, :none, :no\n when Hash\n tunes = [Avalon::Config[:alert_sounds][what] || what].compact.flatten\n\n tunes.each do |tune|\n file = find_file( tune, \"../../../sound/#{tune}\",\n \"~/.avalon/sound/#{tune}\", \"/System/Library/Sounds/#{tune}\")\n case system\n when 'Darwin'\n `afplay #{file}`\n when 'Linux'\n raise 'Please install sox package: sudo apt-get install sox' if `which sox`.empty?\n `play -q #{file}`\n end\n end\n end\n end"
] | [
"0.70804715",
"0.671021",
"0.6582193",
"0.6479036",
"0.64304394",
"0.6428696",
"0.6427691",
"0.6422184",
"0.63908917",
"0.6360171",
"0.63428414",
"0.63428414",
"0.6326327",
"0.6319302",
"0.63063884",
"0.62868285",
"0.62850004",
"0.6265815",
"0.62504923",
"0.6238803",
"0.6228417",
"0.6190062",
"0.6180119",
"0.6174765",
"0.61714697",
"0.6162588",
"0.6158636",
"0.6158636",
"0.6158636",
"0.6158636",
"0.6135812",
"0.6127328",
"0.61198217",
"0.61195433",
"0.6110661",
"0.61048144",
"0.60865813",
"0.60865813",
"0.60840404",
"0.60787106",
"0.60641253",
"0.6057234",
"0.6049411",
"0.6044849",
"0.602627",
"0.60146487",
"0.6011547",
"0.6005855",
"0.599199",
"0.59825575",
"0.5981863",
"0.5981458",
"0.59723735",
"0.5969827",
"0.5966779",
"0.59631884",
"0.59473574",
"0.59361285",
"0.59225464",
"0.59225464",
"0.59187436",
"0.5907467",
"0.5880981",
"0.5867289",
"0.5866557",
"0.586068",
"0.5859276",
"0.58329606",
"0.5814171",
"0.5811683",
"0.5808242",
"0.58040583",
"0.57959914",
"0.57890743",
"0.57863706",
"0.5779693",
"0.57790494",
"0.5769168",
"0.5766359",
"0.5748379",
"0.57466835",
"0.57456756",
"0.5738437",
"0.57357717",
"0.57357717",
"0.5730204",
"0.57279205",
"0.57184815",
"0.57183844",
"0.5712384",
"0.5711954",
"0.5708943",
"0.5708448",
"0.56972694",
"0.56592995",
"0.5651342",
"0.56426203",
"0.5631455",
"0.5629765",
"0.5626077"
] | 0.6788529 | 1 |
pause the audio resource, halting playback | def pause
`#{@sound}.pause()`
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pause\n @av_player.pause unless @av_player.nil?\n end",
"def unpause\n @paused -= 1\n end",
"def halt!\n @running = false\n @audio.stop_audio\n @hardware_interface.teardown\n end",
"def raw_pause\n raw_stop\n end",
"def raw_pause\n raw_stop\n end",
"def pause\n @paused = true\n end",
"def pause\n @paused = true\n end",
"def pause\n puts \"Pausing Microwave...\"\n send_request(:command => :pause)\n end",
"def skip\n @song.kill\n @music.off\n end",
"def pause\n @paused += 1\n end",
"def play_pause()\n @ole.PlayPause()\n end",
"def pause()\r\n # nothing here\r\n end",
"def stop\n @av_player.stop unless @av_player.nil?\n end",
"def off\n @music.off\n @playlist.clear\n @song.kill\n end",
"def pause!\n @state = :paused\n end",
"def pause!\n @paused = true\n raise(Paused)\n end",
"def pause\n with_queue_control do |control|\n control.pause\n end\n end",
"def cmd_pause argv\n setup argv\n uuid = @hash['uuid']\n response = @api.pause(uuid)\n msg response\n return response\n end",
"def raw_pause\n raise NotImplementedError, _(\"must be implemented in a subclass\")\n end",
"def toggle_pause()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.Timer_toggle_pause(@handle.ptr)\n end",
"def unpause\n @service.context.post(@control_path, :action => 'unpause')\n self\n end",
"def stop_audio\n @music.each do |music|\n music.fade_out(@fade_ms)\n end\n @channels.each_with_index do |channel, index|\n SDL2::Mixer::Channels.fade_out(index, @fade_ms) if channel\n end\n @sounds.each do |sound|\n sound.destroy if sound && !sound.destroy?\n end\n end",
"def pause\n unless(@paused)\n @paused = true\n reset\n end\n current_self\n end",
"def pause\n\n end",
"def pause()\n #This is a stub, used for indexing\n end",
"def pause\n end",
"def pause\n end",
"def pause\n end",
"def stop\n if @playing\n @should_stop = true\n end\n end",
"def pause!\n @paused_mutex.synchronize do\n @paused += 1\n end\n self\n end",
"def mute\n @volume = 0\n end",
"def stop\n Audio::Out.remove @cpg\n @is_playing = false\n #Audio::Out.remove @actuator\n end",
"def pause\n FMOD.invoke(:ChannelGroup_SetPaused, self, 1)\n self\n end",
"def pause_or_unpause\n paused? ? unpause : pause\n end",
"def pause; end",
"def pause\n @pause_queue << :paused\n end",
"def stop_song()\n @song_settings.stop rescue nil\n @show_playbar = false\nend",
"def turn_off_speaker\n puts \"SPEAKER OFF\"\n # The daemons gem will handle the stopping of the \n # # audio file playing process\n #if File.exist?( ALARM_FILE )\n if Applications.alarm_on?\n `#{SOUND_CONTROL_FILE} stop`\n # Delete file to show that the alarm is on\n #File.delete( ALARM_FILE )\n Applications.alarm_off\n end\n end",
"def pause\n return unless running?\n return if paused?\n info \"PAUSE!\"\n send_command :pause\n @paused = true\n callback! :pause, true\n end",
"def stop()\n if running?\n # stop sound then reset parameters in case they were previously changed\n %x{#{echo()} stop > #{fifo()}}\n system \"stty #{$app.old_stty}\" # restore stty settings\n end\n end",
"def pause(p)\n\t\t@pause = p\n\tend",
"def pause\n @service.context.post(@control_path, :action => 'pause')\n self\n end",
"def stop_sound(type)\r\n begin\r\n set_duration(type, :async)\r\n if $g_os_type == :win32_system\r\n Thread.new{Sound.stop()}\r\n end\r\n if $g_os_type == :linux\r\n @linux_sound_stoppped[type] = true\r\n end\r\n rescue\r\n @log.error(\"stop_sound #{type}, os: #{$g_os_type}\")\r\n end\r\n end",
"def main_audio\r\n super\r\n # Stop BGM and BGS\r\n $game_system.bgm_play(nil)\r\n $game_system.bgs_play(nil)\r\n # Play game over ME\r\n $game_system.me_play($data_system.gameover_me)\r\n end",
"def pause\n sleep PAUSE_SECONDS\n end",
"def pause\n sleep PAUSE_SECONDS\n end",
"def pause!\n raise InvalidActionError, \"Cannot pause a Say that is not executing\" unless executing?\n pause_action.tap do |action|\n result = write_action action\n paused! if result\n end\n end",
"def blow\n\t\tif !@is_blown\n\t\t\t@is_blown = @has_changed = true\n\t\t\t@start_time = Gosu::milliseconds\n\t\t\t@@sound.play\n\t\tend\n\tend",
"def play\n @playing = true\n Audio.play_wav(@audio)\n @playing = false\n end",
"def resume\n FMOD.invoke(:ChannelGroup_SetPaused, self, 0)\n self\n end",
"def pause()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.Timer_pause(@handle.ptr)\n end",
"def resume!\n should_flush = @paused_mutex.synchronize do\n @paused -= 1 if @paused > 0\n @paused == 0\n end\n flush! if should_flush\n self\n end",
"def pause(deck = nil)\n raise ResumeFrom, deck\n end",
"def pause\n @data[\"pause\"]\n end",
"def pause\n @actor << 'PAUSE'\n @actor.wait\n end",
"def pause(device: T.unsafe(nil), duration: T.unsafe(nil)); end",
"def pause\n \tsleeper(25)\n end",
"def pause\n \tsleeper(25)\n end",
"def pause\n @chrono.pause()\n self\n end",
"def pause_processing\n @processing = false\n end",
"def unpause\n @server.make_json_request('show.pause', tvdbid: @tvdbid)['message']\n end",
"def toggle_pause_or_start()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.Timer_toggle_pause_or_start(@handle.ptr)\n end",
"def main_audio\r\n super\r\n # Play title BGM\r\n $game_system.bgm_play($data_system.title_bgm)\r\n # Stop playing ME and BGS\r\n Audio.me_stop\r\n Audio.bgs_stop\r\n end",
"def command_cancel\n Sound.play_decision\n return_scene\n end",
"def lightning_crash!\n # Thunder!\n OMX.play('thunder_crash.mp3', :overlap => true)\n\n # Lightning\n OUTPUTS[:r1].off\n sleep 0.55\n OUTPUTS[:r1].on\n\n # Wait for the audio to finish\n sleep 19\n\n # SCARY!\nend",
"def toggle_pause()\n %x{#{echo} pause > #{fifo()}} if running?\n system \"stty #{$app.old_stty}\" # restore stty settings\n end",
"def music=(flag)\n\n # Save the flag\n @music = flag\n\n # If we've turned music on, resume any music that's paused\n if @music\n resume\n # Otherwise, pause which will stop anything that's currently playing\n else\n pause\n end\n\n end",
"def pause()\n @ole.Pause()\n end",
"def pause\n if !block_given?\n @j_del.java_method(:pause, []).call()\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling pause()\"\n end",
"def play_song(id)\n @pause_play = \"pause\" # Resets pause button\n @song_settings.stop rescue nil # Makes sure no other song is playing\n begin\n path = @data_array[@selected_album].songs[id.to_i].location\n wave = WaveInfo.new(path) # Uses wave info gem to grab info from wav\n @song_length = wave.duration # Broadcasts song duration\n @tick = Gosu.milliseconds # Resets ticker so that @count_up starts at 0\n @currently_playing = id # Broadcasts currently playing song\n @playing_album_name = @data_array[@selected_album].title.upcase\n @playing_song_name = @data_array[@selected_album].songs[id].name.upcase\n @playing_thumbnail = @data_array[@selected_album].cover\n song = Gosu::Sample.new(path) # Sample plays wav file from path\n @song_settings = song.play(100,1,false)\n @show_playbar = true\n rescue\n @show_player = false\n stop_song()\n puts \"SONG WAS NOT FOUND\".red\n end\nend",
"def play_se_for_item\n # Don't play the sound\n end",
"def pause!\n raise InvalidActionError, \"Cannot pause a Output that is not executing\" unless executing?\n pause_action.tap do |action|\n result = write_action action\n paused! if result\n end\n end",
"def pause; self.app.pause end",
"def process_ok\n Sound.play_ok\n super\n end",
"def pause\n if listener.paused?\n ::Guard::UI.info 'Un-paused files modification listening', reset: true\n listener.unpause\n else\n ::Guard::UI.info 'Paused files modification listening', reset: true\n listener.pause\n end\n end",
"def switch_audio _value=0\n send_cmd(\"switch_audio #{_value}\")\n end",
"def pause(cycles)\n @paused = true\n @paused_counter = cycles\n end",
"def pause(cycles)\n @paused = true\n @paused_counter = cycles\n end",
"def pause!\n raise InvalidActionError, \"Cannot pause a Output that is not executing\" unless executing?\n pause_action.tap do |action|\n result = write_action action\n paused! if result\n end\n end",
"def pause_music\n #pause itunes - yanked from https://github.com/sunny/anyplayer/blob/master/lib/anyplayer/players/itunes_mac.rb\n %x(osascript -e 'tell app \"iTunes\" to pause').rstrip\n #pause Spotify\n %x(osascript -e 'tell app \"Spotify\" to pause').rstrip\nend",
"def onPause\n super\n end",
"def commandnewgame_audio\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Stop BGM\r\n Audio.bgm_stop\r\n end",
"def process_cancel\n Sound.play_cancel\n Input.update\n deactivate if @symbol.nil?\n @symbol = nil\n call_cancel_handler\n end",
"def audio; end",
"def disable\n {\n method: \"WebAudio.disable\"\n }\n end",
"def shutdown\n @gameLoop.stop\n @soundManager.shutdown\n end",
"def pause\n Fiber.yield\n end",
"def previous\t \n @music.off\n @song.kill\n @count -= 2\n end",
"def unpause_processing\n log \"CONT received; resuming job processing\"\n @paused = false\n redis.del(pause_key)\n end",
"def pause\n url = 'me/player/pause'\n User.oauth_put(@user.id, url, {})\n end",
"def suspend!\n return if suspended?\n self.status = \"suspended\"\n self.stop = Time.now.to_s\n end",
"def play(&blk)\n start_playing\n blk.call\n ensure\n stop_playing\n end",
"def setPauseState(handle, pause)\n if ! pause\n if handle.respond_to?(:auto_managed=)\n handle.auto_managed = true\n end\n handle.resume\n else\n if handle.respond_to?(:auto_managed=)\n handle.auto_managed = false\n end\n handle.pause\n end\n end",
"def trim_silence!\n @audio = Audio.trim_silence(0.03, 0.1, @audio)\n nil\n end",
"def resume\n if(@paused)\n @paused = false\n reset\n end\n current_self\n end",
"def suspend\n end",
"def sound; end",
"def reset_voice\n @voice = \"Boing\"\n end",
"def play\n unless @av_player.nil?\n @av_player.currentTime = 0.0\n @av_player.play\n end\n end",
"def play_title_music\r\n\r\n$data_system.title_bgm.play\r\n\r\nRPG::BGS.stop\r\n\r\nRPG::ME.stop\r\n\r\nend"
] | [
"0.7457411",
"0.6960166",
"0.69552326",
"0.68442154",
"0.68442154",
"0.68277365",
"0.68277365",
"0.66823995",
"0.6662362",
"0.65733254",
"0.6567936",
"0.6562065",
"0.65563726",
"0.64941883",
"0.6483311",
"0.6475135",
"0.63849986",
"0.62451845",
"0.6225041",
"0.6206136",
"0.6199401",
"0.61869156",
"0.6183225",
"0.61789745",
"0.61703134",
"0.6162837",
"0.6162837",
"0.6162837",
"0.614112",
"0.6140263",
"0.6137925",
"0.6136121",
"0.6121654",
"0.6108912",
"0.60832053",
"0.60599434",
"0.603746",
"0.6025027",
"0.60205203",
"0.6016249",
"0.598744",
"0.5987232",
"0.5980037",
"0.59740615",
"0.59221303",
"0.59221303",
"0.5914305",
"0.58959216",
"0.5879218",
"0.5860406",
"0.5857852",
"0.5838322",
"0.5804727",
"0.57928675",
"0.5785374",
"0.57730484",
"0.576949",
"0.576949",
"0.5755356",
"0.57538646",
"0.57501656",
"0.57434666",
"0.5739981",
"0.57320607",
"0.572457",
"0.571504",
"0.57036453",
"0.5686084",
"0.56478864",
"0.56401145",
"0.56330884",
"0.56129277",
"0.56111026",
"0.56095",
"0.5579904",
"0.5575722",
"0.5572538",
"0.5572538",
"0.55684215",
"0.55574805",
"0.55555654",
"0.5547521",
"0.55342007",
"0.55276084",
"0.5505264",
"0.5500644",
"0.5499844",
"0.5489407",
"0.5483454",
"0.5465985",
"0.54651165",
"0.5464726",
"0.5444315",
"0.54364574",
"0.5435924",
"0.54151094",
"0.5408996",
"0.53860426",
"0.53726214",
"0.5365675"
] | 0.72891754 | 1 |
seek to particular time in playback. Time passed is in seconds. | def time=(time)
`#{@sound}.currentTime = #{time}`
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seek_to_time(seconds)\n return unless running?\n info \"SEEK TO: #{seconds} seconds\"\n send_command :seek, seconds, 1\n end",
"def seek(seconds) \n\t\tsynchronized do\n\t\t\[email protected] \"seek #{seconds}\"\n\t\tend\n\tend",
"def test_seek_at_time\n #no sample must have a later logical time\n #seek returns the last sample possible\n sample = stream.seek(Time.at(5))\n assert_equal 10, stream.sample_index\n assert_equal Time.at(5), stream.time\n assert_equal [0, Time.at(5), 5], sample\n\n # Check that seeking did not break step / step_back\n assert_equal [1, Time.at(5,500), 50000], stream.step\n assert_equal [0, Time.at(6), 6], stream.step\n assert_equal [2, Time.at(6, 500), 600], stream.step\n sample = stream.seek(Time.at(50))\n assert_equal [1, Time.at(49, 500), 490000], stream.step_back\n assert_equal [0, Time.at(49), 49], stream.step_back\n assert_equal [2, Time.at(48, 500), 4800], stream.step_back\n end",
"def seek _value, _type=0\n send_cmd(\"seek #{_value} #{_type}\")\n end",
"def file_seek_to_time(file, time_obj, logger)\r\n\t\tfile.seek(0, IO::SEEK_END)\r\n\t\tend_pos = file.pos\r\n\t\tfile.rewind\r\n\t\tfile = seek_to_time_helper(file, time_obj, 0, end_pos, logger)\r\n\t\tstarting_line_pos = file.pos\r\n\r\n\t\tfile.each do |line|\r\n\t\t\tif(line =~ NEW_ACTION_REGEX)\r\n\t\t\t\tthis_time = Time.parse($1)\r\n\t\t\t\tif this_time >= time_obj\r\n\t\t\t\t\tfile.seek(starting_line_pos, IO::SEEK_SET)\r\n\t\t\t\t\tbreak\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\tstarting_line_pos = file.pos\r\n\t\tend\r\n\t\tfile\r\n\tend",
"def test_seek_at_position\n sample = stream.seek(10)\n assert_equal 10, stream.sample_index\n assert_equal Time.at(5), stream.time\n assert_equal [0, Time.at(5), 5], sample\n\n # Check that seeking did not break step / step_back\n assert_equal [1, Time.at(5, 500), 50000], stream.step\n assert_equal [0, Time.at(6), 6], stream.step\n assert_equal [2, Time.at(6, 500), 600], stream.step\n sample = stream.seek(10)\n assert_equal [2, Time.at(4, 500), 400], stream.step_back\n assert_equal [0, Time.at(4), 4], stream.step_back\n assert_equal [1, Time.at(3, 500), 30000], stream.step_back\n\n #check if seeking is working if index is not cached\n #see INDEX_STEP\n sample = stream.seek(21)\n assert_equal 21, stream.sample_index\n assert_equal Time.at(10,500), stream.time\n assert_equal [2, Time.at(10,500), 1000], sample\n end",
"def advance(seconds:)\n @time += (seconds.to_i * 1_000)\n end",
"def Animate_Seek(hwnd, frame)\r\n Animate_Play(hwnd, frame, frame, 1)\r\n end",
"def seek(*args)\n raise ArgumentError, \"no stream\" unless __advance!\n @_st_stream.seek(*args)\n end",
"def seek(position)\n send_packet(:seek, {\n position: position\n })\n end",
"def advance_seconds(secs)\n self + secs\n end",
"def seek(position)\n current.position = position if position\n\n self\n end",
"def seek subscription, time_or_snapshot\n if a_time? time_or_snapshot\n time = Convert.time_to_timestamp time_or_snapshot\n subscriber.seek subscription: subscription, time: time\n else\n time_or_snapshot = time_or_snapshot.name if time_or_snapshot.is_a? Snapshot\n subscriber.seek subscription: subscription_path(subscription),\n snapshot: snapshot_path(time_or_snapshot)\n end\n end",
"def advance()\n @time = @time + 1\n end",
"def seek(p0) end",
"def seek\n end",
"def seek\n end",
"def seek(amount, whence=SEEK_SET) end",
"def step(time)\n warn %(Timer step must be >= 0, but #{time} was given!) unless time >= 0\n @now += time\n end",
"def seek(x); @_io.seek(x); end",
"def seek(new_position)\n end",
"def process_time(player, start_time, end_time)\n t = time_duration(player.mytime, start_time, end_time)\n\n player.mytime += @fischer\n player.mytime -= t\n if (player.mytime < 0)\n player.mytime = 0\n end\n\n return t\n end",
"def seek(percent)\n # cmus-remote --seek takes a parameter in seconds.\n if status[:duration_integer]\n # example:\n # --------\n # duration: 90 seconds\n # percent to seek: 50\n # 90.0f * (50 / 100)\n # 90 * 0.5\n # 45 seconds\n\n duration = status[:duration_integer].to_f\n percent = percent.to_f * 0.01\n\n seek_seconds = (duration * percent).to_i\n cli_command = %Q{ cmus-remote --seek #{seek_seconds} }\n\n system(cli_command)\n end\n end",
"def seek(*rest) end",
"def seek(*rest) end",
"def seek_to_time_helper(file, target_time, start_pos, end_pos, logger)\r\n\t\treturn nil unless file && target_time\r\n\t\tlogger.info(\"Checking between file pos #{start_pos} and #{end_pos}.\")\r\n\r\n\t\trewind_pos = file.pos\r\n\t\tmiddle_pos = (start_pos+end_pos)/2\r\n\t\tfile.seek(middle_pos, IO::SEEK_SET)\r\n\t\tfile.each do |line|\r\n\t\t\tif(line =~ NEW_ACTION_REGEX)\r\n\t\t\t\tthis_time = Time.parse($1)\r\n\t\t\t\tif this_time >= target_time\r\n\t\t\t\t\treturn seek_to_time_helper(file, this_time, start_pos, middle_pos, logger)\r\n\t\t\t\telsif(this_time < target_time && (this_time-target_time).abs < MAX_TIME_BETWEEN_CONTROLLER_ACTIONS)\r\n\t\t\t\t\tfile.seek(rewind_pos, IO::SEEK_SET)\r\n\t\t\t\t\treturn file\r\n\t\t\t\telse\r\n\t\t\t\t\treturn seek_to_time_helper(file, this_time, middle_pos, end_pos, logger)\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\t# If we can't find any line that meets the criteria we seek, just send back the file object in the closest spot we could find.\r\n\t\tfile.seek(rewind_pos, IO::SEEK_SET)\r\n\t\treturn file\r\n\tend",
"def advance_by(time)\n dt = @clock + time\n\n due_to_clock = dt<=>@clock\n raise 'Time is out of range' if due_to_clock < 0\n\n return if due_to_clock == 0\n raise 'Cannot advance while running' if @enabled\n\n self.advance_to dt\n end",
"def set(time)\n reset\n @offset = now - time\n end",
"def seek_by(amount)\n return unless running?\n info \"SEEK BY: #{amount}\"\n send_command :seek, amount, 0\n end",
"def advance(date, time)\n date.advance(hours: time.hour, minutes: time.min, seconds: time.sec)\n end",
"def puttime\n if gameover?\n return\n end\n setpos(TIMELINE,0)\n addstr( (Time.now.to_i - @start).to_s + \" sec\")\n end",
"def seek(arg0, arg1, *rest)\n end",
"def puttime\n return if gameover?\n\n setpos(TIMELINE, 0)\n addstr(\"#{Time.now.to_i - @start} sec\")\n end",
"def on_seek(evt)\n offset = @slider.value\n @mc.seek(offset)\n end",
"def play(*args)\n sleep(duration)\n end",
"def update_play_time\n @play_time += time_counter\n load_time\n return @play_time\n end",
"def setTime(time)\n\t\t@time = time\n\tend",
"def diskPositionAtTime(t)\n (@startPos + t) % @totalPos\n end",
"def since(seconds)\n VoltTime.new.set_time(@time + seconds)\n end",
"def seek(amount, whence=SEEK_SET)\n #This is a stub, used for indexing\n end",
"def seek(position, unit = TimeUnit::MS)\n position = 0 if position < 0\n FMOD.invoke(:Channel_SetPosition, self, position, unit)\n self\n end",
"def time=(new_time)\n @time = new_time\n end",
"def advance_to(time)\n due_to_clock = time<=>@clock\n raise 'Time is out of range' if due_to_clock < 0\n\n return if due_to_clock == 0\n\n unless @enabled\n @enabled = true\n\n begin\n next_item = self.get_next\n if !next_item.nil? && next_item.due_time <= time\n @clock = next_item.due_time if next_item.due_time > @clock\n next_item.invoke\n else\n @enabled = false\n end\n\n end while @enabled\n\n @clock = time\n else\n raise 'Cannot advance while running'\n end\n\n end",
"def play(time)\n if @boo\n @boo = false\n #sleep(10)\n end\n note, duration = @pattern[@count]\n @count += 1\n return if @count > @pattern.size\n length = @interval * duration - (@interval * 0.10)\n @player.play(0, note, length) unless note.nil?\n @timer.at(time + @interval) {|at| play(at)}\n end",
"def time=(value)\n @time = value\n end",
"def start_time(time)\n if time < time.set_time_to( @opening_time )\n time.set_time_to( @opening_time )\n else\n time\n end\n end",
"def seek_start\n seek_to_percent(0.0)\n end",
"def time_offset seconds\n shift = (@video.duration > seconds.to_f ? seconds : @video.duration).to_i\n hours, mins = (shift / 360), (shift / 60)\n sec = shift - (hours * 360 + mins * 60)\n \"%02d:%02d:%02d\" % [hours, mins, sec]\n end",
"def seek_forward(amount = opts[:seek_size])\n seek_by(amount)\n end",
"def advance_time(delta)\n return unless delta > 0\n return unless @frames > 1\n \n @play_time += delta\n \n #cache this so we can see if we looped past the stop frame\n cached_playtime = @play_time\n \n @play_time %= @duration\n \n new_frame = (@play_time * FRAME_RATE).floor\n new_frame = [[0, new_frame].max, @frames-1].min\n \n #if we hit or passed stop frame, go there and bail\n unless @stop_frame.nil?\n frames_remaining = (@current_frame <= @stop_frame ? @stop_frame - @current_frame : @frames - @current_frame + @stop_frame)\n frames_elapsed = (cached_playtime * FRAME_RATE).floor - @current_frame\n if frames_elapsed > frames_remaining\n if @start_frame.nil?\n #set new_frame first... mucking with is_playing clears stop/start frames\n new_frame = @stop_frame\n cached_handler = @stop_frame_handler\n self.is_playing = false\n\n unless cached_handler.nil?\n cached_handler.call\n end\n \n else\n #important to reset the play time\n goto(@start_frame) and return\n end\n end\n end\n \n goto(new_frame, false)\n end",
"def seek(index)\n if (index <= @p)\n @p = index # just jump; don't update stream state (line, ...)\n return\n end\n # seek forward, consume until p hits index\n while (@p < index)\n consume\n end\n end",
"def tick(seconds)\n\t\t@time += seconds\n\tend",
"def seek_to_percent(percent)\n return if percent.to_i == @stats[:position]\n percent = percent.to_f\n percent = 0.0 if percent < 0\n percent = 100.0 if percent > 100\n info \"SEEK TO: #{percent}%\"\n send_command :seek, percent, 1\n end",
"def seek(amount, whence=IO::SEEK_SET)\n #This is a stub, used for indexing\n end",
"def sleep(time)\n dt = @clock + time\n\n due_to_clock = dt<=>@clock\n raise 'Time is out of range' if due_to_clock < 0\n\n @clock = dt\n end",
"def play(channel, note, duration, velocity = 100, time = nil)\n on_time = time || Time.now.to_f\n @timer.at(on_time) {note_on(channel, note, velocity)}\n off_time = on_time + duration\n @timer.at(off_time) {note_off(channel, note, velocity)}\n end",
"def update_time_range(time_in_ms)\n @start_offset = time_in_ms\n display_items\n end",
"def seek!(options = {})\n raise InvalidActionError, \"Cannot seek an Output that is already seeking.\" if seeking?\n seek_action(options).tap do |action|\n write_action action\n end\n end",
"def run_for!(time)\n self.time_setpoint = time\n\n self.command = :'run-timed'\n end",
"def within(value)\n @time = value\n self\n end",
"def time_to_pos time, exceed = false\n\t\t\tpos_found = nil\n\t\t\tif time\n\t\t\t\tprev_pos = 0\n\t\t\t\teach_with_pos(nil, nil, ID_TIME){|timestamp,data,pos|\n\t\t\t\t\tif timestamp > time\n\t\t\t\t\t\tpos_found = (exceed ? pos : prev_pos)\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\t\tprev_pos = pos\n\t\t\t\t}\n\t\t\tend\n\t\t\tpos_found\n\t\tend",
"def seek_chapter _value, _type=0\n send_cmd(\"seek_chapter #{_value} #{_type}\")\n end",
"def seek(amount, whence=IO::SEEK_SET)\n sysseek(amount, whence)\n end",
"def at(secs, usecs = 0)\n VoltTime.new.set_time(::Time.at(secs, usecs))\n end",
"def advance ( delta=0 ) \n @actual += delta\n @current = @actual + offset\n @current_offset = @current.to_i/60 - @actual.to_i/60\n @updated = Time.new\n @update_count += 1\n self\n end",
"def rewind_disk(time_going_back)\n if (@dvd_time_move - time_going_back) > 0\n @dvd_time_move = @dvd_time_move - time_going_back\n else\n @dvd_time_move = 0\n end\n end",
"def seek!(options = {})\n raise InvalidActionError, \"Cannot seek an Output that is already seeking.\" if seeking?\n seek_action(options).tap do |action|\n write_action action\n end\n end",
"def seek(offset)\n @file.seek offset\n end",
"def increment_time\n @time = @time + 1\n end",
"def play_track\n return if @status.playback_state == :paused\n @logger.debug \"Playing track: #{@status.seconds} out of #{@status.length}\"\n sleep 1\n @status.seconds += 1\n update_status\n if @status.seconds >= @status.length\n @logger.debug \"Track complete. Advancing to next.\"\n @status.clear\n @status.playback_state = :stopped\n update_status\n advance\n end\n end",
"def sec() time[2] end",
"def seek(target)\n #A vector pointing from the location to the target\n desired = PVector.sub(target, @location)\n # Scale to maximum speed\n desired.setMag(@maxspeed)\n\n # Steering = Desired minus velocity\n steer = PVector.sub(desired, @velocity)\n steer.limit(@maxforce) # Limit to maximum steering force\n apply_force(steer)\n end",
"def update_time(time)\n prev_time_left = time_left\n prev_over = over\n\n self.now = time\n seconds = now - start\n time_passed = (speed * seconds).to_i\n self.time_left = time_allowed - time_passed\n self.over = true if time_left < 0 # allow 1s grace :)\n self.time_left = 0 if time_left < 0 # but report it as still being at zero\n\n prev_over != over || prev_time_left != time_left\n end",
"def fileseek(offset = 0, _message = nil)\n # st = Time.now\n @fHnd.seek(offset, IO::SEEK_SET)\n # $log.warn \"seek time [#{Time.now-st}] from [#{message}]\" if $log\n end",
"def playingOperation(client)\n\n\t\tclient.sleep(15000)\n\t\tbegin\t\t\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@id='seek_controller']\", 0, 1)\n\t\t\t$startTime = client.elementGetText(\"NATIVE\", \"xpath=//*[@id='time']\", 0)\n\t\t\tputs \"Starting time : \" + $startTime\n\n\t\t\tclient.sleep(8000)\n\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@id='seek_controller']\", 0, 1)\n\t\t\t$endTime = client.elementGetText(\"NATIVE\", \"xpath=//*[@id='time']\", 0)\n\t\t\tputs \"Ending time : \" + $endTime\n\n\t\t\tif $endTime == $startTime\n\t\t\t\t$errMsgConti = \"::MSG::「続きを再生が失敗しました」 Playback has not started, check status!!!\"\n\t\t\t\t$obj_rtnrs.returnNG\n\t\t\t\t$obj_rtnrs.printResult\t\n\t\t\telse\n\t\t\t\t@@comment = \"::MSG::「続きを再生が成功しました」 Playback has started successfully...\"\n\t\t\t\t$obj_rtnrs.returnOK\n\t\t\t\t$obj_rtnrs.printResult\t\t\t\n\t\t\tend\n\t\trescue Exception => e\n\t\t\t$errMsgConti = \"::MSG:: Exception occurrred, could not get playback time..: \" + e.message\n\t\t\t$obj_rtnrs.returnNG\n\t\tend\n\t\tbegin\n\t\t\tif client.waitForElement(\"NATIVE\", \"xpath=//*[@class='android.view.View']\", 0, 120000)\n\t\t \t# If statement\n\t\t\tend\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@id='seek_controller']\", 0, 1)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@id='play_pause_button']\", 0, 1)\n\t\t\tif client.waitForElement(\"NATIVE\", \"xpath=//*[@class='android.view.View']\", 0, 30000)\n\t\t \t# If statement\n\t\t\tend\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@id='toolbar']\", 0, 1)\n\t\t\tclient.sleep(500)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@contentDescription='上へ移動']\", 0, 1)\n\t\trescue Exception => e\n\t\t\t$errMsgConti = \"::MSG:: Exception occurrred while finding ELEMENT\" + e.message\n\t\tend\t\t\n\tend",
"def seconds_to(some_ebay_time)\n some_ebay_time - time\n end",
"def set_Time(value)\n set_input(\"Time\", value)\n end",
"def seek_action(options = {})\n Seek.new({ :component_id => component_id, :call_id => call_id }.merge(options)).tap do |s|\n s.original_component = self\n end\n end",
"def useAudioTimeForMoves _obj, _args\n \"_obj useAudioTimeForMoves _args;\" \n end",
"def tick\n @time = next_time(true)\n end",
"def time=(time, allow_failures=false)\n\n #Create a packet which should set the scanner's current time.\n request = Packets::RequestSetTime.from_time(time)\n \n #Set the time on the scanner, and retrieve the scanner's newly-set reported time.\n new_time = send_request(request).to_time()\n\n #If the time was not correctly set, throw an error...\n unless new_time.tv_sec == time.tv_sec || allow_failures\n raise FailedOperationError.new(\"Tried to set the scanner's time to #{time.inspect}, but got back #{new_time.inspect}.\")\n end\n\n new_time\n end",
"def set_game_time(time)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n if time.handle.ptr == nil\n raise \"time is disposed\"\n end\n Native.Timer_set_game_time(@handle.ptr, time.handle.ptr)\n end",
"def time_to_send(desired_time)\n time_to_send = desired_time\n if time_to_send <= @last_used_time\n time_to_send = @last_used_time + 1\n end\n @last_used_time = time_to_send\n end",
"def seek(offset, whence = SEEK_SET)\n\t\tsane = 0\n\n\t\t# Just in case...\n\t\tcase whence\n\t\t\twhen ::IO::SEEK_SET\n\t\t\t\tsane = 0\n\t\t\twhen ::IO::SEEK_CUR\n\t\t\t\tsane = 1\n\t\t\twhen ::IO::SEEK_END\n\t\t\t\tsane = 2\n\t\t\telse\n\t\t\t\traise RuntimeError, \"Invalid seek whence #{whence}.\", caller\n\t\tend\n\n\t\trequest = Packet.create_request('core_channel_seek')\n\n\t\trequest.add_tlv(TLV_TYPE_CHANNEL_ID, self.cid)\n\t\trequest.add_tlv(TLV_TYPE_SEEK_OFFSET, offset)\n\t\trequest.add_tlv(TLV_TYPE_SEEK_WHENCE, sane)\n\n\t\tbegin\n\t\t\tresponse = self.client.send_request(request)\n\t\trescue\n\t\t\treturn -1\n\t\tend\n\n\t\treturn tell\n\tend",
"def time_to_finish\n past_time = Time.now - self[:start_time]\n seconds_to_go = past_time * self[:max] / self[:current] - past_time\n puts \"time to go: #{seconds_to_go.round}s\"\n end",
"def offset(time)\n time\n end",
"def set_time(time)\n @time = time.getutc\n return self\n end",
"def setTime\n if self.exists && File.writable?(\".\")\n nFile = File.new(\"timed_#{@filename}\", \"w+\")\n \n self.play\n \n puts \"Press enter every time the next lyric should show up!\\n\"\n \n @file.each {\n |line|\n charPrint(line)\n getTime(line, nFile)\n }\n\n nFile.close\n @file.rewind\n end\n end",
"def advance_1sec!\n\t\tTimecop.travel(Time.now + 1)\n\tend",
"def time_s=(time)\n self.time = s_to_time(time)\n end",
"def seek_action(options = {})\n Seek.new({ :component_id => component_id, :target_call_id => target_call_id }.merge(options)).tap do |s|\n s.original_component = self\n end\n end",
"def check_play_now(js_time)\n if may_play_now?\n self.started_at = Time.at(js_time / 1000) # take from browser\n play_now!\n true\n else\n false\n end\n end",
"def frame_time=(a); motion.frame_time = a; end",
"def start=(time); end",
"def fast_travel(x, y=nil, ms = 5)\n $game_player.move_speed = ms\n if y\n $game_player.find_path to: [x, y]\n else\n $game_player.find_path to: x, type: :Border\n end\n end",
"def seek(pos)\n if pos < @current_io_start || @current_io_end <= pos\n select_io_from_pos(pos)\n end\n @current_io.seek(pos - @current_io_start, IO::SEEK_SET)\n end",
"def set_time_frame time, time_slot = 30.minutes\n Time.at(((time.to_i / time_slot).round * time_slot) + time_slot).to_i\n end",
"def seek(target)\n desired = PVector.sub(target, @location) # A vector pointing from the location to the target\n # Scale to maximum speed\n desired.normalize()\n desired.mult(@maxspeed)\n\n # Above two lines of code below could be condensed with new PVector setMag() method\n # Not using this method until Processing.js catches up\n # desired.setMag(@maxspeed);\n\n # Steering = Desired minus Velocity\n steer = PVector.sub(desired, @velocity)\n steer.limit(@maxforce) # Limit to maximum steering force\n return steer\n end",
"def current_play_time\n time = $trainer.update_play_time\n hours = time / 3600\n minutes = (time - 3600 * hours) / 60\n format('%<hours>02d %<sep>s %<mins>02d', hours: hours, sep: text_get(25, 6), mins: minutes)\n end",
"def poke(node, time)\n @sessions.poke(node, time)\n end"
] | [
"0.7677366",
"0.7034081",
"0.69024414",
"0.6260969",
"0.62163687",
"0.6206402",
"0.6150778",
"0.61135364",
"0.6071782",
"0.6019617",
"0.6005099",
"0.59362286",
"0.5934305",
"0.5929551",
"0.5906692",
"0.58487296",
"0.58487296",
"0.5836787",
"0.5740131",
"0.572487",
"0.57192945",
"0.5707357",
"0.56941175",
"0.56789756",
"0.56772995",
"0.56734204",
"0.5636954",
"0.56308174",
"0.5626622",
"0.5619432",
"0.5613427",
"0.5613405",
"0.5607259",
"0.56043684",
"0.5597457",
"0.5578655",
"0.5527072",
"0.5519854",
"0.5512672",
"0.54821855",
"0.54815936",
"0.5429026",
"0.5400199",
"0.53963137",
"0.5393314",
"0.5381393",
"0.537635",
"0.5364324",
"0.5351926",
"0.5339198",
"0.5334739",
"0.5302207",
"0.5297198",
"0.5274861",
"0.52729326",
"0.52606297",
"0.5257674",
"0.5250643",
"0.52477175",
"0.5227185",
"0.5227023",
"0.5210399",
"0.51870275",
"0.51846427",
"0.5172252",
"0.5152093",
"0.51435655",
"0.5127444",
"0.5125774",
"0.5122981",
"0.51088065",
"0.5097224",
"0.5094336",
"0.50928926",
"0.5083054",
"0.5077192",
"0.5057016",
"0.50566673",
"0.50519204",
"0.50445956",
"0.5026238",
"0.502239",
"0.50207853",
"0.5019747",
"0.50186473",
"0.50122875",
"0.5012055",
"0.50114536",
"0.49986076",
"0.49930242",
"0.4991979",
"0.49840236",
"0.49796316",
"0.4959066",
"0.49359572",
"0.49334627",
"0.4929989",
"0.49225718",
"0.49143815",
"0.49129006"
] | 0.6313878 | 3 |
This works for both local tables and hub entity sets | def local_field_values(original_entity, properties, field, aggregate)
if !original_entity.group_by || original_entity.group_by == field
return properties[field]
end
entity = original_entity.clone
properties.each do |name, value|
entity.eq(name, value)
end
entity.field_values(field, aggregate)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entities; end",
"def entity_sets\n entity_container.entity_sets\n end",
"def entity_sets\n entity_container.entity_sets\n end",
"def entity_sets\n entity_container.entity_sets\n end",
"def entities_list\n raise 'Not implemented'\n end",
"def orm; end",
"def entities\n _entities\n end",
"def entities\n _entities\n end",
"def entity_name\n dataset_key.gsub(/Set$/,'')\n end",
"def orm_patches_applied; end",
"def table\n Identity\n end",
"def table\n Identity\n end",
"def entities_key\n entities_name.underscore.to_sym\n end",
"def local\n @table\n end",
"def create_entity_columns\n entity = self.name.constantize\n entity.reset_column_information\n \n entity.columns.each_with_index do |column, i|\n f = self.entity_columns.detect{ |col| col.name == column.name }\n unless f\n f = self.entity_columns.build(:name => column.name)\n association = entity.reflect_on_all_associations(:belongs_to).detect{|a| a.options[:foreign_key] == column.name }\n association ||= entity.reflect_on_association column.name.sub(/_id$/, '').to_sym if column.name.ends_with? '_id'\n if association\n f.ref_type = :Entity.to_s\n f.ref_name = association.options[:polymorphic] ? 'POLYMORPHIC' : association.class_name\n end\n end\n \n f.term = \"label.#{column.name}\" unless f.term\n f.col_type = column.type.to_s\n f.col_size = column.limit if(column.respond_to?(:limit))\n f.nullable = column.null\n f.def_val = (column.default == nil) ? nil : column.default.to_s\n f.disp_rank = i * 10\n f.save!\n end\n\n uniq_index_def = ActiveRecord::Base.connection.indexes(entity.table_name).find { |index_def| index_def.unique == true }\n \n # unique ranks by getting unique index\n if(uniq_index_def)\n uniq_seq = 1\n uniq_index_def.columns.each do |uniq_col_name|\n column = self.entity_columns.where(\"name = ?\", uniq_col_name).first\n if(column)\n column.uniq_rank = uniq_seq * 10\n column.save!\n uniq_seq += 1\n end\n end\n end\n \n return self.entity_columns\n end",
"def single_object_db; end",
"def subscribe_sql_active_record; end",
"def query_entities(table_name, options={})\n query ={}\n query[\"$select\"] = options[:select].join ',' if options[:select]\n query[\"$filter\"] = options[:filter] if options[:filter]\n query[\"$top\"] = options[:top].to_s if options[:top] unless options[:partition_key] and options[:row_key]\n query[\"NextPartitionKey\"] = options[:continuation_token][:next_partition_key] if options[:continuation_token] and options[:continuation_token][:next_partition_key]\n query[\"NextRowKey\"] = options[:continuation_token][:next_row_key] if options[:continuation_token] and options[:continuation_token][:next_row_key]\n query[\"timeout\"] = options[:timeout].to_s if options[:timeout]\n\n uri = entities_uri(table_name, options[:partition_key], options[:row_key], query)\n response = call(:get, uri, nil, {\"DataServiceVersion\" => \"2.0;NetFx\"}, options)\n\n entities = Azure::Service::EnumerationResults.new\n\n results = (options[:partition_key] and options[:row_key]) ? [Table::Serialization.hash_from_entry_xml(response.body)] : Table::Serialization.entries_from_feed_xml(response.body)\n \n results.each do |result|\n entity = Entity.new do |e|\n e.table = table_name\n e.updated = result[:updated]\n e.etag = response.headers[\"etag\"] || result[:etag]\n e.properties = result[:properties]\n end\n entities.push entity\n end if results\n\n entities.continuation_token = nil\n entities.continuation_token = { \n :next_partition_key=> response.headers[\"x-ms-continuation-NextPartitionKey\"], \n :next_row_key => response.headers[\"x-ms-continuation-NextRowKey\"]\n } if response.headers[\"x-ms-continuation-NextPartitionKey\"]\n\n entities\n rescue => e\n raise_with_response(e, response)\n end",
"def table_names\n @table_names ||= entities.map{|entity|entity.model.table_name}.uniq\n end",
"def _table; @table end",
"def left_table; table_sync.left_table; end",
"def create_global_tbl\n # full table contains all columns without where predicate\n # so for where predicate it also contains excluded rows\n\n # create full rst_tbl and update null pk\n @t_full_tbl = @tQueryObj.create_full_rst_tbl(false)\n @f_full_tbl = @fQueryObj.create_full_rst_tbl(false)\n\n tbl = Table.new(@t_full_tbl)\n global_name = 'tf_global'\n pkList = tbl.pk_column_list.map{|c| c.colname}.join(', ')\n insert_query = \"select #{pkList}, case count(1) when 1 then 'f' else 'p' end as type \"\\\n \"from (select #{pkList} from #{@t_full_tbl} UNION ALL \"\\\n \"select #{pkList} from #{@f_full_tbl}) as tmp \"\\\n \"group by #{pkList}\"\n # puts insert_query\n # QueryBuilder.exec_create_tbl(global_name, pkList, insert_query)\n DBConn.tblCreation(global_name, pkList, insert_query)\n # update null columns to resolve null value comparasion issue\n # binding.pry\n # DBConn.update_null_columns(global_name,pkList)\n\n return global_name\n end",
"def chooseTable\n @metadata.chooseTable\n end",
"def entities\n @entities\n end",
"def stock_entities\n redis.smembers(\"#{Porp.ns}:saleentity:id:#{id}:stockentities\")\n end",
"def global_entity\n contained_object.to_global_id if contained_object.present?\n end",
"def load_entities_metadata()\n raise NotImplemented, \"The load_entities_metadata need to be implemented\"\n end",
"def setup_columns\n if inheritable?\n SimpleSet.new([primary_key, inheritance_column])\n else\n primary_key.blank? ? SimpleSet.new : SimpleSet.new([primary_key])\n end \n end",
"def fetch_curr_table\n Array.new\n end",
"def on_table?; @on_table; end",
"def entity_class\n self.class.entity_class\n end",
"def entityID\n end",
"def entityID\n end",
"def entities\n @entities ||= []\n end",
"def sale_entities\n redis.smembers(\"#{Porp.ns}:stockentity:id:#{id}:saleentities)\")\n end",
"def custom_entity_types\n @_custom_entity_types ||= {}\n end",
"def custom_entity_types\n @_custom_entity_types ||= {}\n end",
"def entities(query={})\n if query.key?(:partition_key) && query.key?(:row_key)\n @service.query_entity(self, query.delete(:partition_key), query.delete(:row_key), query)\n else\n @service.query_entities(self, query)\n end\n end",
"def relation_by_sql_form\n # Nothing to do here\n end",
"def query_entities(table_name, options = {})\n query = new_query(options)\n query[Azure::Storage::Common::QueryStringConstants::SELECT] = options[:select].join \",\" if options[:select]\n query[Azure::Storage::Common::QueryStringConstants::FILTER] = options[:filter] if options[:filter]\n query[Azure::Storage::Common::QueryStringConstants::TOP] = options[:top].to_s if options[:top] unless options[:partition_key] && options[:row_key]\n query[Azure::Storage::Common::QueryStringConstants::NEXT_PARTITION_KEY] = options[:continuation_token][:next_partition_key] if options[:continuation_token] && options[:continuation_token][:next_partition_key]\n query[Azure::Storage::Common::QueryStringConstants::NEXT_ROW_KEY] = options[:continuation_token][:next_row_key] if options[:continuation_token] && options[:continuation_token][:next_row_key]\n\n options[:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY\n uri = entities_uri(table_name, options[:partition_key], options[:row_key], query, options)\n\n headers = {\n Azure::Storage::Common::HeaderConstants::ACCEPT => Serialization.get_accept_string(options[:accept])\n }\n\n response = call(:get, uri, nil, headers, options)\n\n entities = Azure::Storage::Common::Service::EnumerationResults.new.push(*Serialization.entities_from_json(response.body))\n\n entities.continuation_token = nil\n entities.continuation_token = {\n next_partition_key: response.headers[TableConstants::CONTINUATION_NEXT_PARTITION_KEY],\n next_row_key: response.headers[TableConstants::CONTINUATION_NEXT_ROW_KEY]\n } if response.headers[TableConstants::CONTINUATION_NEXT_PARTITION_KEY]\n\n entities\n rescue => e\n raise_with_response(e, response)\n end",
"def entityResolver; @entityResolver; end",
"def tables\n [\n ]\n end",
"def table; end",
"def table; end",
"def table; end",
"def table; end",
"def snapshots_redact_sql_queries; end",
"def tablename; datastore['TABLENAME']; end",
"def entity\n @keys[:entity]\n end",
"def use_transactions; end",
"def use_transactions; end",
"def export_columns\n self.entity_columns.select(\"name, description, ref_type, ref_name, col_type\").where(\"list_rank > 0 and name not in ('domain_id', 'creator_id', 'updater_id', 'created_at', 'updated_at')\").order(\"list_rank asc\")\n end",
"def [](entity_set_name)\n entity_container[entity_set_name]\n end",
"def [](entity_set_name)\n entity_container[entity_set_name]\n end",
"def [](entity_set_name)\n entity_container[entity_set_name]\n end",
"def right_table; table_sync.right_table; end",
"def tables\r\n return @engine.tables\r\n end",
"def curr_org_descendants_sql(table_name, column_name, type = 'ent')\n descendants_sql = Fdn::Organization.s_descendants(Fdn::OrgHierarchy.main.first.id, Time.now, self.resource_id).select_ent.to_sql\n self_ent_sql = self.resource.is_ent? ? \" or #{table_name}.#{column_name} = #{self.resource.resource_id}\" : ''\n\n \"(#{table_name}.#{column_name} in (select #{type == 'ent' ? 'p.resource_id' : 'p.id'} from (#{descendants_sql}) p) #{self_ent_sql})\"\n end",
"def tables; ActiveRecord::Base.connection.tables; end",
"def initial_query; end",
"def stores_foreign_key?; true; end",
"def all\n Ribs.with_handle(self.database) do |h|\n h.all(self.metadata.persistent_class.entity_name)\n end\n end",
"def entity(point_or_name); end",
"def stores_foreign_key?; false; end",
"def stores_foreign_key?; false; end",
"def test_entire_table\n $BS = Basie.new :name => \"testdb\"\n $BS.enable_full_access\n\n create :simpletest\n assert_equal [{:id=>1, :test=>\"one\"},{:id=>2, :test=>\"two\"},{:id=>3, :test=>\"two\"}],\n $BS.tables[:simpletest].entire_table(:override_security => true)\n end",
"def migrate_entities\n\n entity_keys = @source_redis.keys('entity:*')\n\n entity_keys.each do |entity_key|\n\n # TODO fix regex, check current code\n raise \"Bad regex for '#{entity_key}'\" unless entity_key =~ /\\Aentity:(#{ID_PATTERN_FRAGMENT})\\z/\n\n entity_id = $1\n\n entity_name = @source_redis.hget(entity_key, 'name')\n\n entity = Flapjack::Data::Entity.new(:id => entity_id, :name => entity_name)\n entity.save\n raise entity.errors.full_messages.join(\", \") unless entity.persisted?\n end\n\nend",
"def handle_entity_manager(em)\n unless em\n em = Criteria.em\n @em_local = true\n else\n @em_local = false\n end\n @em = em\n end",
"def metadata_table\n\t\[email protected]_table metadata\n\tend",
"def table\n Service\n end",
"def cmd_db_set_auto\n\t\t\t#TODO: Find a way to persist sets by serializing? them to .msf4 etc\n\t\t\t#TODO: Let the user add or subtract from this\n\t\t\tself.create_set(\"windows\", \"hosts where os_name~windows\")\n\t\t\tself.create_set(\"linux\", \"hosts where os_name~linux\")\n\t\t\tself.create_set(\"all_hosts\", \"hosts\")\n\t\t\tself.create_set(\"all_active_sessions\", \"sessions where closed_at=nil\")\n\t\t\tself.create_set(\"unknown\", \"hosts where os_name=nil\")\n\t\t\tcmd_db_set_list\n\t\tend",
"def odata_table_reference\n @odata_table_reference\n end",
"def get_entity(table_name, partition_key, row_key, options = {})\n options[:partition_key] = partition_key\n options[:row_key] = row_key\n results = query_entities(table_name, options)\n results.length > 0 ? results[0] : nil\n end",
"def entity_sets\n @entity_sets ||= metadata.xpath('//EntitySet').map do |entity|\n [\n entity.attributes['Name'].value,\n entity.attributes['EntityType'].value\n ]\n end.to_h\n end",
"def migrate_current_entities_and_checks\n\n current_entity_names = @source_redis.zrange('current_entities', 0, -1)\n\n current_entity_names.each do |entity_name|\n entity = find_entity(:name => entity_name)\n entity.enabled = true\n entity.save\n end\n\n current_checks_keys = @source_redis.keys('current_checks:*')\n\n current_checks_keys.each do |current_checks_key|\n\n raise \"Bad regex\" unless current_checks_key =~ /\\Acurrent_checks:(#{ENTITY_PATTERN_FRAGMENT})\\z/\n\n entity_name = $1\n\n check_names = @source_redis.zrange(current_checks_key, 0, -1)\n\n check_names.each do |check_name|\n check = find_or_create_check(entity_name, check_name)\n check.enabled = true\n check.save\n end\n\n end\n\nend",
"def within_transaction; end",
"def within_transaction; end",
"def single_record!\n if use_eager_all?\n obj = clone(:all_called=>true).all.first\n\n if opts[:eager_graph]\n obj = clone(:all_called=>true).where(obj.qualified_pk_hash).unlimited.all.first\n end\n\n obj\n else\n super\n end\n end",
"def local_id; end",
"def get_tables\n\t\t@@tables\n\tend",
"def sql_modes; end",
"def db_queries_table__samples\n [\n \"table1\",\n \"table2\"\n ]\n end",
"def sync_options; @sync_options ||= table_sync.sync_options; end",
"def get_entity(table_name, partition_key, row_key, options={})\n options[:partition_key] = partition_key\n options[:row_key] = row_key\n results = query_entities(table_name, options)\n results.length > 0 ? results[0] : nil\n end",
"def entities_used\n entities_arr = Array.new\n @entities.each do |entity|\n entities_arr << entity.id unless entities_arr.include?(entity.id)\n end\n return entities_arr\n end",
"def skip_schema_queries; end",
"def get_tables\n get_schemas.keys\n end",
"def show\n puts '* database name, @dbname = ' + @dbname\n puts '* which belongs to database set name, @dsname = ' + @ds.dsname\n puts '* Now calling all entity sets to display themselves.....'\n if @hes\n @hes.each_value{|x| x.show}\n else\n puts 'No entity set to show'\n end # if\n \n if @hrs.size > 0\n puts '***** Now calling all relationship sets to display themselves.....'\n @hrs.each_value{|y| y.show}\n else\n puts 'RELATIONSHIP SETS? No relationship set exists in this database.'\n end # if\n end",
"def entity_type\n return @entity_type\n end",
"def chooseTableAlias\n @metadata.chooseTableAlias\n end",
"def entity_name\n 'User'\n end",
"def dup_entity (options = {})\n entity = super(options)\n entity.default_eng_unit_type = self.default_eng_unit_type.dup_entity(options) if default_eng_unit_type\n object_data.each { |o| entity.object_data << o.dup_entity(options) if o}\n entity.save\n return entity\n end",
"def collected_entities entity_type, viewer=nil\n entity_type = entity_type.to_s\n if viewer == self\n assoc = entity_type.to_s\n scope = self.method(assoc).call\n scope = scope.where.not(owner_id: id) if entity_type == \"List\"\n scope\n else\n arr = collection_pointers.where(entity_type: entity_type, private: false).map(&:entity)\n arr = arr.keep_if { |l| l.owner != self } if entity_type == \"List\"\n arr\n end\n end",
"def find_entities\n []\n end",
"def entities\n @entities ||= Entity.from_models(self, @models)\n end",
"def simple_table\n current_revision_table\n end",
"def reset_fast_pk_lookup_sql\n @fast_pk_lookup_sql = if @simple_table && @simple_pk\n \"SELECT * FROM #@simple_table WHERE #@simple_pk = \".freeze\n end\n @fast_instance_delete_sql = if @simple_table && @simple_pk\n \"DELETE FROM #@simple_table WHERE #@simple_pk = \".freeze\n end\n end",
"def expand_entities_list(apply_ignore_filter = true)\n @config.entities.inject({ }) do |h, source|\n h[source] =\n case (source)\n when /^mysql:\\/\\/([^\\/]+)\\/(.*)/\n db_list = [ ]\n db = Gititback::Database.new(@config.connections[$1.to_sym])\n db.connection($1) do |c|\n if $2 == '*'\n c.query(\"SHOW DATABASES\") do |res|\n while (row = res.fetch_row)\n db_list << row[0]\n end\n end\n else\n db_list << $2\n end\n end\n db_list\n else\n Dir.glob(File.expand_path(source)).reject do |path|\n !File.directory?(path) or (apply_ignore_filter and should_ignore_source?(path))\n end\n end\n h\n end\n end",
"def orm_patches_applied=(_arg0); end",
"def wrapped_entity\n self\n end",
"def fe_uncond esname, currentdb\n currentes = currentdb.hes[esname]\n keyattribnames = currentes.keyattribnames\n nonkeyattribnames = currentes.nonkeyattribnames\n \n currentes.hashofentities.each_pair{|key, value|\n puts 'Entity key: ' + key\n # puts 'Entity: ' + value.inspect\n }\n\n\nend"
] | [
"0.62440723",
"0.59533656",
"0.59533656",
"0.59533656",
"0.5934569",
"0.5597538",
"0.558282",
"0.558282",
"0.554475",
"0.54997355",
"0.54861546",
"0.54861546",
"0.54723126",
"0.54640734",
"0.5457723",
"0.5449984",
"0.5442124",
"0.5442119",
"0.54413325",
"0.5439179",
"0.5424448",
"0.5418309",
"0.54089826",
"0.537529",
"0.5356734",
"0.5352601",
"0.534715",
"0.53412896",
"0.53286123",
"0.5325724",
"0.53157234",
"0.53101575",
"0.53101575",
"0.53047955",
"0.53002983",
"0.5298847",
"0.5298847",
"0.52761626",
"0.52633935",
"0.526116",
"0.52558637",
"0.5252187",
"0.5242992",
"0.5242992",
"0.5242992",
"0.5242992",
"0.52394754",
"0.52296495",
"0.52248055",
"0.5223859",
"0.5223859",
"0.5210073",
"0.5201292",
"0.5201292",
"0.5201292",
"0.5186683",
"0.5183247",
"0.5166885",
"0.5162373",
"0.515638",
"0.51475865",
"0.5144199",
"0.5142195",
"0.51416504",
"0.51416504",
"0.5120462",
"0.5116546",
"0.5115789",
"0.51110685",
"0.5105557",
"0.51018316",
"0.5101299",
"0.509735",
"0.50928324",
"0.5084617",
"0.50767577",
"0.50767577",
"0.5073928",
"0.50726074",
"0.5060388",
"0.50580096",
"0.50555193",
"0.50410974",
"0.50344914",
"0.5018747",
"0.5015732",
"0.5011149",
"0.50096637",
"0.5008884",
"0.50006396",
"0.4996757",
"0.49932304",
"0.49891764",
"0.49859372",
"0.4983722",
"0.49796975",
"0.49776208",
"0.4976455",
"0.49751276",
"0.4963407",
"0.49625206"
] | 0.0 | -1 |
GET /eventmembers GET /eventmembers.json def index | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @members = Member.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @members }\n end\n end",
"def index\n @members = Member.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @members }\n end\n end",
"def index\n @members = Member.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @members }\n end\n end",
"def index\n @events = Event.where(member_id: params[:member_id]).order(updated_at: :desc).page(params[:page]).per(5)\n end",
"def index\n\t\t@events = current_user.events\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @events }\n\t\tend\n\tend",
"def index\n @events = current_user.events\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @event = Event.find(params[:id])\n @users = @event.users\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @members = Member.members\n @participants = Member.participants\n @invited_count = Member.count\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @members }\n end\n end",
"def index\n @members = Member.all\n end",
"def index\n @members = Member.all\n end",
"def index\n @members = Member.all\n end",
"def index\n @members = Member.all\n end",
"def index\n @members = Member.all\n end",
"def index\n @members = Member.all\n end",
"def index\n @members = Member.all\n end",
"def index\n @members = Member.all\n end",
"def index\n @members = Member.all\n end",
"def index\n @members = Member.all\n end",
"def index\n \n @events = current_user.events\n \n \n respond_to do |format|\n format.html {}\n format.json { render json: Event.events_to_json(@events) }\n end\n end",
"def index\n @events = current_user.events\n\n render json: @events\n end",
"def index\n @members = Member.find(:all)\n end",
"def index\n @members = User::Member.all\n end",
"def index\n @events_users = EventsUser.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events_users }\n end\n end",
"def index\n @restmembers = Restmember.all\n end",
"def members_list\n @members = Member.active.ordered.all\n @user = current_user\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @members }\n end\n end",
"def get_members\n @user = User.find_by(user_params)\n @members = @user.members\n \n if not @members.nil?\n render json: @members\n else \n render json: \"\"\n end\n end",
"def index\n @participants = @event.participants\n end",
"def index\n #returns all events from eventbrite API, need to change to pull from her endpoint\n @eventList = Event.retrieve_all_events params\n render json: @eventList, status: 200\n end",
"def index\n @events = current_user.events\n end",
"def index\n @events = current_user.events\n end",
"def members\n raw_response = get_request('users/members')\n parse_response(raw_response, :users)\n end",
"def index\n @oc_members = OcMember.find(:all, :order => \"created_at ASC\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @oc_members }\n end\n end",
"def index\n if params[:u]\n @events = User.find(params[:u]).events\n else\n @events = Event.all\n end\n end",
"def index\n @events = getUpcomingEvents()\n \n @page_title = \"Events\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @search = Member.search(params[:search])\n @members = @search.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @members }\n end\n end",
"def index\n if params[:data]\n @members = Member.get_members(params[:data][:kind].to_i, params[:data][:search])\n else\n @members = Member.all\n end\n\n @members = @members.paginate(:page => params[:page], :per_page => 25)\n end",
"def index\n @members = Defer { ::Member.all }\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @members }\n end\n end",
"def index\n @members = Member.search(params[:search]).order(sort_column+\" \"+sort_direction).paginate(:per_page => 10, :page => params[:page])\n @title = \"Members\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.js # index.js.erb\n format.xml { render :xml => @members }\n end\n end",
"def index\n @events = current_user.family.events\n @event = Event.new\n end",
"def index\n @participants = @current_event.participants rescue nil || []\n end",
"def conference_list_members(params)\n path = @version + '/Conference/Member/List/'\n method = 'POST'\n return request(path, method, params)\n end",
"def index\n @user = current_user\n @events = @user.events.all\n end",
"def index\n @events_users = EventsUser.all\n end",
"def index\n @events_users = EventsUser.all\n end",
"def index\n if current_user.nil?\n redirect_to root_path\n end\n @event = EventOwner.find(current_user)\n end",
"def index\n\t\t@events = Event.where(\"creator_id = ?\", current_user.id)\n\t\tInvitation.where(\"email = ? and accepted = ?\", current_user.email, true).each do |invitation|\n\t\t\t@events << invitation.event\n\t\tend\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.json { render json: @events }\n end\n end",
"def index\n @events = current_cfp_user.person.events.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events }\n end\n end",
"def index\n user = self.current_user && User.find_by_id(self.current_user.id)\n @events = nil\n if user\n @events = user.events \n else\n @events = Event.find(:all)\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events }\n end\n end",
"def index\n @events = Event.find(:all)\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def show\n @event = Event.find(params[:id])\n @users = @event.users\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def members\n response = service.get_members\n response.map do |member_data|\n Member.new(member_data)\n end\n end",
"def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @user_events = UserEvent.all\n end",
"def index\n @user_events = UserEvent.all\n end",
"def index\n @user_events = UserEvent.all\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n render json: @events, status: 200\n end",
"def index\n\t\t@events = Event.page(params[:page]).per(10)\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json {\n\t\t\t\trender :json => @events.to_json\n\t\t\t}\n\t\tend\n\n\tend",
"def index\n @family_members = FamilyMember.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @family_members }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end",
"def list_members\n HTTP.headers(:accept => @@accept, \"content-type\" => @@content_type).basic_auth(:user => ENV[\"API_USERNAME\"], :pass => ENV[\"API_PASSWORD\"])\n .get(\"#{@@base_url}/users/#{self.guid}/members\").parse[\"members\"]\n end",
"def index\n @event = Event.all\n render json: @event\n end",
"def index\n @events = Event.all\n # render \"/users/:user_id/events\"\n render :index\n end",
"def index\n @events = Event.all\n\n render json: @events\n end",
"def index\n @events = Event.all\n render json: @events\n end",
"def index\n respond_with(@events)\n end",
"def index\n @project = Project.find(current_project_id)\n @calendar_events = @project.calendar_events\n @members = @project.members.sort { |m| m.id == current_member.id ? -1 : 1 }\n end",
"def index\n if $current_user\n @users = User.all\n #respond_to do |format|\n #format.json { render :json => @events }\n #end\n render json: @users\n else\n render json: {:message => \"U dont have permission to look this page\"}\n end\n end",
"def index\n response = { events: Event.all }\n respond_to do |format|\n format.json { render json: response.to_json }\n format.html { render :index }\n end\n end",
"def index\n @members = @project.memebers\n end",
"def members\n return @members if @members\n @members = Client.get(\"/organizations/#{id}/members/all\").json_into(Member)\n end",
"def index\n @members_clients = MembersClient.all\n end",
"def index\n respond_to do |format|\n format.html\n format.json { render json: @events }\n end\n end",
"def list\n @events = Event.coming_events\n respond_to do |format|\n format.html do\n render layout: 'events'\n end\n format.json do \n events = @events.map {|event| {event: event, users: event.users, applied: event.users.include?(current_user) }}\n render json: events \n end\n end\n end",
"def index\n @events = Event.where( \"user_id = ?\", current_user.id )\n end",
"def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json do\n render :json => {events: @events}\n end\n end\n end",
"def index\n @events = current_user.account.events\n end",
"def index\n @member = Member.find(params[:member_id])\n end",
"def show\n @restmembers = Restmember.find(params[:event_id])\n # @userRestPics = Restmembers.first\n end",
"def index\n @events = Event.where(user_id: current_user.id)\n end",
"def index\n @elder_members = ElderMember.all.order('created_at DESC').paginate(page: params[:page], per_page: 10)\n end",
"def index\n if current_user\n @joined_event = []\n @joined = EventUser.where(user_id: current_user.id)\n @joined.each do |x|\n @joined_event << Event.find(x.event_id)\n end\n\n @events = []\n @joined_event_id = []\n @joined.each do |y|\n @joined_event_id << y.event_id\n end\n Event.all.each do |x|\n if @joined_event_id.include? x.id\n # do nothing\n else\n @events << x\n end\n end\n else\n @events = Event.all\n end\n respond_to do |format|\n format.json\n format.html\n end\n end",
"def index\n @users = User.all\n\t\n\t\tflash[:alert] = @users.blank? ? \"Sorry, There are no members yet!\" : nil\n\t\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def get_members()\n @client.make_request(:get, @client.concat_user_path(\"#{CONFERENCE_PATH}/#{id}/members\"))[0].map do |i|\n member = ConferenceMember.new(i, @client)\n member.conference_id = id\n member\n end\n end",
"def members\n users\n end",
"def members\n users\n end",
"def show\n @users = @event.users\n end",
"def index\n @events = @calendar.events.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end",
"def index\n @announcements = Announcement.all\n render json: @announcements, include: [:member => {only: [:first_name, :last_name, :id]}]\n end",
"def show\n @events = Event.find(params[:id])\n @users = @events.users\n end"
] | [
"0.72409046",
"0.72409046",
"0.72409046",
"0.7214566",
"0.7171239",
"0.7085723",
"0.70768297",
"0.7059616",
"0.70374125",
"0.70374125",
"0.70374125",
"0.70374125",
"0.70374125",
"0.70374125",
"0.70374125",
"0.70374125",
"0.70374125",
"0.70374125",
"0.703551",
"0.6991727",
"0.6949707",
"0.6898983",
"0.68350285",
"0.67867374",
"0.6781243",
"0.67625785",
"0.67376184",
"0.6736399",
"0.67320544",
"0.67320544",
"0.67111",
"0.66945595",
"0.66703045",
"0.66629636",
"0.6659553",
"0.65722054",
"0.65584123",
"0.65571886",
"0.65532064",
"0.65470487",
"0.65318674",
"0.6528368",
"0.65249324",
"0.65249324",
"0.6517823",
"0.6514289",
"0.6512056",
"0.6507768",
"0.65058523",
"0.6502378",
"0.64674383",
"0.6467023",
"0.6466627",
"0.6466627",
"0.6452079",
"0.6452079",
"0.6452079",
"0.64434934",
"0.64434934",
"0.64434934",
"0.64434934",
"0.64434934",
"0.64434934",
"0.64434934",
"0.64434934",
"0.64434934",
"0.64434934",
"0.6437167",
"0.64325005",
"0.64144236",
"0.64132315",
"0.6395167",
"0.6389567",
"0.63857746",
"0.6381948",
"0.63809764",
"0.6378158",
"0.6376377",
"0.6375001",
"0.6374454",
"0.63655496",
"0.6365045",
"0.6358867",
"0.63390535",
"0.6337235",
"0.63341236",
"0.632474",
"0.6312248",
"0.6311511",
"0.6309017",
"0.6305266",
"0.630388",
"0.63033384",
"0.62999105",
"0.62812674",
"0.6278774",
"0.6278774",
"0.6278229",
"0.6271409",
"0.6268451",
"0.6264651"
] | 0.0 | -1 |
GET /eventmembers/1/edit def edit end POST /eventmembers POST /eventmembers.json | def create
@event = Event.find(params[:event_id])
@eventmember = Eventmember.new(eventmember_params)
# respond_to do |format|
# if @eventmember.save
# format.html { redirect_to @event }
# format.json { render :show, status: :created, location: @event }
# else
# format.html { render :new }
# format.json { render json: @eventmember.errors, status: :unprocessable_entity }
# end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n @event = current_user.events.find(params[:id])\n end",
"def edit\n#\t\t@event = Event.find(params[:id])\n\tend",
"def edit\n @role = get_role\n respond_with @event, @role\n end",
"def edit\n\t\t@event = Event.find(params[:id])\n\tend",
"def edit\n @event = Event.find(params[:id])\n end",
"def edit\n @event = Event.find(params[:id])\n end",
"def edit\n @event = Event.find(params[:id])\n\n end",
"def edit\n # Mostra la form per modificare un evento\n render \"edit\"\n end",
"def edit\n\n @event = Event.find(params[:id])\n\n # Edit\n if params[:event]\n if @event.update_attributes(params[:event])\n flash[:notice] = t(:events_edit_succ)\n redirect_to(:action => :index)\n else\n render(:action => :edit)\n end\n\n end\n end",
"def edit\n @current_event = Event.find(params[:id])\n # render html: 'edit!'\n end",
"def update\n \n @event = @current_user.events.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n flash[:notice] = 'Event was successfully updated.'\n format.html { redirect_to(:root) }\n format.xml { head :ok }\n else\n format.html { render(:event => \"edit\") }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_eventmember\n @eventmember = Eventmember.find(params[:id])\n end",
"def edit\n @member = TeamMember.find(params[:id])\n end",
"def update\n @event = Event.find(params[:id])\n respond_to do |format|\n keys = @event.account_ids\n keys += params[:non_members].keys if params[:non_members]\n params[:event] ||= {}\n params[:event][:account_ids] = keys\n if @event.update_attributes(params[:event])\n format.html { redirect_to(events_url, :notice => \"Event #{@event.title} was successfully created.\") }\n format.xml { head :ok }\n else\n setup_accounts\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit\n @event = Event.find_by_id(params[:id])\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def update\n @event = current_cfp_user.person.events.find(params[:id], :readonly => false)\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to(cfp_person_path, :notice => t(\"cfp.event_updated_notice\")) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @elder_member.update(elder_member_params)\n format.html { redirect_to @elder_member, notice: 'Elder member was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @elder_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to @attend, notice: 'Attend 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 update\n unless current_user\n flash[:notice] = \"You must be logged in to access this page\"\n redirect_to :login\n return false\n end\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\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 setup_variables\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n flash[:notice] = 'Event was successfully updated.'\n format.html { redirect_to(admin_event_path(@event)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event_event.update(event_event_params)\n format.html { redirect_to [:admin, @event_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_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n # Get the member_type object that was selected:\n @member_type = MemberType.find(params[:id]);\n end",
"def update\n return unless restrict_to_admin\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_member(_team, _user, _role: :reader)\n # stub\n end",
"def update\n @event = Event.find(params[:id])\n @event.users.clear\n @event.users << User.find(params['add_to_event']) if params['add_to_event']\n \n respond_to do |format|\n if @event.update_attributes(params[:event])\n flash[:notice] = 'Event was successfully updated.'\n format.html { redirect_to event_url(@event) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors.to_xml }\n end\n end\n end",
"def update\n authorize! :update, @event, :message => 'Not authorized as an administrator.'\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\t\[email protected]_id = @user.id\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\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 u=User.find(session[:user]) \n if (u.role=='Admin' || u.role=='Member')\n \n @income_event = IncomeEvent.find(params[:id])\n\n respond_to do |format|\n if @income_event.update_attributes(params[:income_event])\n format.html { redirect_to @income_event, notice: 'Income event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @income_event.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to \"/home/principal\"\n end\n end",
"def update\n respond_to do |format|\n if @member.update_attributes(params[:member])\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 update\n @event = @campus.events.find(params[:id])\n authorize! :update, @event, :message => 'Acceso denegado.'\n @modal_title = \"Editar Evento\"\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to [@university, @event.campus], notice: 'El evento fue modificado con éxito' }\n format.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n format.js\t\t{ render :action => \"edit\" }\n end\n end\n end",
"def update\n @member = Member.find(params[:id])\n @member.new = false\n\n respond_to do |format|\n if @member.update_attributes(params[:member])\n flash[:notice] = 'Member was successfully updated.'\n format.html { redirect_to members_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @member.errors.to_xml }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\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 update\n respond_to do |format|\n if @event.update(event_params)\n\t\t format.html { redirect_to univers_events_path, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: [@univers, @event] }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update_attributes(event_owner_params)\n format.html { redirect_to @event, notice: 'Event successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to admin_member_path(@member), notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n # given event was not created by the current user\n if (@event.creator.id != current_user.id) && (!current_user.admin?)\n logger.error \"Attempt to update invalid event #{params[:id]} with creator_id #{@event.creator.id} for current user_id #{current_user.id}\" \n redirect_to events_path, notice: 'You do not have permission to update that event!'\n end\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @event.update(event_params)\n\t\t\t\tformat.html { redirect_to @event, notice: \"Event was successfully updated.\" }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\tformat.json { render json: @event.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def edit\n\n end",
"def update\n if logged_in?\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to login_path\n end\n end",
"def update\n @users_event = UsersEvent.find(params[:id])\n\n respond_to do |format|\n if @users_event.update_attributes(params[:users_event])\n format.html { redirect_to @users_event, notice: 'Users event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @users_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to user_events_path(current_user), notice: 'event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to edit_admin_event_path(@event), notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n \n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n if current_user.is_admin == true\n if current_user.id == @event.admin.id\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { redirect_to admin_event_submissions_path, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n end\n else\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n end\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n if @event.update_attributes(event_params)\n flash[:success] = \"Event updated\"\n #redirect_to users_path\n redirect_to authenticated_root_path\n else\n render 'edit'\n end\n end",
"def update\n @member = Member.find(params[:id])\n\n respond_to do |format|\n if @member.update_attributes(params[:member])\n unless @member.err\n @member.get_member_uuid\n end\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 update\n @member = Member.find(params[:id])\n\n respond_to do |format|\n if @member.update_attributes(params[:member])\n unless @member.err\n @member.get_member_uuid\n end\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 update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to admin_events_path, notice: 'El evento fue modificado' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(update_params)\n format.html { redirect_to @member }\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 update\n @event = current_user.events.find_by_url(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: !(:event_update_success) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member == current_member && @member.update(member_params)\n format.html { redirect_to @member, notice: 'Member updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def edit\n member = Member.find_by(email: params[:email])\n if member && member.authenticated?(:invitation, params[:id])\n puts \"Member invitation authenticated\"\n # Check if someone is logged in already\n # If logged in member differs from the invited member,\n # log out current member and log in new member\n if current_member && !current_member?(member)\n puts \"Logging out #{current_member.name}.\"\n log_out\n end\n message = \"Welcome #{member.first_name}!\"\n puts \"Invitation accepted by '#{member.name}, <#{member.email}>'\"\n # Choose password if not already activated\n if member.activated?\n # Prompt for password\n redirect_to login_path\n else\n puts \"Activating #{member.name}\"\n member.activate\n puts \"Logging in #{member.name}\"\n log_in member\n # Let user choose a password\n if params[:set_password]\n # Member has been invited and must choose password\n redirect_to edit_member_path member, set_password: true\n else\n # Member\n redirect_to edit_member_path member\n end\n end\n # Activate member if not already activated\n # unless member.activated?\n # member.update_attribute(:activated, true)\n # message += \"Your account has been activated.\"\n # puts \"Account activated for '#{member.name}, <#{member.email}>'\"\n # end\n # puts \"Logging in #{member.name}\"\n # log_in member\n # puts \"Remembering #{member.name}\"\n # remember member\n flash[:success] = message\n else\n flash[:danger] = \"There is something wrong with the activation link.\"\n redirect_to root_path\n end\n end",
"def update\n @member = Member.find(params[:id])\n\n respond_to do |format|\n if @member.update_attributes(params[:member])\n flash[:notice] = 'Member was successfully updated.'\n format.html { redirect_to '/members/myindex' }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @member.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit\r\n end",
"def update\r\n respond_to do |format|\r\n if @event.update(event_params)\r\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @event.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n \n \n @event = Event.find(params[:id])\n\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: t(:event_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n \n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_event.update(admin_event_params)\n format.html { redirect_to admin_event_path(@admin_event), notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: admin_event_path(@admin_event) }\n else\n format.html { render :edit }\n format.json { render json: @admin_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @member = Member.find(params[:id])\n\n respond_to do |format|\n if @member.update_attributes(params[:member])\n format.html { redirect_to @member, notice: \"Member was successfully updated.\" }\n format.json { head :ok }\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 update\n\t\t@member = Member.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @member.update_attributes(params[:member])\n\t\t\t\tformat.html { redirect_to(@member, :notice => 'Member was successfully updated.') }\n\t\t\t\tformat.xml\t{ head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml\t{ render :xml => @member.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @member.update!(member_params)\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\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 @member = Member.find(params[:id])\n\n\n respond_to do |format|\n if @member.update_attributes(params[:member])\n Emailer.welcome_email(@member).deliver\n format.html { redirect_to(@member, :notice => 'Member was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @member.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @member = Member.find(params[:id])\n\n respond_to do |format|\n if @member.update_attributes(params[:member])\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 update\n @member = Member.find(params[:id])\n\n respond_to do |format|\n if @member.update_attributes(params[:member])\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 update\n @member = Member.find(params[:id])\n\n respond_to do |format|\n if @member.update_attributes(params[:member])\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 update\n @member = Member.find(params[:id])\n\n respond_to do |format|\n if @member.update_attributes(params[:member])\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 update\n @member = Member.find(params[:id])\n\n respond_to do |format|\n if @member.update_attributes(params[:member])\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 update\n respond_to do |format|\n if @member == current_member && @member.update(member_params)\n format.html { redirect_to @member, notice: 'Profile updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def eventmember_params\n params.require(:eventmember).permit(:user_id, :event_id)\n end",
"def edit\n\n end",
"def update\n manage_player_event(@event)\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @event_id = args[:event_id] if args.key?(:event_id)\n @member_type = args[:member_type] if args.key?(:member_type)\n end",
"def update!(**args)\n @event_id = args[:event_id] if args.key?(:event_id)\n @member_type = args[:member_type] if args.key?(:member_type)\n end",
"def update\n @eou = Eou.find(params[:id])\n\n respond_to do |format|\n if @eou.update_attributes(params[:eou])\n format.html { redirect_to @eou, :notice => 'Eou was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @eou.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def update\n event_id = params[:id]\n if event_id.present? && params[:event].present? && @user.uuid.present? && @user.uuid != \"guest\"\n event_params = params[:event]\n @event = Com::Nbos::Events::Event.where(id: params[:id], user_id: @user.id ).first\n if @event.present?\n @event.update(event_params.permit!)\n if @event.save\n render :json => @event\n else\n data = add_error_messages(@event)\n render :json => data\n end\n else\n render :json => {\"messageCode\": \"module.user.unauthorized\", \"message\": \"Unauthorized to update others Event\"}, status: 404\n end\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.69528234",
"0.67062414",
"0.667374",
"0.66605",
"0.66258705",
"0.66258705",
"0.66007715",
"0.65258706",
"0.64912456",
"0.64822054",
"0.64638263",
"0.64365137",
"0.6424329",
"0.6417832",
"0.639991",
"0.637232",
"0.62719524",
"0.62530535",
"0.62372565",
"0.62309706",
"0.61865926",
"0.617728",
"0.61683685",
"0.6126841",
"0.610663",
"0.609503",
"0.60943633",
"0.6091415",
"0.608877",
"0.6080091",
"0.60774994",
"0.6077146",
"0.6072286",
"0.60708576",
"0.6068731",
"0.6062508",
"0.6056559",
"0.6056477",
"0.6053937",
"0.60487664",
"0.6044517",
"0.6043978",
"0.6040773",
"0.6032961",
"0.599693",
"0.59953856",
"0.59953856",
"0.5989278",
"0.5988993",
"0.5983572",
"0.59742266",
"0.59715366",
"0.5965487",
"0.59631115",
"0.5962497",
"0.5961462",
"0.5957266",
"0.5957266",
"0.5957266",
"0.5957266",
"0.5957266",
"0.5957266",
"0.5957266",
"0.5957266",
"0.5957266",
"0.59489673",
"0.59423715",
"0.5939123",
"0.5936633",
"0.5934746",
"0.59337527",
"0.5929163",
"0.5929163",
"0.5929163",
"0.5929163",
"0.5929163",
"0.5911829",
"0.59110343",
"0.59070975",
"0.590524",
"0.5905024",
"0.5899617",
"0.5899617",
"0.58923274",
"0.58921105",
"0.58921105",
"0.58921105",
"0.58921105",
"0.58921105",
"0.58921105",
"0.58921105",
"0.58921105",
"0.58921105",
"0.58921105",
"0.58921105",
"0.58921105",
"0.58921105",
"0.58866924",
"0.5885799",
"0.5885799",
"0.5885799"
] | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_eventmember
@eventmember = Eventmember.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 setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def 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 startcompany(action)\n @done = true\n action.setup\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 setup\n #implement in subclass;\n end",
"def after_set_callback; 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 setup(easy)\n super\n easy.customrequest = @verb\n end",
"def around_hooks; end",
"def save_action; 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 shared_action(name, &block)\n @controller.shared_actions[name] = 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",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def duas1(action)\n action.call\n action.call\nend"
] | [
"0.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.53314966",
"0.53114754",
"0.52984965",
"0.52977055",
"0.5296272",
"0.5260649",
"0.5245076",
"0.52388334",
"0.52388334",
"0.52388334",
"0.52388334",
"0.52388334",
"0.5235081",
"0.52321917",
"0.5228592",
"0.5220735",
"0.52198535",
"0.52139324",
"0.5208539",
"0.5206585",
"0.5178542",
"0.5175199",
"0.5173538",
"0.5167041",
"0.51614195",
"0.51577675",
"0.5153909",
"0.51528823",
"0.5152225",
"0.51429904",
"0.5141399",
"0.51345575",
"0.51145",
"0.5114052",
"0.5114052",
"0.5110216",
"0.5108656",
"0.50935394",
"0.5089196",
"0.5081936",
"0.5079627",
"0.50675833",
"0.5056105",
"0.5053687",
"0.5050475",
"0.5050475",
"0.503471",
"0.5028311",
"0.501982",
"0.50157547",
"0.5013552",
"0.50014806",
"0.50011593",
"0.49976763",
"0.4990292",
"0.4990292",
"0.49882022",
"0.4981269",
"0.49792367",
"0.49766538",
"0.4967978",
"0.49667212",
"0.4958987",
"0.49572337",
"0.49550423",
"0.4954479",
"0.4952353",
"0.494726",
"0.4944055",
"0.4935437",
"0.4931248",
"0.49283475",
"0.49281213",
"0.49268973",
"0.4921738",
"0.49204507",
"0.4918924",
"0.49182287",
"0.4916538",
"0.49158585",
"0.49156788"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def eventmember_params
params.require(:eventmember).permit(:user_id, :event_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] | 0.0 | -1 |
GET /user_meals GET /user_meals.json | def index
@user_meals = UserMeal.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def meals\n get(\"/user/#{@user_id}/meals.json\")\n end",
"def index\n # get meals from the user\n @meals = @user.meals\n # create a new meal for the ajax form to use\n @meal = Meal.new\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meals }\n end\n end",
"def index\n @meals = current_user.meals\n end",
"def index\n @meals = current_user.meals\n end",
"def index\n @meals = current_user.meals.all\n end",
"def index\n @meals = Meal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meals }\n end\n end",
"def meal\n @meals = Meal.all\n\n respond_to do |format|\n #format.html # index.html.erb\n format.json { render json: @meals, :only => [:id, :name, :price], :include => { :items => {:only => [:id, :name, :description, :price, :time], :include => {:product_type => { :only => [:id, :name]}}}} }\n end\n end",
"def list\n meals = @meals_repository.all\n @view.list(meals)\n end",
"def index\n @meals = Meal.all\n end",
"def show\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @meal }\n end\n end",
"def menu\n foods = current_user.restaurant.meals.where(meal_type: 0)\n drinks = current_user.restaurant.meals.where(meal_type: 1)\n render json: {foods: foods, drinks: drinks, is_success: true}, status: :ok\n end",
"def set_meal\n @meal = current_user.meals.find(params[:id])\n end",
"def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal }\n end\n end",
"def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal }\n end\n end",
"def show\n @meal_profile = MealProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal_profile }\n end\n end",
"def list\n display_meals\n end",
"def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @meal }\n end\n end",
"def all_deals(**args)\n params = parameters(args) do\n optional_params :user_id, :filter_id, :stage_id, :status, :start, :limit, :sort, :owned_by_you\n end\n request(:get, 'deals', params)\n end",
"def show\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.js # show.js.erb\n format.json { render json: @meal }\n end\n end",
"def show\n @meal = Meal.find(params[:id])\n end",
"def show\n @meal = Meal.find(params[:id])\n end",
"def show\n @meal = Meal.find(params[:id])\n end",
"def show\n @user = User.find(params[:id])\n\t\t@loan_histories = LoanHistory.joins(:medium).where(\"user_id = ?\", params[:id]).order(\"rent_start\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def show \n @meal = Meal.where(id: params[:id])\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal }\n end\n end",
"def show_meals(userObj)\n table = TTY::Table.new [\"#{userObj.user_name}'s meals!\", \"Calories\", \"Foods\"], userObj.meal_arrays\n puts table.render(:ascii)\n end",
"def show\n @meal_meeting = MealMeeting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal_meeting }\n end\n end",
"def create\n @user_meal = UserMeal.new(user_meal_params)\n\n respond_to do |format|\n if @user_meal.save\n format.html { redirect_to @user_meal, notice: 'User meal was successfully created.' }\n format.json { render :show, status: :created, location: @user_meal }\n else\n format.html { render :new }\n format.json { render json: @user_meal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n respond_to do |format|\n format.html { render :show }\n format.json { render json: @meal }\n end\n end",
"def me\n\t\tuser_listings = current_user.listings\n render json: [current_user, user_listings]\n end",
"def set_user_meal\n @user_meal = UserMeal.find(params[:id])\n end",
"def show\n user = Api::V1::User.find(params[:id])\n unless user.nil?\n render json: user.followings.all\n end\n end",
"def show\n user = Api::V1::User.find(params[:id])\n unless user.nil?\n render json: user.followings.all\n end\n end",
"def meal_by_id(id)\n # API EXAMPLE: https://www.themealdb.com/api/json/v1/1/lookup.php?i=52772\n raise \"id is not an Integer (#{id.class})\" unless id.is_a?(Integer)\n\n content = api_call(\"lookup.php?i=#{id}\")\n validate(content)\n content\n end",
"def new\n @meal_profile = MealProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal_profile }\n end\n end",
"def requested\n @requested_meals = Meal.where(type: \"requested\")\n end",
"def index\n @goal_rewards = user.goal_rewards\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goal_rewards }\n end\n end",
"def index\n @mealplan_meals = MealplanMeal.all\n end",
"def show\n @diary = current_user.diaries.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @diary }\n end\n end",
"def index\n respond_with(deals)\n end",
"def index\n @goals = goals_for_current_user\n @goal = Goal.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end",
"def show\n\t\t@user = User.find params[:id]\n\t\t@medical = @user.medical\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @user }\n\t\tend\n\tend",
"def show\n @meal = Meal.find(params[:meal_id]) if params[:meal_id]\n @recipe = @meal.recipes.find(params[:id]) if @meal\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end",
"def show_follows\n \t@user = User.find(params[:id])\n \t\n \trender json: @user.follows\n end",
"def show \n respond_to do |format| \n format.json { render json: @user.as_json(include: {mashups: {}})}\n end\n end",
"def list\n # 1. Ask the repo to bring all meals #all\n meals = @meal_repo.all\n # 2. Pass the meals to the view to display them\n @meal_view.display_all(meals)\n end",
"def show\n @meal_time = MealTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal_time }\n end\n end",
"def show_follows\n\t@user = User.find(params[:id])\n\n\trender json: @user.follows\n\tend",
"def findFollowees\n @user = User.find(params[:id])\n @followees = @user.followees.all\n render json: @followees, status: :ok\n end",
"def user_meal_params\n params.fetch(:user_meal, {})\n end",
"def index\n @goals = @user.goals\n \n render json: @goals\n end",
"def index\n @indication_for_meals = IndicationForMeal.all\n end",
"def index\n @meal_records = current_user.meal_records.all\n end",
"def show\n @masut_assay = MasutAssay.find(params[:id])\n @authorized_user = User.find(session[:user_id])\n respond_to do |format|\n format.html {render layout: false}\n format.json { render json: @masut_assay }\n end\n end",
"def destroy\n @user_meal.destroy\n respond_to do |format|\n format.html { redirect_to user_meals_url, notice: 'User meal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def set_meal\n @meal = Meal.find_by(user_id: current_user.id)\n end",
"def index\n if session[:meal_id].nil?\n redirect_to meals_path\n else\n @meal = Meal.find(session[:meal_id]) \n @meal_dishes = @meal.meal_dishes\n end \n end",
"def new\n @group_meal = GroupMeal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_meal }\n end\n end",
"def set_meal\n @meal = Meal.available.exclusive(current_user).find(params[:id])\n end",
"def new\n @meal_meeting = MealMeeting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal_meeting }\n end\n end",
"def show\n @meal_preference = MealPreference.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal_preference }\n end\n end",
"def show\n @ingredience = Ingredience.find(params[:id])\n @meals = Meal.find(:all, :conditions => ['ingredience_id =?', @ingredience.id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ingredience }\n end\n end",
"def show\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @meal }\n end\n end",
"def show\n @user = User.find(params[:id])\n @followers = Following.where(:followed_id => @user).all\n meta :title => @user.name\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def show\n @meals = Menu.meals\n @locations = Menu.locations\n @menu = Menu.where(id: params[:id]).first\n @items = @menu.items.sort_by{ |obj| obj.updated_at }\n #we have access to meal\n end",
"def show\n @msalary = Msalary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @msalary }\n end\n end",
"def new\n @shout = Shout.new\n @user = User.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shout }\n end\n end",
"def index\n @meals = TestSubject.find(@test_subject.id).meals.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @meals }\n end\n end",
"def find_user_id\n @listings = Listing.where(\"user_id = ?\",params[:user_id]).all\n if [email protected]?\n ret = []\n @listings.each do |listing|\n ret << listing.as_json(include: :book)\n end\n render :json => ret\n else\n render :json => \"user has no listings\".to_json\n end\n end",
"def index\n @diaries = current_user.diaries.all\n respond_to do |format|\n format.html {render :index}\n format.json { render json: @diaries }\n end\n end",
"def show\n @goal_reward = GoalReward.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal_reward }\n end\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def create\n @meal = current_user.meals.build(meal_params)\n @meal.ip_address = request.location.ip\n @meal.expires_at = DateTime.now + 1.hour\n\n respond_to do |format|\n if @meal.save\n format.html { redirect_to @meal, notice: 'Meal was successfully created.' }\n format.json { render :show, status: :created, location: @meal }\n else\n format.html { render :new }\n format.json { render json: @meal.errors, status: :unprocessable_entity }\n end\n end\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 index\n @journals = Journal.all\n respond_with(@user,@journals)\n end",
"def random_meal\n # API EXAMPLE: https://www.themealdb.com/api/json/v1/1/random.php\n content = api_call('random.php')\n validate(content)\n content\n end",
"def show\n @twitter_user = TwitterUser.find(params[:id])\n @follower_ids = Twitter.follower_ids(@twitter_user.twitter_username).collection\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @twitter_user }\n end\n end",
"def set_meal\n @meal = Meal.find_by(id: params[:id])\n end",
"def mine\n @user = current_user\n # @micropost = @user.microposts.build\n @microposts = @user.feed.paginate(page: params[:page], per_page: 20)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def index\n @budgets = Budget.find_owned_by current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def show\n user = User.find(params[:id])\n # render json: {\n # # user.to_json(include: :stories, except: :password_digest)\n # user: user,\n # stories: user.stories,\n # success: true\n # }\n render json: user.to_json(include: :stories, except: :password_digest)\n end",
"def feed\n user = User.find(params[:id])\n following_ids = \"SELECT followed_id FROM relationships\n WHERE follower_id = :user_id\"\n microposts = Micropost.where(\"user_id IN (#{following_ids})\n OR user_id = :user_id\", user_id: params[:id])\n microposts_json = microposts_as_json(microposts.paginate(page: params[:page]))\n next_page = microposts.paginate(page: params[:page]).next_page\n @package = { next_page: next_page,\n microposts: microposts_json,\n is_current_user: (user == current_user) }\n render json: @package\n end",
"def my\n items = current_user.items\n render json: items\n end",
"def show\n @user_follow_user = UserFollowUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_follow_user }\n end\n end",
"def meal_params\n ActiveModelSerializers::Deserialization.jsonapi_parse!(params, only: [:name, :notes, :category, :serves])\n end",
"def show\n @monthly = current_user.monthlies.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monthly }\n end\n end",
"def marvel_index\n if session[:user_id]\n comics = Comic.publisher\n render json: comics, include: :user\n else\n render json: { errors: [ \"Not Authorized\" ]}, status: :unauthorized\n end\n end",
"def new\n @journal = @journals.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @journal }\n end\n end",
"def show\n user = User.find(params[:id])\n friendships = user.followers + user.followees\n render json: {user: user, friendships: friendships}\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end"
] | [
"0.9216661",
"0.77348506",
"0.7395563",
"0.7395563",
"0.72733617",
"0.700398",
"0.6823776",
"0.6679504",
"0.6644864",
"0.6581048",
"0.64315736",
"0.64064133",
"0.6275259",
"0.6275259",
"0.62651503",
"0.62406874",
"0.62219524",
"0.62125045",
"0.6157133",
"0.6152667",
"0.6152667",
"0.6152667",
"0.6128129",
"0.61212254",
"0.60699826",
"0.6037014",
"0.5964539",
"0.594486",
"0.5920357",
"0.58683807",
"0.5863333",
"0.5860527",
"0.5860527",
"0.5853767",
"0.5844884",
"0.5841617",
"0.5834119",
"0.58247536",
"0.5823528",
"0.582065",
"0.5818136",
"0.5782512",
"0.5772471",
"0.57662183",
"0.5765365",
"0.57539195",
"0.57533604",
"0.57440794",
"0.5725309",
"0.5718766",
"0.5716115",
"0.57116973",
"0.57029957",
"0.57020783",
"0.56918687",
"0.56848705",
"0.56785786",
"0.566773",
"0.5640602",
"0.5632471",
"0.56246895",
"0.5622878",
"0.5619997",
"0.56014186",
"0.55984503",
"0.5584603",
"0.5582289",
"0.5579778",
"0.55792385",
"0.5575828",
"0.55713576",
"0.55678165",
"0.55678165",
"0.5563816",
"0.55580515",
"0.55490524",
"0.5542843",
"0.553505",
"0.5534845",
"0.5534085",
"0.55271477",
"0.55270505",
"0.55241024",
"0.55241024",
"0.55241024",
"0.55241024",
"0.55241024",
"0.55241024",
"0.55241024",
"0.55241024",
"0.55147064",
"0.5509306",
"0.5503718",
"0.5497827",
"0.54950327",
"0.54919267",
"0.54888356",
"0.54882264",
"0.5486059",
"0.54840666"
] | 0.7024584 | 5 |
GET /user_meals/1 GET /user_meals/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def meals\n get(\"/user/#{@user_id}/meals.json\")\n end",
"def index\n # get meals from the user\n @meals = @user.meals\n # create a new meal for the ajax form to use\n @meal = Meal.new\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meals }\n end\n end",
"def index\n @meals = current_user.meals\n end",
"def index\n @meals = current_user.meals\n end",
"def index\n @meals = current_user.meals.all\n end",
"def index\n @meals = Meal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meals }\n end\n end",
"def index\n @user_meals = UserMeal.all\n end",
"def show\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @meal }\n end\n end",
"def meal\n @meals = Meal.all\n\n respond_to do |format|\n #format.html # index.html.erb\n format.json { render json: @meals, :only => [:id, :name, :price], :include => { :items => {:only => [:id, :name, :description, :price, :time], :include => {:product_type => { :only => [:id, :name]}}}} }\n end\n end",
"def index\n @meals = Meal.all\n end",
"def set_meal\n @meal = current_user.meals.find(params[:id])\n end",
"def list\n meals = @meals_repository.all\n @view.list(meals)\n end",
"def show\n @meal_profile = MealProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal_profile }\n end\n end",
"def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal }\n end\n end",
"def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal }\n end\n end",
"def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @meal }\n end\n end",
"def show\n @meal = Meal.find(params[:id])\n end",
"def show\n @meal = Meal.find(params[:id])\n end",
"def show\n @meal = Meal.find(params[:id])\n end",
"def show \n @meal = Meal.where(id: params[:id])\n end",
"def menu\n foods = current_user.restaurant.meals.where(meal_type: 0)\n drinks = current_user.restaurant.meals.where(meal_type: 1)\n render json: {foods: foods, drinks: drinks, is_success: true}, status: :ok\n end",
"def show\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.js # show.js.erb\n format.json { render json: @meal }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal }\n end\n end",
"def show\n @user = User.find(params[:id])\n\t\t@loan_histories = LoanHistory.joins(:medium).where(\"user_id = ?\", params[:id]).order(\"rent_start\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def show\n @meal_meeting = MealMeeting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal_meeting }\n end\n end",
"def show\n @meal = Meal.find(params[:meal_id]) if params[:meal_id]\n @recipe = @meal.recipes.find(params[:id]) if @meal\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end",
"def list\n display_meals\n end",
"def show\n respond_to do |format|\n format.html { render :show }\n format.json { render json: @meal }\n end\n end",
"def meal_by_id(id)\n # API EXAMPLE: https://www.themealdb.com/api/json/v1/1/lookup.php?i=52772\n raise \"id is not an Integer (#{id.class})\" unless id.is_a?(Integer)\n\n content = api_call(\"lookup.php?i=#{id}\")\n validate(content)\n content\n end",
"def show\n @meal_time = MealTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal_time }\n end\n end",
"def set_user_meal\n @user_meal = UserMeal.find(params[:id])\n end",
"def new\n @meal_profile = MealProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal_profile }\n end\n end",
"def create\n @user_meal = UserMeal.new(user_meal_params)\n\n respond_to do |format|\n if @user_meal.save\n format.html { redirect_to @user_meal, notice: 'User meal was successfully created.' }\n format.json { render :show, status: :created, location: @user_meal }\n else\n format.html { render :new }\n format.json { render json: @user_meal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @diary = current_user.diaries.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @diary }\n end\n end",
"def all_deals(**args)\n params = parameters(args) do\n optional_params :user_id, :filter_id, :stage_id, :status, :start, :limit, :sort, :owned_by_you\n end\n request(:get, 'deals', params)\n end",
"def show\n user = Api::V1::User.find(params[:id])\n unless user.nil?\n render json: user.followings.all\n end\n end",
"def show\n user = Api::V1::User.find(params[:id])\n unless user.nil?\n render json: user.followings.all\n end\n end",
"def index\n @mealplan_meals = MealplanMeal.all\n end",
"def show\n @meal_preference = MealPreference.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal_preference }\n end\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def show\n @ingredience = Ingredience.find(params[:id])\n @meals = Meal.find(:all, :conditions => ['ingredience_id =?', @ingredience.id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ingredience }\n end\n end",
"def show\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @meal }\n end\n end",
"def set_meal\n @meal = Meal.find_by(id: params[:id])\n end",
"def index\n @goals = goals_for_current_user\n @goal = Goal.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end",
"def index\n if session[:meal_id].nil?\n redirect_to meals_path\n else\n @meal = Meal.find(session[:meal_id]) \n @meal_dishes = @meal.meal_dishes\n end \n end",
"def show_follows\n \t@user = User.find(params[:id])\n \t\n \trender json: @user.follows\n end",
"def new\n @group_meal = GroupMeal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_meal }\n end\n end",
"def show\n @goal_reward = GoalReward.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal_reward }\n end\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def requested\n @requested_meals = Meal.where(type: \"requested\")\n end",
"def index\n @indication_for_meals = IndicationForMeal.all\n end",
"def show_meals(userObj)\n table = TTY::Table.new [\"#{userObj.user_name}'s meals!\", \"Calories\", \"Foods\"], userObj.meal_arrays\n puts table.render(:ascii)\n end",
"def new\n @meal_meeting = MealMeeting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal_meeting }\n end\n end",
"def set_meal\n @meal = Meal.find_by(user_id: current_user.id)\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.available.exclusive(current_user).find(params[:id])\n end",
"def show\n @msalary = Msalary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @msalary }\n end\n end",
"def show\n @meals_recipe = MealsRecipe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @meals_recipe }\n end\n end",
"def show\n\t\t@user = User.find params[:id]\n\t\t@medical = @user.medical\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @user }\n\t\tend\n\tend",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def show_follows\n\t@user = User.find(params[:id])\n\n\trender json: @user.follows\n\tend",
"def index\n respond_with(deals)\n end",
"def show\n @user = User.find(params[:id])\n @followers = Following.where(:followed_id => @user).all\n meta :title => @user.name\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def index\n @goal_rewards = user.goal_rewards\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goal_rewards }\n end\n end",
"def show\n @goal = Goal.find(params[:id])\n render json: @goal\n end",
"def index\n @meal_records = current_user.meal_records.all\n end",
"def me\n\t\tuser_listings = current_user.listings\n render json: [current_user, user_listings]\n end",
"def new\n @journal = @journals.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @journal }\n end\n end",
"def create\n @meal = current_user.meals.build(meal_params)\n @meal.ip_address = request.location.ip\n @meal.expires_at = DateTime.now + 1.hour\n\n respond_to do |format|\n if @meal.save\n format.html { redirect_to @meal, notice: 'Meal was successfully created.' }\n format.json { render :show, status: :created, location: @meal }\n else\n format.html { render :new }\n format.json { render json: @meal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def findFollowees\n @user = User.find(params[:id])\n @followees = @user.followees.all\n render json: @followees, status: :ok\n end",
"def show\n @masut_assay = MasutAssay.find(params[:id])\n @authorized_user = User.find(session[:user_id])\n respond_to do |format|\n format.html {render layout: false}\n format.json { render json: @masut_assay }\n end\n end",
"def show\n @user_follow_user = UserFollowUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_follow_user }\n end\n end",
"def new\n @meal_time = MealTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal_time }\n end\n end",
"def show_deal(id)\n get(\"deals/#{id}\")\n end",
"def random_meal\n # API EXAMPLE: https://www.themealdb.com/api/json/v1/1/random.php\n content = api_call('random.php')\n validate(content)\n content\n end",
"def show\n goal = Goal.find(params[:id])\n render json: goal,status: :ok\n end",
"def show \n respond_to do |format| \n format.json { render json: @user.as_json(include: {mashups: {}})}\n end\n end",
"def index\n @meals = TestSubject.find(@test_subject.id).meals.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @meals }\n end\n end",
"def show\n @meals = Menu.meals\n @locations = Menu.locations\n @menu = Menu.where(id: params[:id]).first\n @items = @menu.items.sort_by{ |obj| obj.updated_at }\n #we have access to meal\n end",
"def show\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @meal }\n end\n end",
"def index\n @goals = @user.goals\n \n render json: @goals\n end",
"def show\n @twitter_user = TwitterUser.find(params[:id])\n @follower_ids = Twitter.follower_ids(@twitter_user.twitter_username).collection\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @twitter_user }\n end\n end",
"def destroy\n @user_meal.destroy\n respond_to do |format|\n format.html { redirect_to user_meals_url, notice: 'User meal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def list\n # 1. Ask the repo to bring all meals #all\n meals = @meal_repo.all\n # 2. Pass the meals to the view to display them\n @meal_view.display_all(meals)\n end",
"def create\n @meal = Meal.new(meal_params)\n\n respond_to do |format|\n if @meal.save\n format.html { redirect_to @meal, notice: 'Meal was successfully created.' }\n format.json { render json: @meal, status: :created, location: @meal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @meal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n unless user_signed_in?\n redirect_to new_user_session_path, :notice=>\"Please log in\"\n return\n end\n \n @borrow = Borrow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @borrow }\n end\n end",
"def new\n @shout = Shout.new\n @user = User.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shout }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @appeal }\n end\n end",
"def show\n user = User.find(params[:id])\n # render json: {\n # # user.to_json(include: :stories, except: :password_digest)\n # user: user,\n # stories: user.stories,\n # success: true\n # }\n render json: user.to_json(include: :stories, except: :password_digest)\n end",
"def addcustomcalories\n\t\t\t\n\t\t@user=User.find(params[:id])\n\t\t@params=params[:meals]\n\t\[email protected](\"**\").collect{|a| a}\n\n\n\t\t@userfile= params[:userfile]\n\t\[email protected]\n\t\t@filename = \"#{Rails.root}/public/\"+params[:id][email protected]_filename\n\n\t\tFile.open(@filename, \"wb\") do |file|\n\t\tfile.write(@userfile.read)\n\t\tend\n\t\t\n\t\t\n\t\t@meal [email protected](:ate_on=>mealsdata[0],:note => mealsdata[1],:meal_type=>mealsdata[2],:time_of_day=>Time.zone.now.strftime(\"%H-%M-%S\"))\n\t\[email protected]_items.create(:food_id=>8443,:calories=>mealsdata[3])\t\t\t\n\t\[email protected]=File.open(@filename)\n\t\t\n\t\tif @meal.save\n\t\t@status={\"status-msg\"=>\"Success\"}\n\t\telse\n\t\t@status={\"status-msg\"=>\"Fail\"}\n\t\tend\n\t\t\n\t\t \n\t\tFile.delete(@filename)\n\t\trender :json =>@status.to_json\t\t\t\n\t\n\tend",
"def index\n @meals = TestSubject.find(@test_subject.id).meals\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @meals }\n end\n end",
"def show\n @mood = Mood.find(params[:id])\n respond_to do |format|\n format.any { render :json => @mood }\n end\n end",
"def find_user_id\n @listings = Listing.where(\"user_id = ?\",params[:user_id]).all\n if [email protected]?\n ret = []\n @listings.each do |listing|\n ret << listing.as_json(include: :book)\n end\n render :json => ret\n else\n render :json => \"user has no listings\".to_json\n end\n end"
] | [
"0.90346825",
"0.77251095",
"0.7368014",
"0.7368014",
"0.7217244",
"0.7092562",
"0.7029679",
"0.68638396",
"0.68521076",
"0.6734284",
"0.662611",
"0.65732783",
"0.65415543",
"0.6540002",
"0.6540002",
"0.6485172",
"0.6476806",
"0.6476806",
"0.6476806",
"0.64532924",
"0.64325035",
"0.63799554",
"0.62809503",
"0.6243308",
"0.62379014",
"0.61849916",
"0.61622775",
"0.61559534",
"0.61441296",
"0.6138477",
"0.60988694",
"0.60705715",
"0.6016872",
"0.5982218",
"0.59587",
"0.5943428",
"0.5943428",
"0.5943057",
"0.5937028",
"0.591347",
"0.591347",
"0.5910148",
"0.5902175",
"0.58962077",
"0.58915716",
"0.5875342",
"0.5874593",
"0.5872012",
"0.5870934",
"0.58686507",
"0.58680815",
"0.58620894",
"0.5858133",
"0.58570206",
"0.585307",
"0.58525175",
"0.58525175",
"0.58525175",
"0.58525175",
"0.58525175",
"0.58525175",
"0.58525175",
"0.58525175",
"0.5845911",
"0.5829703",
"0.5826852",
"0.58265954",
"0.5826391",
"0.5809491",
"0.57935804",
"0.578616",
"0.57701474",
"0.57644176",
"0.5763001",
"0.5750227",
"0.574719",
"0.5742061",
"0.5734508",
"0.5729617",
"0.572475",
"0.5710963",
"0.570667",
"0.5702975",
"0.5696374",
"0.56927013",
"0.56920576",
"0.5687455",
"0.5685644",
"0.568289",
"0.566595",
"0.5645235",
"0.5644517",
"0.5641562",
"0.56186587",
"0.5617675",
"0.56132615",
"0.5612187",
"0.56108975",
"0.5605519",
"0.56009597",
"0.5599228"
] | 0.0 | -1 |
POST /user_meals POST /user_meals.json | def create
@user_meal = UserMeal.new(user_meal_params)
respond_to do |format|
if @user_meal.save
format.html { redirect_to @user_meal, notice: 'User meal was successfully created.' }
format.json { render :show, status: :created, location: @user_meal }
else
format.html { render :new }
format.json { render json: @user_meal.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def meals\n get(\"/user/#{@user_id}/meals.json\")\n end",
"def index\n # get meals from the user\n @meals = @user.meals\n # create a new meal for the ajax form to use\n @meal = Meal.new\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meals }\n end\n end",
"def create\n @meal = current_user.meals.build(meal_params)\n @meal.ip_address = request.location.ip\n @meal.expires_at = DateTime.now + 1.hour\n\n respond_to do |format|\n if @meal.save\n format.html { redirect_to @meal, notice: 'Meal was successfully created.' }\n format.json { render :show, status: :created, location: @meal }\n else\n format.html { render :new }\n format.json { render json: @meal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @meal = Meal.create(user_id: current_user.id)\n @meal.update(meal_params)\n if @meal.save\n flash[:notice] = \"Meal was successfully created\"\n redirect_to user_meal_path(current_user, @meal)\n else\n flash[:error] = \"Please update complete the form\"\n redirect_to controller: \"meals\", action: \"new\"\n end\n\n end",
"def create\n @meal = Meal.new(meal_params)\n\n respond_to do |format|\n if @meal.save\n format.html { redirect_to @meal, notice: 'Meal was successfully created.' }\n format.json { render json: @meal, status: :created, location: @meal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @meal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def meal_params\n params.require(:meal).permit(:date, :meal, :ingredients, :nutrition, :notes, :target, :user_id)\n end",
"def goals_add\n @goal = Goal.create(goal_params)\n goal = GoalsUser.create({user_id:@user.id,goal_id:@goal.id})\n respond_to do |f|\n f.html {redirect_to goals_path(@user)}\n f.json {render json: {new_goal:goal,success: true}}\n end\n end",
"def set_meal\n @meal = current_user.meals.find(params[:id])\n end",
"def create\n @meal_posting = MealPosting.new(meal_posting_params)\n @meal_posting.user = current_user\n\n respond_to do |format|\n if @meal_posting.save\n format.html { redirect_to @meal_posting }#, notice: 'Meal posting was successfully created.' }\n format.json { render :show, status: :created, location: @meal_posting }\n else\n format.html { render :new }\n format.json { render json: @meal_posting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @meals = current_user.meals\n end",
"def index\n @meals = current_user.meals\n end",
"def like(meal)\n self.customer_meals.create!(meal_id: meal.id)\n end",
"def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal }\n end\n end",
"def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal }\n end\n end",
"def meal_params\n params.require(:meal).permit(:name, :description, :location, :image, :expires_at)\n end",
"def meal_params\n params.require(:meal).permit(:title, :food_name, :sick, :sick_type, :comments, :user_id)\n end",
"def create\n @group_meal = GroupMeal.new(params[:group_meal])\n\n respond_to do |format|\n if @group_meal.save\n format.html { redirect_to @group_meal, notice: 'Group meal was successfully created.' }\n format.json { render json: @group_meal, status: :created, location: @group_meal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group_meal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def meal_params\n params.require(:meal).permit(\n :name, :time, :notes\n )\n end",
"def addcustomcalories\n\t\t\t\n\t\t@user=User.find(params[:id])\n\t\t@params=params[:meals]\n\t\[email protected](\"**\").collect{|a| a}\n\n\n\t\t@userfile= params[:userfile]\n\t\[email protected]\n\t\t@filename = \"#{Rails.root}/public/\"+params[:id][email protected]_filename\n\n\t\tFile.open(@filename, \"wb\") do |file|\n\t\tfile.write(@userfile.read)\n\t\tend\n\t\t\n\t\t\n\t\t@meal [email protected](:ate_on=>mealsdata[0],:note => mealsdata[1],:meal_type=>mealsdata[2],:time_of_day=>Time.zone.now.strftime(\"%H-%M-%S\"))\n\t\[email protected]_items.create(:food_id=>8443,:calories=>mealsdata[3])\t\t\t\n\t\[email protected]=File.open(@filename)\n\t\t\n\t\tif @meal.save\n\t\t@status={\"status-msg\"=>\"Success\"}\n\t\telse\n\t\t@status={\"status-msg\"=>\"Fail\"}\n\t\tend\n\t\t\n\t\t \n\t\tFile.delete(@filename)\n\t\trender :json =>@status.to_json\t\t\t\n\t\n\tend",
"def index\n @meals = current_user.meals.all\n end",
"def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @meal }\n end\n end",
"def add\n meal_name = @view.ask_name\n meal_price = @view.ask_price.to_i\n new_meal = Meal.new({name: meal_name, price: meal_price})\n @meals_repository.add(new_meal)\n end",
"def index\n @user_meals = UserMeal.all\n end",
"def create\n @indication_for_meal = IndicationForMeal.new(indication_for_meal_params)\n\n respond_to do |format|\n if @indication_for_meal.save\n format.html { redirect_to @indication_for_meal, notice: 'Indication for meal was successfully created.' }\n format.json { render action: 'show', status: :created, location: @indication_for_meal }\n else\n format.html { render action: 'new' }\n format.json { render json: @indication_for_meal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_user_meal\n @user_meal = UserMeal.find(params[:id])\n end",
"def add\n # ask user for name and price\n attributes = {\n name: @view.ask_for_string(:name),\n price: @view.ask_for_number(:price)\n }\n # make new meal object\n # pass that to the repository\n @meals_repository.add(Meal.new(attributes))\n end",
"def user_meal_params\n params.fetch(:user_meal, {})\n end",
"def create\n @meal_profile = MealProfile.new(params[:meal_profile])\n\n respond_to do |format|\n if @meal_profile.save\n format.html { redirect_to @meal_profile, notice: 'Meal profile was successfully created.' }\n format.json { render json: @meal_profile, status: :created, location: @meal_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @meal_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @medal = Medal.new(medal_params)\n\n respond_to do |format|\n if @medal.save\n format.html { redirect_to @medal, notice: 'Medal was successfully created.' }\n format.json { render :show, status: :created, location: @medal }\n else\n format.html { render :new }\n format.json { render json: @medal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def meal_params\n params.permit(:name, :photo, :rating)\n end",
"def create\n @cooked_meal = CookedMeal.new(cooked_meal_params)\n\n respond_to do |format|\n if @cooked_meal.save\n format.html { redirect_to @cooked_meal, notice: 'Cooked meal was successfully created.' }\n format.json { render :show, status: :created, location: @cooked_meal }\n else\n format.html { render :new }\n format.json { render json: @cooked_meal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n rental = sporting_goods.rentals.new(rental_params)\n rental.user_id = current_user.id\n if rental.save\n render json: rental, status: 200\n else\n render json: rental, status: 400\n end\n end",
"def meal_params\n properties = [:title, :calories, :date, :time]\n properties << :user_id if current_user.admin?\n params.require(:meal).permit(*properties)\n end",
"def add\n # ask user for name and price\n attributes = {\n name: @view.ask_for_string(:name),\n price: @view.ask_for_number(:price)\n }\n # make new meal object\n # pass that to the repo\n @meals_repo.add(Meal.new(attributes))\n end",
"def destroy\n @user_meal.destroy\n respond_to do |format|\n format.html { redirect_to user_meals_url, notice: 'User meal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @meals = Meal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meals }\n end\n end",
"def create\n @meal = Meal.new(params[:meal])\n respond_to do |format|\n if @meal.save\n recipeid = @meal.recipe_id\n flash[:notice] = 'Meal was successfully created.'\n #format.html { redirect_to(recipe_url(recipeid), :layout => false) }\n format.xml { render :xml => @meal, :status => :created, :meal => @meal }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @meal.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @mealplan_meal = MealplanMeal.new(mealplan_meal_params)\n\n respond_to do |format|\n if @mealplan_meal.save\n format.html { redirect_to @mealplan_meal, notice: 'Mealplan meal was successfully created.' }\n format.json { render :show, status: :created, location: @mealplan_meal }\n else\n format.html { render :new }\n format.json { render json: @mealplan_meal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def meal_params\n params.require(:meal).permit(:day_id, :time, :portions, :name, :favorite, :notes, :meal_type)\n end",
"def create\n @mealplan = Mealplan.new(mealplan_params.merge(user: current_user))\n\n respond_to do |format|\n if @mealplan.save\n format.html { redirect_to @mealplan, notice: 'Mealplan was successfully created.' }\n format.json { render :show, status: :created, location: @mealplan }\n else\n format.html { render :new }\n format.json { render json: @mealplan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_meal.update(user_meal_params)\n format.html { redirect_to @user_meal, notice: 'User meal was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_meal }\n else\n format.html { render :edit }\n format.json { render json: @user_meal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @goal = Goal.new(goal_params)\n @goal.user = current_user # associate the new goal to the current_user\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to user_goals_path(current_user), notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def meal\n @meals = Meal.all\n\n respond_to do |format|\n #format.html # index.html.erb\n format.json { render json: @meals, :only => [:id, :name, :price], :include => { :items => {:only => [:id, :name, :description, :price, :time], :include => {:product_type => { :only => [:id, :name]}}}} }\n end\n end",
"def index\n @meals = User.find(params['user_id']).meals.order('meals.created_at DESC')\n @oldmeal = User.find(params['user_id']).meals\n puts \"params: #{params['user_id']}\"\n puts \"all params: #{params}\"\n # puts \"chicken: #{User.find(1).meals.where([\"food_name like ? and sick = ?\", \"%Apples%\", true])}\"\n # @apples = User.find(1).meals.where([\"food_name like ? and sick = ?\", \"%Apples%\", true])\n # @apples = @meals.where([\"food_name like ? and sick = ?\", \"%Apples%\", true])\n\n\n # Seems like I need to add this whole section to create and post routes?????\n @sick = @oldmeal.select(:food_name).where(\"sick\": true)\n @sickCount = @sick.group(:food_name).count\n @sickString = ''\n @sick.each {|x| @sickString.concat(\" \" + x[:food_name])}\n @sickNoComma = @sickString.gsub(/,/, ' ').gsub(/ /, ' ')\n @stringResult = @sickNoComma.downcase.split.inject(Hash.new(0)) { |h,v| h[v] += 1; h }\n\n # I think it would make sense to 'clean' @sickString to make it all downcase and remove commas\n puts \"apple test: #{@sick} count: #{@sickCount} string: #{@sickString}\"\n\n # Could certainly refactor this down to only show meals and stringResult\n\n render json: {meals: @meals, sick: @sick, count: @sickCount, string: @sickString, stringResult: @stringResult.sort_by {|key, value| value}}\n # render json: @meals.reverse\n end",
"def meal_params\n params.require(:meal).permit(:result_no, :generate_no, :e_no, :last_result_no, :last_generate_no, :i_no, :name, :recovery, :effect_1_id, :effect_1_value, :effect_2_id, :effect_2_value, :effect_3_id, :effect_3_value)\n end",
"def create\n user_id = params[:karyalay_list][:user_id]\n @karyalay_list = KaryalayList.new(karyalay_list_params)\n @karyalay_list.user = User.find_by(id: user_id)\n if @karyalay_list.save\n render json: @karyalay_list\n else\n render json: { id: nil }\n end\n end",
"def meal_params\n params.require(:meal).permit(:meal_type, :id)\n end",
"def create\n @meal_record = Form::MealRecord.new(meal_record_params)\n\n respond_to do |format|\n if @meal_record.save\n format.html { redirect_to @meal_record, notice: 'Meal record was successfully created.' }\n format.json { render :show, status: :created, location: @meal_record }\n else\n format.html { render :new }\n format.json { render json: @meal_record.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n reset_session\n @user = User.new\n @meal_dates = [\"2013-07-08\",\"2013-07-09\",\"2013-07-10\",\"2013-07-11\",\"2013-07-12\",\"2013-07-13\",\"2013-07-14\"]\n @child = @user.children.build\n @meal = @user.meals.build\n @travels = @user.travels.build\n @registration = @user.registrations.build\n @programs = Program.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def create\n params['user_id'] = current_user.id if current_user\n @mood = Mood.new(mood_params)\n\n if @mood.save\n render json: { location: format_mood(@mood) }, status: :created\n else\n render json: @mood.errors, status: :unprocessable_entity\n end\n end",
"def create\n @malice = Malice.new(malice_params)\n\n respond_to do |format|\n if @malice.save\n format.html { redirect_to @malice, notice: 'Malice was successfully created.' }\n format.json { render :show, status: :created, location: @malice }\n else\n format.html { render :new }\n format.json { render json: @malice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def meal_params\n params.require(:meal).permit(:name, :calories, :meal_time_text,\n :meal_date_text, :meal_time, :meal_date)\n end",
"def create\n # This...\n @meal = @meal.consumptions.build(params[:food])\n # ...does the same as this\n # @meal = Meal.new(params[:meal])\n # @meal.food = @food\n \n respond_to do |format|\n if @meal.save\n format.js \n format.html { redirect_to user_path(@user), notice: 'Meal was successfully created.' }\n format.json { render json: @meal, status: :created, location: @meal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @meal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @meal_profile = MealProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal_profile }\n end\n end",
"def create\n @meal_meeting = MealMeeting.new(params[:meal_meeting])\n\n respond_to do |format|\n if @meal_meeting.save\n format.html { redirect_to @meal_meeting, notice: 'Meal meeting was successfully created.' }\n format.json { render json: @meal_meeting, status: :created, location: @meal_meeting }\n else\n format.html { render action: \"new\" }\n format.json { render json: @meal_meeting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @goals = goals_for_current_user\n @goal = Goal.new(params[:goal])\n @goal.user = current_user\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to({action: 'index'}, notice: 'Goal was successfully created.') }\n format.json { render json: @goal, status: :created, location: @goal }\n else\n format.html { render action: 'index' }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mental_post = MentalPost.new(mental_post_params)\n @mental_post.user = current_user\n\n respond_to do |format|\n if @mental_post.save\n format.html { redirect_to @mental_post, notice: \"Mental post was successfully created.\" }\n format.json { render :show, status: :created, location: @mental_post }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @mental_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @diet = Diet.new(diet_params)\n @diet.user = @current_user\n\n if @diet.save\n render json: @diet, status: 201, location: @diet, root: true\n else\n render json: @diet.errors, status: 422\n end\n end",
"def create\n @meals_recipe = MealsRecipe.new(params[:meals_recipe])\n\n respond_to do |format|\n if @meals_recipe.save\n flash[:notice] = 'MealsRecipe was successfully created.'\n format.html { redirect_to(@meals_recipe) }\n format.xml { render :xml => @meals_recipe, :status => :created, :location => @meals_recipe }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @meals_recipe.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def menu\n foods = current_user.restaurant.meals.where(meal_type: 0)\n drinks = current_user.restaurant.meals.where(meal_type: 1)\n render json: {foods: foods, drinks: drinks, is_success: true}, status: :ok\n end",
"def create\n @hotdeal = current_user.hotdeals.build(hotdeal_params)\n\n respond_to do |format|\n if @hotdeal.save\n format.html { redirect_to @hotdeal, notice: 'Hotdeal was successfully created.' }\n format.json { render :show, status: :created, location: @hotdeal }\n else\n format.html { render :new }\n format.json { render json: @hotdeal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account_medal = AccountMedal.new(account_medal_params)\n\n respond_to do |format|\n if @account_medal.save\n format.html { redirect_to @account_medal, notice: 'Account medal was successfully created.' }\n format.json { render :show, status: :created, location: @account_medal }\n else\n format.html { render :new }\n format.json { render json: @account_medal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @maling = Maling.new(maling_params)\n\n respond_to do |format|\n if @maling.save\n format.html { redirect_to @maling, notice: 'Maling was successfully created.' }\n format.json { render :show, status: :created, location: @maling }\n else\n format.html { render :new }\n format.json { render json: @maling.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @group_meal = GroupMeal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_meal }\n end\n end",
"def create\n if session[:meal_id].nil?\n redirect_to meals_path\n else\n @meal = Meal.find(session[:meal_id]) \n @meal_dish = @meal.meal_dishes.new(meal_dish_params)\n end \n\n respond_to do |format|\n if @meal_dish.save\n format.html { redirect_to meal_dishes_url, notice: 'Meal dish was successfully created.' }\n format.json { render action: 'show', status: :created, location: @meal_dish }\n else\n format.html { render action: 'new' }\n format.json { render json: @meal_dish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @deal = Deal.new(deal_params)\n @deal.user_id = current_user.id\n\n respond_to do |format|\n if @deal.save\n format.html { redirect_to @deal, notice: 'Deal was successfully created.' }\n format.json { render action: 'show', status: :created, location: @deal }\n else\n format.html { render action: 'new' }\n format.json { render json: @deal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @goal_reward = user.goal_rewards.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal_reward }\n end\n end",
"def create\n @meal_recipe = MealRecipe.new(meal_recipe_params)\n \n @meal_plan = @meal_recipe.meal.day.meal_plan\n @meal = @meal_recipe.meal\n # @day = @meal.day\n @meal_ingredient = MealIngredient.new\n # @leftover = Leftover.user(current_user).includes(:meal_recipe)\n \n if @meal_recipe.recipe.present?\n @meal_recipe.portions = @meal_recipe.recipe.portions\n end\n\n respond_to do |format|\n \n if @meal_recipe.recipe.present? && @meal_recipe.save\n create_meal_ingredients_for_recipe(@meal_recipe)\n format.turbo_stream\n format.html { redirect_to @meal_plan, notice: \"Meal recipe was successfully created.\" }\n format.json { render :show, status: :created, location: @meal_recipe }\n else\n format.html { redirect_to @meal_plan, notice: \"Meal recipe not added, please select recipe from list\" }\n format.json { render :show, status: :created, location: @meal_recipe }\n end\n end\n end",
"def create\n @goal = Goal.new(goal_params)\n @goal.user_id = current_user.id\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to @goal, notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def addMeal(meal)\n @meals[meal.name] = meal\n @meals[\"other\"].remove_qty(meal.quantity)\n end",
"def set_meal\n @meal = Meal.find_by(user_id: current_user.id)\n end",
"def create\n @goal = Goal.new(goal_params)\n @goal.user = current_user\n @goals = current_user.goals\n respond_to do |format|\n if @goal.save\n format.html { redirect_to home_index_path, notice: 'Goal was successfully created.' }\n # format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new, notice: \"There was an error updating your goal.\" }\n # format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @goal = Goal.new(goal_params)\n @goal.user_id=current_user.id\n \n respond_to do |format|\n if @goal.save\n format.html { redirect_to @goal, notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_solo\n @goal = Goal.new(params[:goal])\n @goal.user = current_user\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to @goal, notice: 'Goal was successfully created.' }\n format.json { render json: @goal, status: :created, location: @goal }\n else\n format.html { render action: 'new' }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @journal = @journals.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @journal }\n end\n end",
"def create\n @goal_reward = GoalReward.new(params[:goal_reward])\n\n respond_to do |format|\n if @goal_reward.save\n format.html { redirect_to [@goal_reward.user, GoalReward], notice: 'Goal reward was successfully created.' }\n format.json { render json: @goal_reward, status: :created, location: @goal_reward }\n else\n format.html { render action: \"new\" }\n format.json { render json: @goal_reward.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_meal\n @meal = Meal.find_by(id: params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def create\n @meal_food = MealFood.new(meal_food_params)\n\n respond_to do |format|\n if @meal_food.save\n format.html { redirect_to @meal_food, notice: 'Meal food was successfully created.' }\n format.json { render :show, status: :created, location: @meal_food }\n else\n format.html { render :new }\n format.json { render json: @meal_food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n num_days = (Date.parse(params['rent_info']['end_date']).mjd - Date.parse(params['rent_info']['start_date']).mjd) \n total = num_days * params['rent_info']['price_per_day']\n # byebug\n if User.find(params['rent_info']['owner_id'])\n user = User.find(params['rent_info']['owner_id'])\n user.money_made += total \n user.save\n end\n\n renter_post = RenterPost.create(\n renter_id: params['rent_info']['renter_id'],\n post_id: params['rent_info'][\"post_id\"],\n start_date: params['rent_info'][\"start_date\"],\n end_date: params['rent_info'][\"end_date\"],\n status: params['rent_info'][\"status\"]\n )\n if renter_post \n render json: renter_post\n else\n render json: {error: \"Could not create Renter Post\"}\n end\n end",
"def meal_params\n params.require(:meal).permit(:fifth_day, :fifth_day_meal_type, :first_day, :first_day_meal_type, :food_type, :fourth_day, :fourth_day_meal_type, :second_day, :second_day_meal_type, :sixth_day, :sixth_day_meal_type, :third_day, :third_day_meal_type)\n end",
"def create\n @form_object = Meal::FormObject.new(form_object_params)\n respond_to do |format|\n if @form_object.save\n format.html { redirect_to @form_object, notice: 'Meal was successfully created.' }\n format.json { render :show, status: :created, location: @form_object }\n else\n format.html { render :new }\n format.json { render json: @form_object.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n passenger = Passenger.new(:name => params[:name], :contact_number => params[:contact_number], :nationality => params[:nationality], :meal_pref => params[:meal_pref])\n passenger.save\n render :json => passenger\n end",
"def new\n @meal_meeting = MealMeeting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal_meeting }\n end\n end",
"def create\n params[:user][:admin] = 0\n @user = User.new(params[:user])\n @user.meals_remaining = 0\n if @user.save\n UserMailer.welcome_email(@user).deliver\n respond_to do |format|\n format.html { render :controller => \"users\", :action => \"show\" }\n format.js { render :action => \"user_create_success\" }\n end\n else\n @errors = @user.errors.full_messages\n @errors.uniq!\n flash[:error_header] = \"Something went wrong.\"\n flash[:error_subheader] = \"The email address or password you entered was incorrect.\"\n respond_to do |format|\n format.html { redirect_to account_url }\n format.js { render :action => \"user_create_failure\" }\n end\n end\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def create\n @journal = @journals.new(params[:journal])\n\n respond_to do |format|\n if @journal.save\n format.html { redirect_to [@user, @journal], notice: 'Journal was successfully created.' }\n format.json { render json: @journal, status: :created, location: @journal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @journal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_deal(**args)\n params = parameters(args) do\n required_params :title\n optional_params :title, :value, :currency, :user_id, :person_id, :org_id, :stage_id, :status, :probability, :lost_reason, :add_time, :visible_to\n end\n request(:post, 'deals', params)\n end",
"def create\n @diary_entry = DiaryEntry.new(diary_entry_params)\n current_user.diary_entries << @diary_entry\n\n respond_to do |format|\n if @diary_entry.save\n format.html { redirect_to @diary_entry, notice: 'Diary entry was successfully created.' }\n format.json { render action: 'show', status: :created, location: @diary_entry }\n else\n format.html { render action: 'new' }\n format.json { render json: @diary_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_meal\n @meal = Meal.available.exclusive(current_user).find(params[:id])\n end",
"def add_food(food)\n food_meals.create(food_id: food.id)\n end"
] | [
"0.780348",
"0.7259802",
"0.6707388",
"0.65155244",
"0.6507159",
"0.64489",
"0.62967294",
"0.62907726",
"0.6222356",
"0.6189262",
"0.6189262",
"0.61617744",
"0.6084193",
"0.6084193",
"0.6080981",
"0.6080689",
"0.60731405",
"0.6038379",
"0.60367376",
"0.60283864",
"0.60189366",
"0.5990119",
"0.59851",
"0.59835684",
"0.5968578",
"0.5929699",
"0.59015137",
"0.5899029",
"0.5877751",
"0.58660996",
"0.58474433",
"0.5843246",
"0.58253336",
"0.5819014",
"0.58092296",
"0.58002776",
"0.57997566",
"0.5788847",
"0.57754904",
"0.5765697",
"0.57578635",
"0.57498676",
"0.57477987",
"0.573589",
"0.5724292",
"0.57103956",
"0.57101995",
"0.56825274",
"0.56804353",
"0.56800544",
"0.56737196",
"0.5669715",
"0.5663793",
"0.56481075",
"0.5646818",
"0.56447893",
"0.56324774",
"0.5618861",
"0.5614454",
"0.56141037",
"0.56096894",
"0.56046367",
"0.56024736",
"0.5596892",
"0.5594659",
"0.55829716",
"0.55792487",
"0.5570976",
"0.5565164",
"0.5555422",
"0.55518925",
"0.5547782",
"0.5542008",
"0.5539493",
"0.5533667",
"0.55292785",
"0.55168724",
"0.55165",
"0.55165",
"0.5512578",
"0.55067664",
"0.55066144",
"0.55055636",
"0.5505218",
"0.54996073",
"0.5496323",
"0.5495653",
"0.5495653",
"0.5495653",
"0.5495653",
"0.5495653",
"0.5495653",
"0.5495653",
"0.5495653",
"0.5495316",
"0.5492471",
"0.54922926",
"0.5487995",
"0.54878265",
"0.54867744"
] | 0.71315765 | 2 |
PATCH/PUT /user_meals/1 PATCH/PUT /user_meals/1.json | def update
respond_to do |format|
if @user_meal.update(user_meal_params)
format.html { redirect_to @user_meal, notice: 'User meal was successfully updated.' }
format.json { render :show, status: :ok, location: @user_meal }
else
format.html { render :edit }
format.json { render json: @user_meal.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n if @meal.update_attributes(params[:meal])\n format.html { redirect_to @meal, notice: 'Meal was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @meal.update(meal_params)\n format.html { redirect_to @meal, notice: 'Meal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n if @meal.update_attributes(params[:meal])\n flash[:notice] = 'Meal was successfully updated.'\n format.html { redirect_to([@test_subject, @meal]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @meal.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n if @meal.update(meal_params)\n flash[:notice] = 'Meal was successfully updated.'\n format.html { redirect_to([@test_subject, @meal]) }\n format.xml { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @meal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @indication_for_meal.update(indication_for_meal_params)\n format.html { redirect_to @indication_for_meal, notice: 'Indication for meal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @indication_for_meal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cooked_meal.update(cooked_meal_params)\n format.html { redirect_to @cooked_meal, notice: 'Cooked meal was successfully updated.' }\n format.json { render :show, status: :ok, location: @cooked_meal }\n else\n format.html { render :edit }\n format.json { render json: @cooked_meal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @meals_recipe = MealsRecipe.find(params[:id])\n\n respond_to do |format|\n if @meals_recipe.update_attributes(params[:meals_recipe])\n flash[:notice] = 'MealsRecipe was successfully updated.'\n format.html { redirect_to(@meals_recipe) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @meals_recipe.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @meal = Meal.find(params[:id])\n recipeid = @meal.recipe_id\n respond_to do |format|\n if @meal.update_attributes(params[:meal])\n flash[:notice] = 'Meal was successfully updated.'\n format.html { redirect_to(recipe_url(recipeid)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lsit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @meal_record.update(meal_record_params)\n format.html { redirect_to @meal_record, notice: 'Meal record was successfully updated.' }\n format.json { render :show, status: :ok, location: @meal_record }\n else\n format.html { render :edit }\n format.json { render json: @meal_record.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @meal = @meal_recipe.meal\n @meal_plan = @meal.day.meal_plan\n @leftover = Leftover.meal_recipe(@meal_recipe).first\n @meal_ingredient = MealIngredient.new\n\n respond_to do |format|\n if params[:meal_recipe][:multiply].present?\n multiply_portions_and_ingredients(params[:meal_recipe][:multiply].to_d)\n end\n\n if params[:meal_recipe][:add].present?\n # @meal_recipe = MealRecipe.find(params[:id])\n @portions = @meal_recipe.portions\n ratio_increase = 1 + 1/@portions\n multiply_portions_and_ingredients(ratio_increase)\n end\n\n \n if @meal_recipe.update(meal_recipe_params)\n format.turbo_stream\n format.html { redirect_to @meal_recipe, notice: \"Meal recipe was successfully updated.\" }\n format.json { render :show, status: :ok, location: @meal_recipe }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @meal_recipe.errors, status: :unprocessable_entity }\n end\n \n end\n end",
"def update\n @meal_meeting = MealMeeting.find(params[:id])\n\n respond_to do |format|\n if @meal_meeting.update_attributes(params[:meal_meeting])\n format.html { redirect_to @meal_meeting, notice: 'Meal meeting was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meal_meeting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if params[:meal][:expires_at] == \"1\"\n params[:meal][:expires_at] = 1.hour.from_now\n else \n params[:meal].delete(:expires_at)\n end\n\n respond_to do |format|\n if @meal.update(meal_params)\n format.html { redirect_to @meal, notice: 'Meal was successfully updated.' }\n format.json { render :show, status: :ok, location: @meal }\n else\n format.html { render :edit }\n format.json { render json: @meal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @meal_profile = MealProfile.find(params[:id])\n\n respond_to do |format|\n if @meal_profile.update_attributes(params[:meal_profile])\n format.html { redirect_to @meal_profile, notice: 'Meal profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meal_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @mood = Mood.find(params[:id])\n @user = User.find(params[:user_id])\n\n respond_to do |format|\n if @mood.update_attributes(params[:mood])\n format.json { head :ok }\n else\n format.json { render :xml => @mood.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 set_meal\n @meal = current_user.meals.find(params[:id])\n end",
"def update\n # if @bonus.update(bonus_params)\n # render :show, status: :ok, location: @bonus\n # else\n # render json: @bonus.errors, status: :unprocessable_entity\n # end\n end",
"def update\n goal = Goal.find params[:id]\n if goal.update(goal_params)\n render json: goal, status: 200\n else\n render json: goal.errors.full_messages, status: 422\n end\n end",
"def update\n @day.update(meals: params[:meals])\n #respond_to do |format|\n #if @day.update(day_params)\n #format.html { redirect_to @day, notice: 'Day was successfully updated.' }\n #format.json { render :show, status: :ok, location: @day }\n #else\n #format.html { render :edit }\n #format.json { render json: @day.errors, status: :unprocessable_entity }\n #end\n #end\n end",
"def update\n if params[:user_goal_id] && params[user_id]\n goals = @user.update!(user_goal_params)\n render json: goals, status: :accepted\n end\n end",
"def update\n respond_to do |format|\n if @mealplan_meal.update(mealplan_meal_params)\n format.html { redirect_to @mealplan_meal, notice: 'Mealplan meal was successfully updated.' }\n format.json { render :show, status: :ok, location: @mealplan_meal }\n else\n format.html { render :edit }\n format.json { render json: @mealplan_meal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def update\n @note = Note.find(params[:id])\n if @note.user == @current_user\n @note.update(note_params)\n render json: @note\n else\n render json: { error: \"No such note for user\" }, status: :unauthorized\n end\n end",
"def update\n @meal_time = MealTime.find(params[:id])\n\n respond_to do |format|\n if @meal_time.update_attributes(params[:meal_time])\n format.html { redirect_to @meal_time, notice: 'Meal time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meal_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @meal.update(meal_params)\n flash[:notice] = \"Workout Plan was successfully updated\"\n redirect_to user_meal_path(current_user, @meal)\n else\n flash[:error] = \"Please update complete the form\"\n redirect_to controller: \"meals\", action: \"new\"\n end\n end",
"def update\n animal = Animal.find(params[:id])\n\n if validate_params(animal_params)\n animal.update(animal_params)\n render json: animal, status: 200, location: [:api, animal]\n else\n render json: { errors: animal.errors }, status: 422\n end\n end",
"def update\n respond_to do |format|\n if @chef.update(chef_params)\n format.html { redirect_to my_meals_path, notice: \"Chef was successfully updated.\" }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n @form_object = Meal::FormObject.find(params[:id])\n @form_object.assign_attributes(form_object_params)\n respond_to do |format|\n if @form_object.save(form_object_params)\n format.html { redirect_to @form_object, notice: 'Meal was successfully updated.' }\n format.json { render :show, status: :ok, location: @form_object }\n else\n format.html { render :edit }\n format.json { render json: @form_object.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # fix: remove duplicate when edit and save\n @shopping.shopping_meals.delete :all\n \n respond_to do |format|\n if @shopping.update(shopping_params)\n \n format.html { redirect_to @shopping, notice: 'Shopping was successfully updated.' }\n format.json { render :show, status: :ok, location: @shopping }\n else\n format.html { render :edit }\n format.json { render json: @shopping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @meal_food.update(meal_food_params)\n format.html { redirect_to @meal_food, notice: 'Meal food was successfully updated.' }\n format.json { render :show, status: :ok, location: @meal_food }\n else\n format.html { render :edit }\n format.json { render json: @meal_food.errors, status: :unprocessable_entity }\n end\n end\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 meals\n get(\"/user/#{@user_id}/meals.json\")\n end",
"def set_user_meal\n @user_meal = UserMeal.find(params[:id])\n end",
"def update\n @meal_preference = MealPreference.find(params[:id])\n\n respond_to do |format|\n if @meal_preference.update_attributes(params[:meal_preference])\n format.html { redirect_to @meal_preference, notice: 'Meal preference was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meal_preference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @metodo = Metodo.find(params[:id])\n\n respond_to do |format|\n if @metodo.update_attributes(params[:metodo])\n format.html { redirect_to metodos_url }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @metodo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @medication = Medication.find_by_id(params[:id])\n @user_id = @medication.user_id\n\n if @medication.nil?\n send_error_json(nil, \"Param 'medication' missing\", 400)\n return\n end\n\n if !check_owner()\n send_error_json(@medication.id, \"Unauthorized\", 403)\n return\n end\n\n fav = true\n if params['medication'].nil? || params['medication']['favourite'].nil? || params['medication']['favourite']=='false'\n fav = false\n end\n update_hash = {:favourite => fav}\n\n if params['medication'] && params['medication']['amount']\n update_hash[:amount] = params['medication']['amount'].to_i\n end\n if params['medication'] && params['medication']['medication_type_id']\n mt = MedicationType.find_by_id(params['medication']['medication_type_id'].to_i)\n if !mt.nil?\n update_hash[:medication_type_id] = mt.id\n else\n send_error_json(nil, \"Invalid medication_type_id\", 400)\n return\n end\n end\n\n if @medication.update_attributes(update_hash)\n send_success_json(@medication.id, {:msg => \"Updated successfully\"})\n else\n send_error_json(@medication.id, \"Update error\", 400)\n end\n\n end",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def update\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n @guest_name = params[:meal][:guest_name]\n params[:meal].delete :guest_name\n @guest = Guest.where(:name => @guest_name).first\n if (@guest.nil?)\n @guest = Guest.new\n @guest.name = @guest_name\n end\n @meal.guest = @guest \n if @meal.update_attributes(params[:meal])\n format.html { redirect_to @meal, :notice => 'Le repas a été mis à jour avec succès.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @meal.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @meal_dish.update(meal_dish_params)\n format.html { redirect_to meal_dishes_url, notice: 'Meal dish was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @meal_dish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end",
"def update\n @thing = current_user.things.find(params[:id])\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to @thing }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\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 if @todo.update(todo_params.merge!(updated_by_id: current_user.id))\n render json: @todo\n else\n render json: {errors: @todo.errors.full_messages}, status: 422\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end",
"def index\n # get meals from the user\n @meals = @user.meals\n # create a new meal for the ajax form to use\n @meal = Meal.new\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meals }\n end\n end",
"def update\n respond_to do |format|\n if @meal_dish.update(meal_dish_params)\n format.html { redirect_to @meal_dish, notice: 'Meal dish was successfully updated.' }\n format.json { render :show, status: :ok, location: @meal_dish }\n else\n format.html { render :edit }\n format.json { render json: @meal_dish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @meat.update(meat_params)\n format.html { redirect_to @meat, notice: 'Meat was successfully updated.' }\n format.json { render :show, status: :ok, location: @meat }\n else\n format.html { render :edit }\n format.json { render json: @meat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @meal = Meal.create(user_id: current_user.id)\n @meal.update(meal_params)\n if @meal.save\n flash[:notice] = \"Meal was successfully created\"\n redirect_to user_meal_path(current_user, @meal)\n else\n flash[:error] = \"Please update complete the form\"\n redirect_to controller: \"meals\", action: \"new\"\n end\n\n end",
"def update\n respond_to do |format|\n if @meal_posting.update(meal_posting_params)\n format.html { redirect_to @meal_posting }#, notice: 'Meal posting was successfully updated.' }\n format.json { render :show, status: :ok, location: @meal_posting }\n else\n format.html { render :edit }\n format.json { render json: @meal_posting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to_update({thing: @author})\n end",
"def update_deal(id, params)\n put(\"deals/#{id}\", deal: params)\n end",
"def update_deal(id:, **args)\n params = parameters(args) do\n optional_params :title, :value, :currency, :user_id, :person_id, :org_id, :stage_id, :status, :probability, :lost_reason, :visible_to\n end\n request(:put, \"deals/#{id}\", params)\n end",
"def update\n recipe.update(recipe_params)\n render json: recipe\n end",
"def update\n head 404\n # @api_v1_follower = Api::V1::Follower.find(params[:id])\n\n # if @api_v1_follower.update(api_v1_follower_params)\n # head :no_content\n # else\n # render json: @api_v1_follower.errors, status: :unprocessable_entity\n # end\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def update\n authorize! :update, @theorem\n if @theorem.update(theorem_params)\n render json: @theorem, status: :ok, location: @theorem\n else\n render json: @theorem.errors, status: :unprocessable_entity\n end\n end",
"def update\n @msalary = Msalary.find(params[:id])\n\n respond_to do |format|\n if @msalary.update_attributes(params[:msalary])\n format.html { redirect_to @msalary, notice: 'Msalary was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @msalary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def update\n recipe = Recipe.find(params[:id])\n\n if recipe.user == current_user\n recipe.update(recipe_params)\n render json: { recipe: params[:id], deleted: true }\n else\n render json: { recipe: params[:id], deleted: false }\n end\n end",
"def update\n @user_follow_user = UserFollowUser.find(params[:id])\n\n respond_to do |format|\n if @user_follow_user.update_attributes(params[:user_follow_user])\n format.html { redirect_to @user_follow_user, notice: 'User follow user was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_follow_user.errors, status: :unprocessable_entity }\n end\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 animal = Animal.find(params[:id])\n animal.update(animal_params)\n if animal.valid?\n render json: animal\n else\n render json: animal.errors\n end\n end",
"def set_meal\n @meal = Meal.find_by(id: params[:id])\n end",
"def update\n @journal = @journals.find(params[:id])\n\n respond_to do |format|\n if @journal.update_attributes(params[:journal])\n format.html { redirect_to @journal, notice: 'Journal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @journal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n note = Note.find(params[\"id\"])\n note.update_attributes(note_params)\n respond_with note, json: note\n end",
"def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end",
"def enable\n meal = current_user.restaurant.meals.find(params[:id])\n meal.update(available: true)\n render json: {is_success: true}\n end",
"def update\n user = find_user\n user.update!(user_params)\n render json: user\n end",
"def update\n params[:book_shelf]['user'] = User.where(:id => params[:book_shelf]['user']).first\n params[:book_shelf]['book'] = Book.where(:id => params[:book_shelf]['book']).first\n @book_shelf = BookShelf.find(params[:id])\n respond_to do |format|\n if @book_shelf.update_attributes(params[:book_shelf])\n format.html { redirect_to @book_shelf, notice: 'Book shelf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_shelf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_meal\n @meal = Meal.available.exclusive(current_user).find(params[:id])\n end",
"def update\n @stalking = Stalking.find(params[:id])\n @stalking.user_id = current_user.id\n\n respond_to do |format|\n if @stalking.update_attributes(app_params)\n format.html { redirect_to @stalking, flash: { success: 'Stalking was successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stalking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @interesting = Interesting.find(params[:id])\n\n respond_to do |format|\n if @interesting.update_attributes(params[:interesting])\n format.html { redirect_to @interesting, notice: 'Interesting was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interesting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @journal = Journal.find(params[:id])\n @journal.update_attributes(params[:journal])\n respond_with(@user,@journal)\n end",
"def update\n #@user = User.find(params[:id])\n \n if @trainer.update(trainer_params)\n render json: @trainer\n else\n render json: @trainer.errors, status: :unprocessable_entity\n end\nend",
"def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end",
"def update\n respond_to do |format|\n if @medal.update(medal_params)\n format.html { redirect_to @medal, notice: 'Medal was successfully updated.' }\n format.json { render :show, status: :ok, location: @medal }\n else\n format.html { render :edit }\n format.json { render json: @medal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n\n if @goal.user != current_user\n format.html { redirect_to goals_url, alert: \"You can't update someone else's goal!.\" }\n format.json { render json: {errors: [\"You can't update someone else's goal!.\"]}, status: :forbidden }\n elsif @goal.update_attributes(params[:goal])\n format.html { redirect_to goals_url, notice: 'Goal was successfully updated.' }\n format.json { head :no_content }\n else\n @goals = goals_for_current_user\n format.html { render action: \"index\" }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @appeal.update_attributes(params[:appeal])\n format.html { redirect_to [@conference, @appeal], notice: 'Appeal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @appeal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @meal_plan = @meal.day.meal_plan\n\n respond_to do |format|\n if @meal.update(meal_params)\n format.html { redirect_to meal_path(@meal), notice: \"Meal was successfully updated.\" }\n format.json { render :show, status: :ok, location: @meal }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @meal.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[:meetup])\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 meal_params\n params.require(:meal).permit(:date, :meal, :ingredients, :nutrition, :notes, :target, :user_id)\n end",
"def update\n respond_to do |format|\n if @malice.update(malice_params)\n format.html { redirect_to @malice, notice: 'Malice was successfully updated.' }\n format.json { render :show, status: :ok, location: @malice }\n else\n format.html { render :edit }\n format.json { render json: @malice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_meal\n @meal = Meal.find(params[:id])\n end",
"def update\n @rental = Rental.find(params[:id])\n rental_data = params[:rental]\n photo_ids = rental_data.delete :photo_ids\n\n respond_to do |format|\n if @rental.update_attributes(rental_data)\n update_photos_with_rental_id photo_ids, @rental\n\n format.html { redirect_to @rental, notice: 'Rental was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rental.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo.update(todo_params)\n respond_with(@user, @todo)\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 respond_to do |format|\n if @mealplan.update(mealplan_params)\n format.html { redirect_to @mealplan, notice: 'Mealplan was successfully updated.' }\n format.json { render :show, status: :ok, location: @mealplan }\n else\n format.html { render :edit }\n format.json { render json: @mealplan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @user.update_attributes(user_params)\n render json: @user\n else\n log_modal_errors @user\n render json: @user.errors.full_messages, status: :bad_request\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n if @todo.update(todo_params)\n render json: @todo\n else\n render json: @todo.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @meal_plan.update(meal_plan_params)\n format.html { redirect_to @meal_plan, notice: 'Meal plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @meal_plan }\n else\n format.html { render :edit }\n format.json { render json: @meal_plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @usertable = Usertable.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @usertable.update_attributes(params[:usertable])\r\n format.html { redirect_to @usertable, notice: 'Your mood was successfully updated.' }\r\n format.json { head :ok }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @usertable.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end"
] | [
"0.7078675",
"0.6835769",
"0.6633407",
"0.651452",
"0.6496397",
"0.6488832",
"0.6474574",
"0.6441713",
"0.6420901",
"0.6410958",
"0.6403344",
"0.6372808",
"0.6361657",
"0.6334368",
"0.6314967",
"0.6277786",
"0.6230381",
"0.62067914",
"0.61754304",
"0.6168994",
"0.61677194",
"0.6131687",
"0.61287177",
"0.6101132",
"0.607448",
"0.6059603",
"0.6059379",
"0.6054347",
"0.6039509",
"0.60374707",
"0.6033759",
"0.5991849",
"0.59880245",
"0.5982703",
"0.59815043",
"0.5977116",
"0.5976901",
"0.5973061",
"0.5968569",
"0.5937696",
"0.5932077",
"0.5932058",
"0.5924287",
"0.5924243",
"0.59199977",
"0.59040153",
"0.58982205",
"0.5892689",
"0.58892447",
"0.5881989",
"0.58702785",
"0.5869034",
"0.5868227",
"0.58679295",
"0.5861262",
"0.5861262",
"0.5861262",
"0.5861262",
"0.5861262",
"0.5861262",
"0.5861262",
"0.5861262",
"0.5861197",
"0.5861197",
"0.58583313",
"0.5854616",
"0.58482313",
"0.5846527",
"0.5843391",
"0.5830296",
"0.5830097",
"0.5828911",
"0.58111167",
"0.58092934",
"0.58078617",
"0.58019423",
"0.58006537",
"0.57963943",
"0.5785724",
"0.5784785",
"0.57842165",
"0.57813936",
"0.577743",
"0.57713896",
"0.576601",
"0.57648146",
"0.5764379",
"0.5764061",
"0.57605004",
"0.5758128",
"0.57573146",
"0.57570136",
"0.5751233",
"0.5749646",
"0.57487905",
"0.5747247",
"0.5745777",
"0.5744003",
"0.5740775",
"0.57403016"
] | 0.7134466 | 0 |
DELETE /user_meals/1 DELETE /user_meals/1.json | def destroy
@user_meal.destroy
respond_to do |format|
format.html { redirect_to user_meals_url, notice: 'User meal was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @meal = Meal.find(params[:id])\n @meal.destroy\n\n respond_to do |format|\n format.html { redirect_to meals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meal.destroy\n\n respond_to do |format|\n format.html { redirect_to meals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n meal = Meal.find(params[:id])\n meal.destroy\n respond_to do |format|\n format.html { redirect_to meals_url, notice: 'Meal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meal.destroy\n respond_to do |format|\n format.html { redirect_to meals_url, notice: 'Meal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @indication_for_meal.destroy\n respond_to do |format|\n format.html { redirect_to indication_for_meals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group_meal = GroupMeal.find(params[:id])\n @group_meal.destroy\n\n respond_to do |format|\n format.html { redirect_to group_meals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meal = Meal.find(params[:id])\n @meal.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_subject_meals_url(@test_subject)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @meal = Meal.find(params[:id])\n @meal.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_subject_meals_url(@test_subject)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @meal_dish.destroy\n respond_to do |format|\n format.html { redirect_to meal_dishes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cooked_meal.destroy\n respond_to do |format|\n format.html { redirect_to cooked_meals_url, notice: 'Cooked meal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mealplan_meal.destroy\n respond_to do |format|\n format.html { redirect_to mealplan_meals_url, notice: 'Mealplan meal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meal_record.destroy\n respond_to do |format|\n format.html { redirect_to meal_records_url, notice: 'Meal record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meal = Meal.find(params[:id])\n @meal.destroy\n\n respond_to do |format|\n format.js\n format.html { redirect_to list_path(@list) }\n format.json { head :ok }\n end\n end",
"def destroy\n @meal_profile = MealProfile.find(params[:id])\n @meal_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to meal_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meal_time = MealTime.find(params[:id])\n @meal_time.destroy\n\n respond_to do |format|\n format.html { redirect_to meal_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meals_recipe = MealsRecipe.find(params[:id])\n @meals_recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to(meals_recipes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n\t\t@meal = Meal.find(params[:meal_id])\n\t\t@users_meal = UsersMeal.find(params[:id])\n\t\t@users_meal.destroy\n\t\tredirect_to meals_path\n\tend",
"def destroy\n @api_v1_follower = Api::V1::Follower.where('follower_id =? and user_id =?', @current_user.id, params[:id]).first\n if @api_v1_follower.destroy\n head :no_content\n else \n render json: { error: 'not allowed' }, status: 401\n end\n end",
"def destroy\n @meal_dish.destroy\n respond_to do |format|\n format.html { redirect_to meal_dishes_url, notice: 'Meal dish was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meal_meeting = MealMeeting.find(params[:id])\n @meal_meeting.destroy\n\n respond_to do |format|\n format.html { redirect_to meal_meetings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meal_posting.destroy\n redirect_to user_path(current_user.id)\n # respond_to do |format|\n # format.html { redirect_to meal_postings_url } #, notice: 'Meal posting was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end",
"def destroy\n @meal = Meal.find(params[:id])\n recipeid = @meal.recipe_id\n @meal.destroy\n respond_to do |format|\n format.html { redirect_to(recipe_url(recipeid), :layout => false) }\n format.xml { head :ok }\n end\n end",
"def delete_deals(**args)\n params = parameters(args) do\n required_params :ids\n optional_params :ids\n end\n request(:delete, 'deals', params)\n end",
"def destroy\n @goal = @user.goals.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to user_goals_url(@user) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n render json: @goal\n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def destroy\n\n @meal = @meal_recipe.meal\n \n @meal_ingredient = MealIngredient.new\n @meal_plan = @meal_recipe.meal.day.meal_plan\n @meal_recipe.destroy\n\n\n respond_to do |format|\n format.turbo_stream\n format.html { redirect_to meal_plan_path(@meal_plan), notice: \"Meal recipe was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete_deal(id)\n delete(\"deals/#{id}\")\n end",
"def destroy\n @meal_food.destroy\n respond_to do |format|\n format.html { redirect_to meal_foods_url, notice: 'Meal food was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meal_plan = @meal.day.meal_plan\n @meal.destroy\n respond_to do |format|\n format.turbo_stream { render turbo_stream: turbo_stream.remove(\"meal#{@meal.id}\") }\n format.html { redirect_to meal_plan_path(@meal_plan), notice: \"Meal was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete_follows\n \t@follower = User.find(params[:id])\n \t@followed = User.find(params[:follows_id])\n \t\n \tif @follower.follows.delete(@followed)\n \t\t\n \telse\n \t\trender json @follower.errors\n \tend\n end",
"def destroy\n head 404\n # @api_v1_following = Api::V1::Follower.where('following_id =? and user_id =?', @current_user.id, params[:id]).first\n # if @api_v1_following.destroy\n # head :no_content\n # else \n # render json: { error: 'not allowed' }, status: 401\n # end\n end",
"def destroy\n @medal.destroy\n respond_to do |format|\n format.html { redirect_to medals_url, notice: 'Medal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @meal_rating.destroy\n respond_to do |format|\n format.html { redirect_to meal_ratings_url }#, notice: 'Meal rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @muscle_diary.destroy\n respond_to do |format|\n format.html { redirect_to muscle_diaries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @journal = @journals.find(params[:id])\n @journal.destroy\n\n respond_to do |format|\n format.html { redirect_to journals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @goal_reward = GoalReward.find(params[:id])\n @goal_reward.destroy\n\n respond_to do |format|\n format.html { redirect_to goal_rewards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @msalary = Msalary.find(params[:id])\n @msalary.destroy\n\n respond_to do |format|\n format.html { redirect_to msalaries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = Meetup.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to meetups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mamal.destroy\n respond_to do |format|\n format.html { redirect_to mamals_url, notice: 'Mamal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to goals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to goals_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to goals_url }\n format.json { head :ok }\n end\n end",
"def delete_follows\n\n\t@follower = User.find(params[:id])\n\t@followed = User.find(params[:follows_id])\n\n\[email protected](@followed)\n\t\thead :no_content\n\t\t\n\tend",
"def del_follow\n current_user.del_follow(@user)\n\n respond_to do |format|\n format.html { redirect_to wall_user_path(@user) }\n format.json { render :json => { user: @user.as_json(:json => 'wall') }}\n end\n end",
"def destroy\n @redeemed_deal = RedeemedDeal.find(params[:id])\n @redeemed_deal.destroy\n\n respond_to do |format|\n format.html { redirect_to redeemed_deals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rental = Rental.find(params[:id])\n @rental.destroy\n\n respond_to do |format|\n format.html { redirect_to rentals_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @mealplan.destroy\n respond_to do |format|\n format.html { redirect_to mealplans_url, notice: 'Mealplan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_follow_user = UserFollowUser.find(params[:id])\n @user_follow_user.destroy\n\n respond_to do |format|\n format.html { redirect_to user_follow_users_url }\n format.json { head :ok }\n end\n end",
"def delete\n render json: Like.delete(params[\"id\"])\n end",
"def destroy\n @ally.destroy\n respond_to do |format|\n format.html { redirect_to allies_url, notice: 'Ally was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ally.destroy\n respond_to do |format|\n format.html { redirect_to allies_url, notice: 'Ally was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dental = Dental.find(params[:id])\n @dental.destroy\n\n respond_to do |format|\n format.html { redirect_to dentals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @loanable.destroy\n respond_to do |format|\n format.html { redirect_to users_loanables_url, notice: 'Loanable was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mealplan = Mealplan.find(params[:id])\n @mealplan.destroy\n respond_to do |format|\n format.html { redirect_to mealplans_url, notice: 'Mealplan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_adicional.destroy\n respond_to do |format|\n format.html { redirect_to item_adicionals_url, notice: 'Item adicional was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:user_id])\n @follower = @user.follower.find(params[:id])\n @follower.destroy\n head :no_content\n end",
"def destroy\n @referral = Referral.find(params[:id])\n @referral.destroy\n\n respond_to do |format|\n format.html { redirect_to referrals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @medal = Medal.find(params[:id])\n @medal.destroy\n\n respond_to do |format|\n format.html { redirect_to(medals_url) }\n format.xml { head :ok }\n end\n end",
"def delete_deal(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:delete, \"deals/#{id}\", params)\n end",
"def destroy\n @personal.destroy\n respond_to do |format|\n format.html { redirect_to personals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @deal = Deal.find(params[:id])\n @deal.destroy\n respond_to do |format|\n format.html { redirect_to deals_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @metodo = Metodo.find(params[:id])\n @metodo.destroy\n\n respond_to do |format|\n format.html { redirect_to metodos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mealtime.destroy\n respond_to do |format|\n format.html { redirect_to mealtimes_url, notice: 'Mealtime was successfully destroyed.' }\n end\n end",
"def destroy\n @loan.destroy\n respond_to do |format|\n format.html { redirect_to loans_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @goody = Goody.find(params[:id])\n @goody.destroy\n\n respond_to do |format|\n format.html { redirect_to goodies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @journal.destroy\n respond_to do |format|\n format.html { redirect_to journals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meal_plan.destroy\n respond_to do |format|\n format.html { redirect_to meal_plans_url, notice: 'Meal plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manage_heal.destroy\n respond_to do |format|\n format.html { redirect_to manage_heals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @moment_item.destroy\n respond_to do |format|\n format.html { redirect_to moment_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ef_mental = EfMental.find(params[:id])\n @ef_mental.destroy\n\n respond_to do |format|\n format.html { redirect_to ef_mentals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @account_medal.destroy\n respond_to do |format|\n format.html { redirect_to account_medals_url, notice: 'Account medal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sumit.destroy\n respond_to do |format|\n format.html { redirect_to sumits_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @follow = Follow.find(params[:id])\n @follow.destroy\n\n respond_to do |format|\n format.html { redirect_to follows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @makrana_marble.destroy\n respond_to do |format|\n format.html { redirect_to makrana_marbles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @historial = Historial.find(params[:id])\n @historial.destroy\n\n respond_to do |format|\n format.html { redirect_to historials_url }\n format.json { head :ok }\n end\n end",
"def destroy\n user = @item.user\n @item.destroy\n respond_to do |format|\n format.html { redirect_to user_path(user) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @malarium.destroy\n respond_to do |format|\n format.html { redirect_to malaria_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nail_salon = NailSalon.find(params[:id])\n @nail_salon.destroy\n\n respond_to do |format|\n format.html { redirect_to nail_salons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @daily_food_record = DailyFoodRecord.find(params[:id])\n @daily_food_record.destroy\n @user = User.find(params[:user_id])\n respond_to do |format|\n format.html { redirect_to user_daily_food_records_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kishangarh_marble.destroy\n respond_to do |format|\n format.html { redirect_to kishangarh_marbles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @followup = Followup.find(params[:id])\n @followup.destroy\n\n respond_to do |format|\n format.html { redirect_to followups_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @referralmedical.destroy\n respond_to do |format|\n format.html { redirect_to referralmedicals_url, notice: 'Referralmedical was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_food.destroy\n respond_to do |format|\n format.html { redirect_to user_foods_url, notice: 'User food was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n Goal.find(params[:id]).destroy\n flash[:success] = \"Goal Removed\"\n redirect_to :action => \"index\", :id => current_user.id\n end",
"def destroy\n @tally.destroy\n respond_to do |format|\n format.html { redirect_to tallies_url, notice: 'Tally was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @deal = Deal.find(params[:id])\n @deal.destroy\n\n respond_to do |format|\n format.html { redirect_to deals_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @medicos_autorizado = current_user.medicos_autorizados.find(params[:id])\n @medicos_autorizado.destroy\n\n respond_to do |format|\n format.html { redirect_to current_user }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @item = @user.items.find(params[:id])\n @item.destroy\n\n\n respond_to do |format|\n format.html { redirect_to user_items_path(@user) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @moresmalltrial = Moresmalltrial.find(params[:id])\n @moresmalltrial.destroy\n\n respond_to do |format|\n format.html { redirect_to moresmalltrials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @goal.destroy\n respond_to do |format|\n format.html { redirect_to user_goals_path(current_user.id), notice: 'Goal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @goal.destroy\n respond_to do |format|\n format.html { redirect_to user_goals_path(current_user), notice: 'Goal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @monkey = Monkey.find(params[:id])\n @monkey.destroy\n\n respond_to do |format|\n format.html { redirect_to monkeys_url }\n format.json { head :no_content }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @user_mood.destroy\n respond_to do |format|\n format.html { redirect_to user_moods_url, notice: 'User mood was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\tRestaurant.find(params[:id]).destroy\n flash[:success] = \"Restaurant and related meals removed.\"\n redirect_to moderator_path\n\tend"
] | [
"0.74902195",
"0.7411985",
"0.73815763",
"0.7140591",
"0.71310884",
"0.71082133",
"0.6961988",
"0.6961988",
"0.6943542",
"0.6933399",
"0.688878",
"0.686623",
"0.685317",
"0.682992",
"0.6822535",
"0.6813917",
"0.67400426",
"0.6691638",
"0.66637266",
"0.6652966",
"0.6616819",
"0.6609642",
"0.66073996",
"0.6585074",
"0.6579219",
"0.65520024",
"0.65455097",
"0.65436876",
"0.6526552",
"0.652314",
"0.6518183",
"0.65180755",
"0.6512359",
"0.65122265",
"0.6500927",
"0.64826125",
"0.64787257",
"0.6475904",
"0.64713806",
"0.64544564",
"0.6447852",
"0.64410347",
"0.64410347",
"0.643816",
"0.6435343",
"0.64257556",
"0.64229906",
"0.6420461",
"0.6414979",
"0.6414891",
"0.6407129",
"0.63999707",
"0.63980126",
"0.63978595",
"0.63978595",
"0.63961756",
"0.63805157",
"0.6379652",
"0.63792765",
"0.6376023",
"0.63752246",
"0.6367826",
"0.636218",
"0.6356676",
"0.63468087",
"0.6337458",
"0.6336292",
"0.6335514",
"0.6314558",
"0.6314185",
"0.63122433",
"0.6308257",
"0.6306781",
"0.62980396",
"0.6297522",
"0.6296312",
"0.62957513",
"0.6294144",
"0.6293758",
"0.6293629",
"0.6291076",
"0.62909377",
"0.62894624",
"0.62875456",
"0.62873805",
"0.62873554",
"0.62858266",
"0.62790614",
"0.6277013",
"0.62713015",
"0.62656236",
"0.6265433",
"0.6264904",
"0.6262889",
"0.62587947",
"0.6258408",
"0.6256342",
"0.6253976",
"0.6251446",
"0.6247158"
] | 0.7609273 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_user_meal
@user_meal = UserMeal.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_meal_params
params.fetch(:user_meal, {})
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 valid_params_request?; end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\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 ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\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 backend_user_params\n params.permit!\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def 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.6981273",
"0.6783789",
"0.67460483",
"0.6742222",
"0.67354137",
"0.65934366",
"0.65028495",
"0.6497783",
"0.64826745",
"0.6479415",
"0.6456823",
"0.6440081",
"0.63800216",
"0.6376521",
"0.636652",
"0.6319898",
"0.6300256",
"0.62994003",
"0.6293621",
"0.6292629",
"0.6291586",
"0.629103",
"0.6282451",
"0.6243152",
"0.62413",
"0.6219024",
"0.6213724",
"0.62103724",
"0.61945",
"0.61786324",
"0.61755824",
"0.6173267",
"0.6163613",
"0.6153058",
"0.61521065",
"0.6147508",
"0.61234015",
"0.61168665",
"0.6107466",
"0.6106177",
"0.6091159",
"0.60817343",
"0.6071238",
"0.6062299",
"0.6021663",
"0.60182893",
"0.6014239",
"0.6011563",
"0.60080767",
"0.60080767",
"0.60028875",
"0.60005623",
"0.59964156",
"0.5993086",
"0.5992319",
"0.5992299",
"0.59801805",
"0.59676576",
"0.59606016",
"0.595966",
"0.59591126",
"0.59589803",
"0.5954058",
"0.5953234",
"0.5944434",
"0.5940526",
"0.59376484",
"0.59376484",
"0.5935253",
"0.5930846",
"0.5926387",
"0.59256274",
"0.5917907",
"0.5910841",
"0.590886",
"0.59086543",
"0.59060425",
"0.58981544",
"0.5898102",
"0.5896809",
"0.5895416",
"0.58947027",
"0.58923644",
"0.5887903",
"0.58830196",
"0.5880581",
"0.5873854",
"0.58697754",
"0.5869004",
"0.58669055",
"0.5866886",
"0.58664906",
"0.5864619",
"0.58630043",
"0.5862495",
"0.5861368",
"0.5859712",
"0.5855544",
"0.58551925",
"0.5851284",
"0.5850602"
] | 0.0 | -1 |
p range_iterative(3,7) exponentation recursion 1 | def exp1(num, exponent)
return 1 if exponent == 0
# return ( 1 / exp1(num, exponent - 1) )
num * exp1(num, exponent - 1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_range(range)\n multi = multiple_of_3_and_5(range - 1)\n sum = addition(multi)\n\n puts sum\nend",
"def iterative_factorial(number)\n\nend",
"def iterative_factorial(number)\n\nend",
"def recursive_exponent_1(base, exponent)\n puts \"#{__method__} called\"\n return 1 if exponent.zero?\n base * recursive_exponent_1(base, exponent - 1)\nend",
"def power_range\n body_range + 1\n end",
"def rec_exp_1(base, power)\nend",
"def power(n, exp)\n total = 1\n 1.upto(exp) do |num|\n total = multiply(n, total)\n end\n total\nend",
"def factorial(n)\n (1..n).each do |x|\n#iterates through each number in the range above and uses inject to find the factorials of each number.\n y = x.downto(1).inject(:*)\n puts y\n end\nend",
"def exponent1(base, num)\n return 1 if num == 0\n return base if num == 1\n x = base * exponent1(base, num-1)\n\nend",
"def sum_range(num)\n if num == 1\n 1\n else\n num + sum_range(num - 1)\n end\nend",
"def perfect_power(n)\n\nend",
"def exponent1(base, power)\n # if power equals zero , then 1 else (base * method(base,power - 1))\n if power == 0\n return 1\n else\n (base * exponent1(base, power - 1))\n end\nend",
"def iterative_factorial(n)\n (1..n).inject(:*)\nend",
"def factorial\n (1..self).inject(:*)\n end",
"def power(num, exponent)\n result = num\n (2..exponent).each { result = multiply(result, num) }\n result\nend",
"def approx_primes_in_range( n )\n\n end",
"def exponent_v1(b, n)\n puts s += 1\n if n == 0\n return 1\n end\n b * exponent_v1(b, n-1)\nend",
"def SimpleAdding(num)\n\n # code goes here\n range_sum = *(1..num)\n return range_sum.inject(:+)\n \nend",
"def rec_exp_2(base, power)\nend",
"def solution\n (1..40).inject(:*) / (1..20).inject(:*)**2\nend",
"def f(num)\n (1.upto(num).inject { |m,n| m + n**2 } - 1.upto(num).sum ** 2).abs\nend",
"def pow(base, exponent) #(3, 4) ==> 3 * 3 * 3 * 3 = \n return 1 if exponent == 0 \n #return base if exponent == 1\n base * pow(base, exponent - 1)\nend",
"def solution(range)\n ary = range.select(&:prime?).map do |n|\n n**Math.log(range.max, n).floor\n end.reduce(:*)\nend",
"def rpower(n) end",
"def pow(base_num, pow_num)\n result = 1\n pow_num.times do |index|#loop trough the code ex: if pow_num is = 3, the loop will trough 3 times.\n result = result * base_num\n end\n return result\nend",
"def SimpleAdding(num)\n\n # code goes here\n range_num = *(1..num)\n return range_num.inject(:+)\n \nend",
"def factorial_iterative(n)\n\tres = 1\n\tn.downto(1) {|x|\n\t if x == 0 || x == 1\n\t \treturn res\n\t else\n\t \tres *= x\n\t end\n\t}\n\treturn res\nend",
"def exponentiation1(b,n)\n return 1 if n == 0 \n b * exponentiation1(b, n - 1)\nend",
"def exponent(b, n)\n\nend",
"def exponent(b, n)\n\nend",
"def exponent(b, n)\n\nend",
"def expo_1(number, power)\n return 1 if power == 0\n return number if power == 1 \n\n number * expo(number, power - 1)\nend",
"def iterative_fact(itrtnum)\n itrtnum.downto(1) do\n total *= factorial(itrtnum)\n end\n return total\nend",
"def factorial\n\t\t(1..self).reduce(:*)\n\tend",
"def exp1(base, n)\n return 1 if n == 0 \n\n base * exp1(base, n-1)\nend",
"def expotential(num, power)\n result = 1\n loop do\n result = multiply(result, num)\n power -= 1\n break if power == 0\n end\n result\nend",
"def exponentiation_1(b, n)\n return 1 if n == 0\n return b if n == 1\n b * exponentiation_1(b, n - 1)\nend",
"def exponentiation_1(b, n)\n return 1 if n == 0\n return b if n == 1\n b*exponentiation_1(b, n-1)\nend",
"def exponentiation(base, power)\n return 1 if power == 0\n base * exponentiation(base, power - 1)\nend",
"def pow (base_num , pow_num)\n results=1\n pow_num.times do \n results*=base_num\n end \n results\nend",
"def exp_v_1(num, pow)\n return 1 if pow === 0\n return num * exp_v_1(num, pow - 1)\nend",
"def exp1(base, power)\n puts \"exp1\"\n return 1 if power == 0\n base * exp1(base, power - 1)\nend",
"def sum_range(i, j)\n \n end",
"def factorial_iterative(n)\n #Creacion de la variable inicial\n f = 1\n #hacer un para recorrer los numeros desde el 1 hasta el numero dado\n for i in 1..n\n #Cada vez que entre cambiara el valor y lo multiplicara por el siguiente\n f *= i\n end\n #regresar el valor de f\n f\nend",
"def recursive_factorial(number)\n\nend",
"def recursive_factorial(number)\n\nend",
"def iterative_factorial(num)\n return Float::NAN if !num.is_a?(Integer) || num < 0\n fact = 1\n (1..num).each {|i| fact *= i}\n fact\nend",
"def range(input); end",
"def square_of_the_sum\n (1..self).inject(&:+)**2\n end",
"def exp(base, power)\n return 1 if power == 0\n return base if power == 1\n base * exp(base, (power-1))\nend",
"def recursive_range(start_num, end_num)\n return [] if start_num >= end_num\n recursive_range(start_num, end_num-1) << end_num - 1\nend",
"def exp(n, i)\n n ** i\nend",
"def exponent_v1(base, power)\n return 1 if power <= 0\n base * exponent_v1(base, power-1)\nend",
"def sum_to(n)\n return nil if n <= 0 #negatives and 0\n return 1 if n == 1 #base step\n #inclusive step 1 + sum_to(n)\n n + sum_to(n - 1)\nend",
"def factorial(x)\n\tres = 1\n\t# use a block that multiply the variable res by each value of the range\n\t(1..x).each { |i| res *= i }\n\treturn res\nend",
"def iterative_factorial(number)\n total = 1\n\n (1..number).each do |n|\n total *= n\n end\n\n total\nend",
"def self_powers_2\n (1..1000).map {|i| i**i}.reduce(:+) % (10**10)\nend",
"def factorial(num)\n product = 1\n for factor in 1..num\n product *= factor\n end\n product\nend",
"def power(base, exponent)\n return (0...exponent).inject(1) { |memo| memo * base } if exponent >= 0\n (exponent...0).inject(1.0) { |memo| memo * 1/base }\nend",
"def range_number(n,t)\n\t\t(n).step(t){|n|n+2}\n\tend",
"def exp(b,n) #First method\n return 1 if n == 0\n if n > 0\n b * exp(b,n - 1)\n else\n (1.0/b) * exp(b,n + 1) \n end\nend",
"def power_of_n(n, power)\n result = 1\n power.times {result = multiply(n, result)} # similar to recursion\n result\nend",
"def exp_1(b, n)\n return 1 if n == 0\n b * exp_1(b, n - 1)\nend",
"def exp_1(b, num)\n return 1 if num == 0\n b * exp_1(b, num - 1)\nend",
"def exp1(base, power)\n return 1 if power <= 0\n exp1(base, power - 1) * base\nend",
"def exp1(base, num)\n return 1 if num == 0\n return base if num == 1\n expo = base * exp1(base, num-1)\nend",
"def power(num, n)\n return num if n == 1\n multiply(num, power(num, n - 1))\nend",
"def f_iter(x)\n cur_prob = 1.0\n for i in 2..$x do\n cur_prob += ($n - cur_prob)/$n\n end\n return cur_prob\nend",
"def recursive_solution\n\n end",
"def factorial(num)\n(1..num).reduce(:*)\nend",
"def factorial_recursive(num)\n if num == 0\n 1\n else \n num * factorial_recursive(num-1)\n \n # 7 * 6 = 42\n # 42 * 5 = 210\n # 210 * 4 = 840\n # 840 * 3 = 2520\n # 2520 *2 = 5040\n # 5040* 1 = 5040\n end\nend",
"def power(bas,exponent)\n i = 1\n resultat = bas\n while i < exponent\n resultat *= bas\n i += 1\n end\n return resultat\nend",
"def pow(a,b)\n power=1\n for i in 1..b\n power=power*a\n end\n return power\nend",
"def power(curr_value, to_power)\n curr_value**to_power\nend",
"def summation(num)\n (1..num).reduce(:+)\nend",
"def square_sum_up_to n=100\r\n (n * (n + 1) / 2)**2\r\nend",
"def p6\n\trange = (1..100).to_a\n\tsquare_of_sum = range.reduce(:+) ** 2\n\tsum_of_square = (range.map{|x| x ** 2}).reduce(:+)\n\tsquare_of_sum - sum_of_square\nend",
"def factorial(value)\n aux = 1\n (1..value).each do |i|\n aux *= i\n end\n\n aux\nend",
"def factorial(int)\n (1..self).reduce(:*) || 1\nend",
"def power(base,exponent)\n i = 0\n output = 1\n while i < exponent\n output = output * base\n i += 1\n end\n return output\nend",
"def gamma_fnc(n)\n return nil if n == 0\n return 1 if n == 1\n gamma_fnc(n - 1) * (n - 1)\n\n\n # n = (n - 1)!\n # n = 4\n # 3! = 3 * 2 * 1\n # 3 => 2 3-1 = 2\n # 2 => 1 2-1 = 1\n\nend",
"def factorial(n)\n base = 1\n n.downto(1) { |val| base *= val }\n return base\nend",
"def factorial(n)\n (1..n).inject(:*)\nend",
"def triangular_number_logic(range)\n sum = 0\n\n (1..range).each { |num| sum += num }\n sum\n end",
"def solve\n return ((1..40).inject(:*) / ((1..20).inject(:*) ** 2))\nend",
"def factorial(n)\n (1..n).inject(:*)\nend",
"def pow(base_num, pow_num)\n result = 1\n pow_num.times do\n result = result * base_num\n end\n return result\nend",
"def exp(b,n)\n return 1 if n == 0\n b * exp(b,n-1)\nend",
"def pow(base_num, pow_num)\n result = 1\n pow_num.times do |index|\n result = result * base_num\n end\n\n return result\nend",
"def problem3 n\n 2.step(n,1).each do |x|\n return x-1 if n == 1\n n /= x if x.prime? && (n % x == 0)\n end\nend",
"def stepPerms(n)\n return 0 if n < 0\n return 1 if n == 0\n \n stepPerms(n - 1) + stepPerms(n - 2) + stepPerms(n - 3)\nend",
"def my_pow(x, n)\n return x if n == 1\n return x * x if n == 2\n return x / x if n == -2\n\n if n > 0\n x * my_pow(x, n - 1)\n else\n my_pow(x, n + 1)\n end\nend",
"def gamma_fnc(num)\n return nil if num < 1\n return 1 if num == 1\n (num - 1) * gamma_fnc(num - 1)\nend",
"def range1(min, max)\n # Base Case / Inductive Step\n return [] if max <= min\n\n range1(min, max - 1) << max - 1\nend",
"def sum_recursive(num)\n # can also compute sum with symbol (1..5).inject(:+)\n (1..num).inject { |sum, n| sum + n }\nend",
"def power(base,exponent)\n i=1\n output = base\n while i<exponent\n output = output*base\n i += 1\n end\n return output\nend",
"def square_of_sums\n range.reduce(:+)**2\n end",
"def factorial(number)\n number.downto(1).reduce(:*)\nend",
"def exponentiation(b, n)\n return 1 if n == 0\n\n return exponentiation(b, n - 1) * b\nend",
"def power(x,n)\n n == 0 ? (return 1) : x*power(x,n-1)\n\nend",
"def power(base, exponent)\n total = 1\n\n exponent.times do\n total *= base\n end\n\n return total\nend"
] | [
"0.6643921",
"0.64932615",
"0.64932615",
"0.63352156",
"0.6321269",
"0.6271953",
"0.626175",
"0.6233397",
"0.6225768",
"0.619121",
"0.6178885",
"0.6140745",
"0.6131115",
"0.61230725",
"0.6123036",
"0.6119506",
"0.6099486",
"0.6099279",
"0.6083398",
"0.60801095",
"0.607892",
"0.60737574",
"0.6072504",
"0.6068901",
"0.6066443",
"0.60657626",
"0.6044617",
"0.6038148",
"0.60282105",
"0.60282105",
"0.60282105",
"0.6024615",
"0.6018419",
"0.6014814",
"0.5998758",
"0.5992708",
"0.59850377",
"0.59769964",
"0.5968366",
"0.5953744",
"0.59519696",
"0.59518117",
"0.59241605",
"0.5923863",
"0.59230524",
"0.59230524",
"0.591674",
"0.59116375",
"0.5905527",
"0.58908635",
"0.5890518",
"0.5883983",
"0.58826405",
"0.58703744",
"0.5861324",
"0.58508974",
"0.58506453",
"0.5843928",
"0.5833634",
"0.58304936",
"0.58267105",
"0.58198017",
"0.5819111",
"0.58162946",
"0.5814564",
"0.5812369",
"0.5811601",
"0.58078146",
"0.5805292",
"0.5797488",
"0.57946616",
"0.57883185",
"0.5784337",
"0.57830936",
"0.5780018",
"0.57798815",
"0.5777602",
"0.5776579",
"0.5767698",
"0.5760919",
"0.57605463",
"0.5760358",
"0.5754312",
"0.57519597",
"0.5749722",
"0.5748355",
"0.5747131",
"0.57459843",
"0.57429355",
"0.5740315",
"0.57314444",
"0.5728973",
"0.57279533",
"0.57276285",
"0.57256776",
"0.5718381",
"0.5717016",
"0.57157034",
"0.5713422",
"0.5712485",
"0.571027"
] | 0.0 | -1 |
p exp1(2, 0) p exp1(2, 3) exponentation recursion 2 | def exp2(num, exponent)
return 1 if exponent == 0
exp_recursion = exp2(num, (exponent / 2))
if exponent.even?
exp2(num, (exponent / 2)) * exp2(num, (exponent / 2))
else
num * exp2(num, (exponent - 1) / 2) * exp2(num, (exponent - 1) / 2)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exp1(base, power)\n puts \"exp1\"\n return 1 if power == 0\n base * exp1(base, power - 1)\nend",
"def exp_1(base, exp)\n return 1 if exp == 0\n\n base * exp_1(base, exp-1)\nend",
"def exp1(base, power)\n return 1 if power == 0\n base * exp1(base, power - 1)\nend",
"def exp1(base, power)\n return 1 if power == 0\n base * exp1(base, power - 1)\nend",
"def exp1(num, exponent)\n return 1 if exponent == 0\n # return ( 1 / exp1(num, exponent - 1) )\n\n num * exp1(num, exponent - 1)\nend",
"def exp1(base, n)\n return 1 if n == 0 \n\n base * exp1(base, n-1)\nend",
"def exp1(base, power)\n return 1 if power <= 0\n exp1(base, power - 1) * base\nend",
"def exp1(b, n)\n return 1 if n == 0\n p b * exp1(b, n - 1)\nend",
"def exp2(base, power)\n puts \"exp2\"\n return 1 if power == 0\n return base if power == 1 #\n\n if power.even?\n exp2(base, power / 2) ** 2\n else\n base * ( exp2(base, (power - 1) / 2) ** 2 )\n end\nend",
"def exp_1(b, num)\n return 1 if num == 0\n b * exp_1(b, num - 1)\nend",
"def rec_exp_1(base, power)\nend",
"def rec_exp_2(base, power)\nend",
"def exp1(b, n)\n return 1 if n == 0\n b * exp1(b, n - 1)\nend",
"def exponentiation_one(base, exp)\n return nil if exp < 0\n return 1 if exp == 0\n return base if exp == 1\n\n base * exponentiation_one(base, exp - 1)\nend",
"def exp_1(b, n)\n return 1 if n == 0\n b * exp_1(b, n - 1)\nend",
"def exp1(b, e)\n return 1 if e == 0\n exp1(b, e - 1) * b\nend",
"def exp(base, power)\n return 1 if power == 0\n return base if power == 1\n base * exp(base, (power-1))\nend",
"def exp_v_1(num, pow)\n return 1 if pow === 0\n return num * exp_v_1(num, pow - 1)\nend",
"def recursive_exponent_1(base, exponent)\n puts \"#{__method__} called\"\n return 1 if exponent.zero?\n base * recursive_exponent_1(base, exponent - 1)\nend",
"def exp(b,n) #First method\n return 1 if n == 0\n if n > 0\n b * exp(b,n - 1)\n else\n (1.0/b) * exp(b,n + 1) \n end\nend",
"def exp2(n,e)\n return n if n == 0 || n == 1 || e == 1\n return 1 if e == 0\n if e % 2 == 0\n temp = exp2(n,(e / 2))\n return temp * temp\n else\n temp = exp2(n,((e - 1) / 2))\n return n * temp * temp\n end\nend",
"def exp1(b, n)\n n == 0 ? 1 : b * exp1(b, n - 1)\nend",
"def exp_2(base, exp)\n return 1 if exp == 0\n return base if exp == 1\n\n if exp % 2 == 0\n even = exp_2(base, exp / 2)\n even * even\n else\n odd = exp_2(base, (exp - 1) / 2)\n base * odd * odd\n end\nend",
"def exp(base,exponent)\n p exponent\n return 1 if exponent == 0\n return base if exponent == 1\n if exponent.even?\n result = exp(base,exponent/2)\n result * result\n else\n result = exp(base,(exponent-1)/2)\n base * (result * result)\n end\n\n\nend",
"def exp1(base, num)\n return 1 if num == 0\n return base if num == 1\n expo = base * exp1(base, num-1)\nend",
"def exponentiation(base, exp)\n return nil if exp < 0\n return 1 if exp == 0\n return base if exp == 1\n\n if exp.even?\n (exponentiation(base, exp / 2)**2)\n else\n base * (exponentiation(base, (exp - 1) / 2)**2)\n end\nend",
"def exponent1(base, power)\n # if power equals zero , then 1 else (base * method(base,power - 1))\n if power == 0\n return 1\n else\n (base * exponent1(base, power - 1))\n end\nend",
"def exp(base, exponent)\n return base if exponent == 1\n base * exp(base, exponent-1)\nend",
"def exp(a, b)\n if b == 0\n 1\n else\n a * exp(a, b - 1)\n end\nend",
"def exponential_function\n num_1 ** num_2\n return num_1 ** num_2\nend",
"def exp(b,n)\n return 1 if n == 0\n b * exp(b,n-1)\nend",
"def exponentiation_1(b, n)\n return 1 if n == 0\n return b if n == 1\n b*exponentiation_1(b, n-1)\nend",
"def exp(base, exponent)\n return 1 if exponent.zero?\n\n base * exp(base, exponent - 1)\nend",
"def exp2(base, num)\n return 1 if num == 0\n return base if num == 1\n if num % 2 == 0\n expo = exp(base, num/2)\n else\n expo = exp(base, (num-1)/2)\n end\nend",
"def exponent1(base, num)\n return 1 if num == 0\n return base if num == 1\n x = base * exponent1(base, num-1)\n\nend",
"def exp(b, n)\n return b if n == 0 || n == 1\n \n return b * exp(b, n - 1)\nend",
"def exponentiation1(b,n)\n return 1 if n == 0 \n b * exponentiation1(b, n - 1)\nend",
"def exp_r1 (base, exponent)\n if exponent == 0\n return 1\n else\n base * exp_r1(base, exponent - 1)\n end\nend",
"def exponentiation_1(b, n)\n return 1 if n == 0\n return b if n == 1\n b * exponentiation_1(b, n - 1)\nend",
"def exp(b, n)\n return b if n <= 1\n b * exp(b, n-1)\nend",
"def exp_2(b, n)\n return 1 if n == 0\n return b if n == 1\n\n even_rec = exp_2(b, n / 2) # if n.even?\n odd_rec = exp_2(b, (n - 1) / 2) # if n.odd?\n\n if n.even?\n even_rec * even_rec\n # exp(2, 8)\n # => [ exp(2, 4) ] * [ exp(2, 4) ]\n # => [ exp(2, 2) * exp(2, 2) ] * [ exp(2, 2) * exp(2, 2) ]\n # => [ exp(2, 1) * exp(2, 1) * exp(2, 1) * exp(2, 1) ] *[ exp(2, 1) * exp(2, 1) * exp(2, 1) * exp(2, 1) ]\n # => [ b * b * b * b * b * b * b * b ]\n else # n == odd\n b * odd_rec * odd_rec\n # => exp(2, 7)\n # => b * [ exp(2, 3) ] * [ exp(2, 3) ]\n # => b * [ b * exp(2, 1) * exp(2, 1) ] * [ b * exp(2, 1) * exp(2, 1) ]\n # => b * [ b * b * b ] * [ b * b * b ]\n end\n\nend",
"def exp2(b, n)\n p \"exp2 #{b}, #{n}\"\n return 1 if n<=0\n return b if n==1\n if n.even?\n half_exp = exp2(b, n/2)\n return half_exp * half_exp\n else\n half_exp = exp2(b, (n-1)/2)\n return b*half_exp * half_exp\n end\nend",
"def exp2(base, power)\n return 1 if power == 0\n half = exp2(base, power / 2)\n\n if power.even?\n half * half\n else\n # note that (power / 2) == ((power - 1) / 2) if power.odd?\n base * half * half\n end\nend",
"def power(n, exp)\n total = 1\n 1.upto(exp) do |num|\n total = multiply(n, total)\n end\n total\nend",
"def exp2(base, power)\n return 1 if power == 0\n\n half = exp2(base, power / 2)\n\n if power.even?\n half * half\n else\n # note that (power / 2) == ((power - 1) / 2) if power.odd?\n base * half * half\n end\nend",
"def exponent_v1(b, n)\n puts s += 1\n if n == 0\n return 1\n end\n b * exponent_v1(b, n-1)\nend",
"def exp_two(num, power)\n return 1 if power == 0\n return num if power == 1\n if power.odd?\n exp = exp_two(num, (power - 1) / 2)\n num * exp * exp\n else\n exp = exp_two(num, power / 2)\n exp * exp\n end\nend",
"def exp2(b, n)\n return 1 if n == 0\n return b if n == 1\n if n.even?\n partial = exp2(b, n / 2)\n return partial * partial\n else\n partial = exp2(b, (n - 1) / 2)\n return b * (partial * partial)\n end\nend",
"def exp\n x, y = stack.pop(2)\n push x ** y\n end",
"def exponentiation(base, power)\n return 1 if power == 0\n base * exponentiation(base, power - 1)\nend",
"def exp(b,n)\n return 1 if n == 0\n return b if n == 1\n\n if n.even?\n num = exp(b, n / 2)\n num * num\n else\n num = exp(b, (n - 1) / 2)\n b * num * num\n end\nend",
"def exp(b,n)\n return 1 if n == 0\n return b if n == 1\n case \n when n > 0 && n.even?\n exp(b,n/2) ** 2\n when n > 0 && n.odd?\n b * exp(b,(n-1)/2)**2\n when n < 0 && n.even?\n exp(1.0/b,n/2) ** 2\n when n < 0 && n.odd?\n 1.0/b * exp(b,(n+1)/2) **2\n end\nend",
"def exp(b, n)\n return b if n == 0 || n == 1\n \n if n.even?\n return exp(b, n / 2) ** 2\n else\n return b * exp(b, n - 1)\n end\nend",
"def exp(n, i)\n n ** i\nend",
"def exponent_v1(base, power)\n return 1 if power <= 0\n base * exponent_v1(base, power-1)\nend",
"def exponent1(base, power)\n\treturn 1 if power == 0\n\tbase * exponent1(base, power - 1)\nend",
"def exp(b, n) # option 2\n return 1 if n == 0\n result = nil\n\n if n.even?\n result = exp(b, n / 2) ** 2\n else\n result = b * (exp(b, (n - 1) / 2) ** 2)\n end\n\n result\nend",
"def pow(base, exponent) #(3, 4) ==> 3 * 3 * 3 * 3 = \n return 1 if exponent == 0 \n #return base if exponent == 1\n base * pow(base, exponent - 1)\nend",
"def expo_1(number, power)\n return 1 if power == 0\n return number if power == 1 \n\n number * expo(number, power - 1)\nend",
"def expotential(num, power)\n result = 1\n loop do\n result = multiply(result, num)\n power -= 1\n break if power == 0\n end\n result\nend",
"def power(base, exp)\n return base ** exp\nend",
"def exponential(value1)\n result = Math.exp(value1)\n puts \"The result is #{ result }\"\nend",
"def exponent_1(base, power)\n\treturn 1 if power == 0\n\tlesser_power = power - 1\n\tbase_to_the_lesser_power = exponent_1(base, lesser_power)\n\tbase * base_to_the_lesser_power\nend",
"def calculate_exponent(num, exp)\n\treturn num ** exp\nend",
"def exponentm(num_1,num_2)\n return num_1 ** num_2\nend",
"def fact_sig_exp(n)\n gamma_sig_exp(n + 1)\nend",
"def exponentiation_2(b, n)\n return 1 if n == 0\n return b if n == 1\n\n if n.even?\n exponentiation_2(b, n / 2) ** 2\n else\n b * (exponentiation_2(b, (n - 1) / 2) ** 2)\n end\nend",
"def exponent(b, n)\n\nend",
"def exponent(b, n)\n\nend",
"def exponent(b, n)\n\nend",
"def power (num, exponent)\n if exponent == 0\n result = 1\n elsif exponent == 1\n result = num\n else\n result = multiply(num, num)\n (exponent-2).times { result = multiply(result, num) }\n result\n end\nend",
"def propagation_fn(x) 1/(1+Math.exp(-x)) end",
"def power(exp)\n proc { |base| base**exp}\n end",
"def power(x,n)\n n == 0 ? (return 1) : x*power(x,n-1)\n\nend",
"def exponent_v2(b, n)\n puts s += 1\n if n == 0 \n return 1\n elsif n == 1 \n return b\n elsif n.even?\n rec = exponent_v2(b, n / 2)\n rec * rec\n else \n rec = exponent_v2(b, (n - 1) / 2)\n b * rec * rec\n end\nend",
"def exp(v); Math.exp(v); end",
"def exp(number, exponent)\n number * (10**exponent)\nend",
"def exp2(b, e)\n return 1 if e == 0\n half = exp2(b, e/2)\n\n if e.even?\n half * half\n elsif e.odd?\n b * half * half\n end\nend",
"def exponentiation2(b, n)\n return 1 if n == 0\n return b if n == 1\n if n.even?\n exponentiation2(b, n / 2) ** 2\n else\n b * exponentiation2(b, (n - 1) / 2) ** 2\n end\nend",
"def exponentiation(b, n)\n return 1 if n == 0\n\n return exponentiation(b, n - 1) * b\nend",
"def exponent(b, n)\n return 1 if n == 0\n if n > 0\n b * exponent(b, n - 1)\n else\n 1.0/b * exponent(b, n + 1)\n end\nend",
"def exponent(b, n)\n return 1 if n == 0\n if n > 0\n b * exponent(b, n - 1)\n else\n 1.0/b * exponent(b, n + 1)\n end\nend",
"def power(n, e)\n if e == 0\n return 1\n elsif e == 1 \n return n\n else\n multiply(n, n**(e - 1))\n end\nend",
"def exp_ver_two(base, exponent)\n return 1 if exponent.zero?\n\n if exponent.even?\n n = exp_ver_two(base, exponent / 2)\n n * n\n else\n n = exp_ver_two(base, (exponent - 1) / 2)\n base * (n * n)\n end\nend",
"def power(n1, n2)\n n1 ** n2\nend",
"def exponent(b, n)\n return 1 if n == 0\n\n if n > 0\n b * exponent(b, n - 1)\n else\n 1.0/b * exponent(b, n + 1)\n end\nend",
"def power(base, exp)\n i = 0\n output = 1\n\n while i < exp\n output *= base\n i += 1\n end\n return output\nend",
"def gamma_fnc(n)\n return nil if n == 0\n return 1 if n == 1\n gamma_fnc(n - 1) * (n - 1)\n\n\n # n = (n - 1)!\n # n = 4\n # 3! = 3 * 2 * 1\n # 3 => 2 3-1 = 2\n # 2 => 1 2-1 = 1\n\nend",
"def power(n1, n2)\n return n1**n2\nend",
"def exponent; end",
"def fastexp_mod x,k,n\n if k<0\n throw :error\n elsif k==0\n 1\n elsif (k%2==0)\n fastexp_mod (x*x)%n, k/2, n\n else\n x*(fastexp_mod (x*x)%n, k/2, n) % n\n end\nend",
"def exponent(b, n)\n return b if n == 1\n return 1 if n == 0\n if n >= 0\n exponent(b, n-1) * b\n else\n (1.0/b) * exponent(b, n+1)\n end\n end",
"def my_pow(x, n)\n return x if n == 1\n return x * x if n == 2\n return x / x if n == -2\n\n if n > 0\n x * my_pow(x, n - 1)\n else\n my_pow(x, n + 1)\n end\nend",
"def getExp ( x , y )\n\texp = x ** y\n\treturn exp\nend",
"def power(num, n)\n return num if n == 1\n multiply(num, power(num, n - 1))\nend",
"def gamma_fnc(n)\n return nil if n == 0\n return 1 if n == (1 || 2)\n\n (n - 1) * gamma_fnc(n - 1)\nend",
"def power(input1, input2)\n input1 ** input2\nend",
"def gamma_fnc(num)\n return nil if num < 1\n return 1 if num == 1\n\n (num - 1) * gamma_fnc(num - 1)\nend",
"def gamma_fnc(n)\n return nil if n == 0\n return 1 if n == 1\n (n - 1) * gamma_fnc(n - 1)\nend",
"def mr_expmod(base, exp, m)\n if (exp % 2 == 0) && exp != 0\n x = mr_expmod(base, (exp/2), m)\n square = (x**2) % m\n (square == 1) && (x != 1) && (x != (m-1)) ? (return 0) : (return square)\n elsif exp != 0\n x = mr_expmod(base, (exp-1), m)\n return ((base * x) % m)\n else\n return 1\n end\nend"
] | [
"0.83712566",
"0.81268543",
"0.79105455",
"0.7886124",
"0.78494084",
"0.78212553",
"0.77765256",
"0.7769432",
"0.7766686",
"0.7720705",
"0.7678441",
"0.763474",
"0.76343656",
"0.7631437",
"0.7617895",
"0.7606278",
"0.75894874",
"0.7557639",
"0.7554589",
"0.7549023",
"0.7540875",
"0.7534959",
"0.75104535",
"0.7505454",
"0.7493588",
"0.74258786",
"0.73516047",
"0.7350973",
"0.7308972",
"0.7273666",
"0.7272492",
"0.72331375",
"0.72183144",
"0.7169275",
"0.71602213",
"0.714958",
"0.7136384",
"0.7113914",
"0.706403",
"0.70522255",
"0.70306563",
"0.7004235",
"0.6913189",
"0.6904661",
"0.6903494",
"0.6896293",
"0.68625325",
"0.6845856",
"0.68227184",
"0.6809304",
"0.6799472",
"0.6798151",
"0.6787925",
"0.6776965",
"0.67703265",
"0.6759178",
"0.66942537",
"0.6688575",
"0.66694754",
"0.66281533",
"0.6622382",
"0.65914565",
"0.65835625",
"0.6572574",
"0.64858276",
"0.64749587",
"0.6469617",
"0.6462241",
"0.6462241",
"0.6462241",
"0.64491314",
"0.64459014",
"0.6431946",
"0.6410645",
"0.64024544",
"0.6394865",
"0.638646",
"0.6362255",
"0.63606834",
"0.63128024",
"0.6293625",
"0.6293625",
"0.62832284",
"0.62815046",
"0.62782824",
"0.62702286",
"0.6254927",
"0.6251657",
"0.6225462",
"0.6209063",
"0.6175672",
"0.6155356",
"0.6150952",
"0.6137781",
"0.6128825",
"0.6084764",
"0.60594636",
"0.6035156",
"0.6024316",
"0.60165447"
] | 0.76857775 | 10 |
original = ["1", "2", "3"] copy = original.deep_dup copy[1] << "LED" puts copy puts original fibionacci iteration | def fib_it(n)
fib_array = [1, 1]
return fib_array if n == 2
return [1] if n == 1
(3..n).count { fib_array << fib_array[-2] + fib_array[-1] }
fib_array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deep_copy\n answer = []\n %w[1 2 3 4 5 6].each do |elem|\n answer << elem.dup\n end\n answer\nend",
"def duplicate(arr)\n copy = arr\n result = arr.map do |x|\n x + 2\n end\n p result\n p copy\nend",
"def deep_dup(arr)\n\nend",
"def deep_dup(arr)\n\nend",
"def deep_dup(arr)\n\nend",
"def deep_dup(arr)\n duper_arr = arr.dup.map { |item| item * 1 }\nend",
"def dup #$\n a = pop\n push a\n push a\n end",
"def deep_dup; end",
"def change_resistant_for_each_element(array)\n copy =Array.new(array)\n i=0\n while i<copy.length\n copy[i]=array[i]\n i +=1\n end\n copy\nend",
"def deep_dup\n map(&:deep_dup)\n end",
"def create_copy(arr)\n copy = []\n arr.each { |e| copy.unshift(e) }\n copy\nend",
"def deep_dup\n dup\n end",
"def mirror(list)\n list_copy = list.dup\n index_tracker = list.length - 1\n until index_tracker == 0\n list_copy << list[index_tracker]\n index_tracker -= 1\n end\n return list_copy\nend",
"def copy array\n array.map(&:clone)\nend",
"def deep_dup\n # noinspection RubyMismatchedReturnType\n dup\n end",
"def dup(array)\n output = []\n i = 0\n while i < array.length\n output << array[i]\n i += 1\n end\n return output\nend",
"def deep_dup(arr)\n return [arr] if !arr.is_a?(Array)\n res = []\n arr.each do |a|\n res += deep_dup(a)\n end \n res \nend",
"def recursive_deep_dup(arr)\n # # does arr contain anymore arrays?\n # if !(arr.is_a? Array)\n # arr\n # else\n # arr[recursive_deep_dup(arr)].dup\n # arr_copy = arr.dup\n arr_copy = []\n arr.each do |sub|\n if sub.is_a? Array\n # sub_copy = sub.dup\n # p sub_copy\n # recursive_deep_dup(sub_copy)\n arr_copy << recursive_deep_dup(sub)\n else\n arr_copy << sub\n end\n end\n arr_copy\n # end\nend",
"def one(array)\n array.shift\n array << 6\nend",
"def deep_dup(arr)\n copy = arr.dup\n copy.each_with_index do |el, i|\n copy[i] = deep_dup(el) if el.is_a?(Array)\n end\nend",
"def push_dup; end",
"def deep_dup(array_to_dup)\n [].tap do |duplicated_array|\n\n array_to_dup.each do |item|\n\n puts \"item is #{item}\"\n\n if item.is_a?(Array)\n duplicated_array << deep_dup(item)\n else\n duplicated_array << item\n end\n end\n end\nend",
"def dupli(list)\n list.map { |i| [i, i] }.flatten\nend",
"def deeper_dup(arr)\n duper_deeper_arr = arr.dup.map do |item|\n if item.kind_of?(Array)\n deeper_dup(item)\n else\n item = item * 1\n end\n end\n duper_deeper_arr \nend",
"def get_board_copy(board)\n dupe_board = []\n for i in board\n dupe_board.push(i)\n end \n return dupe_board\nend",
"def array_copy(a)\n n = []\n a.each do |i|\n n.push(i)\n end\n n\nend",
"def rec_deep_dup(input)\n if !input.is_a?(Array)\n input\n else\n result = []\n input.each do |element|\n result << rec_deep_dup(element)\n end\n end\nend",
"def dup_copy\n @num_copies += 1\n @num_in += 1\n\n puts \"Great now we have #{@num_copies}!\"\n end",
"def initialize_dup( hooked_array_dup )\n \n super\n \n hooked_array_dup.internal_array = hooked_array_dup.internal_array.dup\n\n end",
"def buy_fruit(arr)\n new_arr = []\n\n arr.each { |element| element[1].times { |_| new_arr << element[0] } }\n p new_arr\nend",
"def fib_method(n)\n fib_array = []\n a = 0\n b = 1\n fib_array.push(a)\n n.times do\n c = a\n a = b\n b = c + b\n \n fib_array.push(a)\n end\n p fib_array\nend",
"def deep_dup(arr)\n # new_array = []\n # arr.each do |el|\n # new_array << (el.is_a?(Array) ? deep_dup(el) : el)\n # end\n # new_array\nend",
"def deep_dup(arr)\n return arr if !arr.kind_of?(Array)\n new_arr = []\n arr.each do |ele|\n new_arr << deep_dup(ele)\n end\n new_arr\nend",
"def deep_copy\n deep_transform_values(&method(:_deep_copy))\n end",
"def dup(n=1)\n n.times{dps.concat(dps)}\n self\nend",
"def deep_dup(arr)\n if !arr.is_a?(Array)\n return arr\n end\n\n duped_arr = []\n arr.each do |el|\n duped_arr << deep_dup(el)\n end\n\n return duped_arr\nend",
"def deepen_copy! copier, src\n @a = @a.map { | x | copier[x] }\n end",
"def deep_clone; end",
"def reverse(arr)\n # copy = []\n # arr.each { |e| copy.unshift(e) }\n # copy\n\n # Now trying to solve with Enumerable#each_with_object\n # arr.each_with_object([]) { |e, copy| copy.unshift(e) }\n\n # Now trying to solve with Enumerable#inject\n arr.inject([]) { |copy, e| copy.unshift(e) }\nend",
"def fib(n)\n fib_array = []\n a = 0\n b = 1\n fib_array.push(a)\n n.times do\n temp = a\n a = b\n b = temp + b\n fib_array.push(a)\n end\n p fib_array\nend",
"def reverse_copy_stack\n self.arr[0...self.curr].dup\n end",
"def recursive_deep_dup(arr)\n return arr unless arr.is_a?(Array)\n \n new_arr = []\n arr.each { |ele| new_arr << recursive_deep_dup(ele) }\n new_arr\nend",
"def __deep_copy__\n map { |value| value.__deep_copy__ }\n end",
"def doubler(numbers)\n new_numbers = []\n # numbers.each { |num| new_numbers << num * 2 }\n numbers.each { |num| new_numbers.push(num * 2) }\n new_numbers\nend",
"def reverse!(array)\n copy = array.clone\n index = -1\n\n copy.each do |element|\n array[index] = element\n index -= 1\n end\n\n array\nend",
"def deep_dup(arr)\n ans = []\n arr.each do |elt| #can use map\n if elt.is_a?(Array)\n ans.concat([deep_dup(elt)])\n else\n ans << elt\n end\n end\n ans\nend",
"def deep_dup(arr)\n new_arr = []\n return arr if !arr.is_a?(Array)\n # return arr.each if arr.is_a?\n\n if arr.is_a?(Array)\n arr.each do |value|\n new_arr << deep_dup(value)\n end\n end\n new_arr\nend",
"def deep_dup(array)\n return array if !array.is_a?(Array)\n array.map do |x|\n deep_dup(x)\n end\n end",
"def fibonacci_creator(number)\nfib_arr = [0,1]\nindex = 2\nwhile index < number \nfib_num = fib_arr[-1] + fib_arr[-2]\nfib_arr << fib_num\n index +=1 \nend\nfib_arr[-1]\nend",
"def reverse!(list)\n list_copy = list.dup\n counter = list.size\n list.map! do |elem|\n counter -= 1\n list_copy[counter]\n end\nend",
"def deep_dup(arr)\n return arr.dup if arr.none?{|ele| ele.is_a?(Array)}\n temp = arr[0]\n if temp.is_a?(Array)\n [arr[0].dup] + deep_dup(arr[1..-1])\n else\n [arr[0]] + deep_dup(arr[1..-1])\n end\nend",
"def deep_dup(ary)\n ary.map { |sub_ary| sub_ary.map { |el| el } }\nend",
"def doubler(arr)\n new = []\n arr.each do |i|\n new << i*2\n end\n return new\nend",
"def deep_dup(array)\n arr = []\n return [] if array.empty?\n return array if array.length == 1 \n array.each do |ele|\n if ele.is_a? Array \n arr << deep_dup(ele)\n else \n arr << ele\n end \n end \n arr \nend",
"def deep_dup\n puts \"warning: #{self.class}: deep_dup not implement\"\n end",
"def fibonacci(n)\r\n #basecase\r\n return [1] if n == 1\r\n return [1,1] if n == 2\r\n\r\n # # new_f = fibonacci(n -1)\r\n new_f = fibonacci(n -1)\r\n num = new_f[-1] + new_f[-2]\r\n new_f + [num]\r\n # new_arr << new_num\r\nend",
"def duplin(list, n)\n list.map { |i| [i] * n }.flatten\nend",
"def copy_list\n new_cdr = if cdr.kind_of? Cons\n cdr.copy_list\n else\n cdr\n end\n Cons[@car,new_cdr]\n end",
"def fib(i)\r\n arr = [0]\r\na = 0\r\nb = 1 \r\nif i >= 1 \r\narr << 1 \r\nend \r\nwhile arr.length < i \r\n if i > 1 \r\n c = a + b \r\n arr << c \r\n a = b \r\n b = c \r\n end \r\nend \r\np arr \r\nend",
"def lAS(n: 0)\n array = [1]\n puts \"#{array.inspect}\"\n previous = array.first\n new_array = []\n counter = 0\n \n n.times do\n previous = array.first\n counter = 0\n new_array = []\n \n array.each do |element|\n if(element == previous)\n counter = counter + 1\n else\n new_array << counter\n new_array << previous\n counter = 1\n previous = element\n end\n end\n \n new_array << counter\n new_array << previous\n array = new_array.dup\n puts \"#{array.inspect}\"\n end\nend",
"def fibonacci(num)\n array = [1,1]\n n = 0\n\n num.times do\n array << array[n] + array[n + 1]\n n += 1\n end\n\n array[n - 1]\nend",
"def fibonacci(num)\n array = [1,1]\n n = 0\n\n num.times do\n array << array[n] + array[n + 1]\n n += 1\n end\n\n array[n - 1]\nend",
"def __deep_copy__\n self.class.new(aliases) do |copy|\n each do |entry|\n copy.push(entry.__deep_copy__)\n end\n end\n end",
"def fibonacci_gen(x)\r\n fib = [0, 1,]\r\n idx = 0\r\n (x - 2).times do\r\n fib_value = fib[idx] + fib[idx + 1]\r\n fib.push(fib_value)\r\n idx += 1\r\n end\r\n return fib\r\nend",
"def deep_copy(obj)\n super\n n = obj.first\n until n.nil? do\n if n.value.is_a? Linkedlist\n k = Linkedlist.new\n self.addToList(k.deep_copy(n.value))\n else\n self.addToList(n.value)\n end\n n = n.next\n end\n return self\n end",
"def backwards!(array)\n duplicate = array.clone\n counter = 0\n loop do\n break if duplicate.empty? # counter == array.length\n\n array[counter]= duplicate.pop\n counter += 1\n end\n array\nend",
"def fibs(num)\n x = 0\n y = 1\n arr = []\n\n num.times { \n z = x + y \n arr << x\n x = y\n y = z\n }\n arr\nend",
"def deep_clone\n b = dup\n b.generate_token\n b.save\n basket_items.each {|i| b.basket_items << i.dup}\n b\n end",
"def repa(array, x)\n result = []\n (1..x).each do\n result.concat(array)\n end\n return result\nend",
"def fibonacci(index)\r\n\tarr = [0, 1]\r\n\twhile arr.length < index\r\n\tif arr.length > 3\t\t# I'll be damned if arr[3] is going to spoil my quick code >:O\r\n\t\tarr[3] = 2\r\n\tend\r\n\tnum1 = arr.index(arr.last)\r\n\tnum2 = arr.index(arr.last)-1\r\n\tnext_value = arr[num1]+arr[num2]\r\n\tarr << next_value\r\n \tend\r\np arr[index-1]\r\nend",
"def fibonacci( n )\r\n\tfib = [0, 1]\r\n (2..n).each do |n|\r\n next_fib = fib[ n - 1 ] + fib[ n - 2 ]\r\n fib.push(next_fib)\r\n\tend\r\n\tfib.delete_at(-1)\r\n\tp fib\r\nend",
"def copyArr(arr)\n temp = []\n for el in arr\n temp.push(el)\n end\n return temp\nend",
"def deep_dup(arr)\n deep = []\n arr.each do |el|\n if el.is_a?(Array)\n deep << deep_dup(el)\n else\n deep << el\n end\n end\n deep\nend",
"def fib(num)\n array = [0, 1]\n previous = 0\n current = 1\n (num - 2).times do | i |\n next_num = previous + current\n array.push(next_num)\n previous = current\n current = next_num\n end\n array\nend",
"def buy_fruit(list)\n new_list = []\n list.each { |arr| arr[1].times { new_list << arr[0] } }\n new_list\nend",
"def dup\n clone\n end",
"def async\n recursive.deep_dup\n end",
"def buy_fruit(deep_list)\n list = []\n deep_list.each do |fruits|\n fruits[1].times do\n list << fruits[0]\n end\n end\n list\nend",
"def iterative_fibinacci(num)\n\tfib_container = [1,1]\n\t(num-2).times { fib_container << fib_container[-2] + fib_container.last }\n\tfib_container\nend",
"def fibonacci_iter(num)\n return [1] if num == 1\n return [1, 1] if num == 2\n\n fibonacci = [1, 1]\n i = 2\n while i < num do\n fibonacci << fibonacci[-1] + fibonacci[-2]\n i += 1\n end\n fibonacci\nend",
"def fibonacci (integer)\n\tfib_arr = [0, 1]\n\t(integer-2).times do |index|\n\t\tresult = fib_arr[index+1] + fib_arr[index]\n\t\tfib_arr << result\n\tend\n\t\np fib_arr\nend",
"def fibonacci(n)\n if n<=2\n [0,1].take(n)\n else\n arr = fibonacci(n-1)\n arr << arr[-2]+arr[-1]\n end\nend",
"def dup\n copy(false)\n end",
"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 pack_consecutive_duplicates\n self.inject([[]]) do |array, current|\n if array[-1][-1] == current or array[-1][-1].nil?\n array[-1] << current\n else\n array << [current]\n end\n array\n end\n \n end",
"def fib(n)\r\n arr = [0, 1]\r\n i = 2\r\n while i < n\r\n arr << arr[-1] + arr[-2]\r\n i += 1 \r\n end\r\n p arr\r\nend",
"def dup_state\r\n @state.dup\r\n end",
"def deep_dup(outer)\n return outer if outer.empty?\n\n temp = []\n outer.each do |element|\n if element.is_a?(Array)\n temp << deep_dup(Array.new(element))\n else\n temp << element\n end\n end\n\n temp\nend",
"def fib(n)\n return [] if n < 1\n return [1] if n == 1\n return [1, 1] if n == 2\n\n prev_fib = fib(n - 1)\n num1 = prev_fib[-1]\n num2 = prev_fib[-2]\n prev_fib << num1 + num2\n prev_fib\nend",
"def fibo_print_all_upto(num)\n a = 1\n b = 1\n c = a+b\n ar = [a,b,c]\n num.times do\n a = b\n b = c\n c = a+b\n ar << c\n end\n print \"The first #{num} in the Fibonacci series are #{ar}\"\n print \"\\n\"\nend",
"def fibonacci(length)\n if length == 0\n return []\n elsif length == 1\n return [1]\n end\n\n seq = [1, 1]\n while seq.length < length\n last = seq[-1]\n second_to_last = seq[-2]\n print seq\n puts\n next_ele = last + second_to_last\n puts next_ele\n puts \"=====\"\n seq << next_ele\n end\n\n return seq\nend",
"def deep_dup\n Marshal.load(Marshal.dump(self))\n end",
"def copy_list \n\n\tend",
"def reverse_append1(ary, n)\r\n \r\n 0.upto(n) {|n| ary.push(n)}\r\n ary\r\nend",
"def fibonacci( n )\n return [1] if n < 2\n return [1,1] if n == 2\n arr = fibonacci(n-1)\n fib_sum = arr[-1] + arr[-2]\n arr << fib_sum\nend",
"def dup\n copy = Lexicon.new\n self.each{|e| copy.add(e.dup)}\n return copy\n end",
"def initialize(nums)\n @memo = []\n @len = nums.size\n nums.each_with_index do |x, i|\n if i > 0\n @memo[i] = @memo[i-1] + x\n else\n @memo[i] = x\n end\n end\n end",
"def fib(n)\n return [0,1].take(n) if n <= 2\n prev = fib(n-1)\n prev << prev[-1] + prev[-2]\nend",
"def fibonacci(total_iterations)\n first, last = [1, 1]\n\n 3.upto(total_iterations) do\n first, last = [last, first + last]\n end\n \n last\nend",
"def fib(n)\n if n == 1\n return [0]\n elsif n == 2\n return [0, 1]\n else\n one_less = fib(n-1)\n one_less << one_less[-1] + one_less[-2]\n return one_less\n end\n\nend",
"def dup\n copy = Queue.new\n copy.size = @size\n copy.elements = @elements\n copy\n end"
] | [
"0.7054535",
"0.70052844",
"0.6744352",
"0.6744352",
"0.6744352",
"0.6719133",
"0.6611716",
"0.6539533",
"0.6506038",
"0.64236987",
"0.6405105",
"0.6342492",
"0.63408864",
"0.6228661",
"0.6216116",
"0.6184086",
"0.6168025",
"0.6143065",
"0.61417013",
"0.61206883",
"0.61109424",
"0.60650855",
"0.60586333",
"0.605798",
"0.60443336",
"0.6043528",
"0.60290706",
"0.6021322",
"0.60033554",
"0.5995673",
"0.5984107",
"0.5973016",
"0.59656113",
"0.5916665",
"0.59115607",
"0.59083813",
"0.58933836",
"0.589287",
"0.5890001",
"0.5887859",
"0.58860856",
"0.588215",
"0.58805513",
"0.5871745",
"0.58540493",
"0.58481807",
"0.58479625",
"0.5824108",
"0.5808555",
"0.5807627",
"0.58054566",
"0.57782555",
"0.57758284",
"0.5774942",
"0.57739276",
"0.57734174",
"0.5765086",
"0.57505566",
"0.5742594",
"0.57219607",
"0.5715782",
"0.5715782",
"0.5696843",
"0.56817615",
"0.56762344",
"0.5663778",
"0.5651277",
"0.5643783",
"0.5639514",
"0.5638016",
"0.5629225",
"0.56214315",
"0.5611174",
"0.5609785",
"0.5606998",
"0.55909437",
"0.5585201",
"0.55619645",
"0.5558283",
"0.5545829",
"0.554491",
"0.5542949",
"0.55353695",
"0.5533765",
"0.55298567",
"0.5527511",
"0.5525171",
"0.5522508",
"0.55203664",
"0.5518879",
"0.55064976",
"0.550535",
"0.55046934",
"0.5502295",
"0.54993254",
"0.54958963",
"0.5480544",
"0.5480157",
"0.54780555",
"0.54754835",
"0.5475434"
] | 0.0 | -1 |
p fib_it(5) fibionacci recursion | def fib_rec(n)
return nil if n < 1
return [1] if n == 1
return [1, 1] if n == 2
current = [1, 1]
recursive = fib_rec(n - 1)
(recursive.length - 1).times do |el|
current << recursive[el] + recursive[el + 1]
end
current
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fib(n)\n return 0 if n == 0\n return 1 if n == 1\n \n\n fib(n - 1) + fib(n - 2)\nend",
"def fib(n)\r\n if n == 1 then\r\n 10\r\n elsif n == 0 then\r\n 1\r\n else\r\n fib(n - 1) + fib(n - 2)\r\n end\r\nend",
"def fibs(n)\nend",
"def fib(n)\n if n == 0 || n == 1\n return n\n else\n fib(n - 1) + fib(n - 2)\n end\n end",
"def fib(n)\n #if n > 4000000\n #\treturn puts n\n #end\n return n if (0..1).include? n\n fib(n-1) + fib(n-2) if n > 1\nend",
"def fib(n)\n \nend",
"def fib(n)\n # your implementation here\n if n==0 then\n 1\n elsif n==1 then\n 1\n else \n fib(n-2) + fib(n-1)\n end\nend",
"def fib(n)\n return 0 if n <= 0\n return 1 if n == 1\n\n fib(n - 1) + fib(n - 2)\nend",
"def fib(n)\n if n == 0\n 0\n elsif n == 1 || n == 2\n 1\n else fib(n - 2) + fib(n - 1)\n end\nend",
"def fib(n)\n return 1 if n == 2\n return 0 if n == 1\n\n fib(n-1) + fib(n-2)\nend",
"def fib(n)\n if n == 0 || n == 1\n return n\n else\n fib(n-1) + fib(n-2)\n end\nend",
"def fib(n)\n return 0 if n == 0\n return 1 if n == 1\n\n return fib(n-1) + fib(n-2)\nend",
"def fib(n) (n<=2) ? 1 : (fib(n-2)+fib(n-1)) end",
"def fib(n)\n return 0 if n == 0\n return 1 if n == 1\n return 1 if n == 2\n # return 2 if n == 3\n fib(n - 1) + fib(n - 2)\nend",
"def fib(n)\n return n if n < 2\n fib(n-1) + fib(n-2)\nend",
"def show_fib(n)\n return 0 if n == 0\n return 1 if n == 1\n show_fib(n-1) + show_fib(n-2)\nend",
"def fibonacci(n)\r\n if n == 0\r\n return 0\r\n elsif n == 1\r\n return 1\r\n else\r\n return fibonacci(n-1) + fibonacci(n-2)\r\n end\r\nend",
"def fib(n)\n if (n <= 1) \n return n;\n else\n return fib(n-1)+fib(n-2);\n end\nend",
"def fib(n)\nend",
"def fib(n)\nend",
"def fib(n)\n return 1 if n == 1 || n == 2\n fib(n-1) + fib(n-2)\nend",
"def fib(n)\n if n == 1 || n == 2\n return 1\n end\n return fib(n - 1) + fib(n - 2)\nend",
"def fibonacci(n)\n \nend",
"def fib(i)\n return 0 if i == 0\n return 1 if i <= 2\n return fib(i-1) + fib(i-2)\nend",
"def fib(n)\n\n if n == 1 or n == 2\n return 1\n else\n return fib(n-1) + fib(n-2)\n end\n\nend",
"def fibonacci(n)\n \nend",
"def fibs(n)\n return n if n <= 1\n fibs(n - 1) + fibs(n - 2)\nend",
"def fib(n)\n if n < 2\n 1\n else\n fib(n-2) + fib(n-1)\n end\nend",
"def fib(n)\n\nend",
"def fib(n)\n if n < 2\n n\n else\n fib(n-1)+fib(n-2)\n end\nend",
"def fib(n)\n return n if n <= 1\n fib(n-1) + fib(n-2)\nend",
"def fibonacci(n)\n return 0 if n == 0\n return 1 if n == 1\n\n fibonacci(n - 1) + fibonacci(n - 2)\nend",
"def fib(n)\n return 1 if n <= 2\n fib(n - 1) + fib(n - 2)\nend",
"def fibonacci(n)\n return n if n == 1 || n == 0 \n fibonacci(n - 1) + fibonacci(n - 2)\nend",
"def fibonacci(n)\n n = fibonacci( n - 1 ) + fibonacci( n - 2 ) if n > 1\n n\nend",
"def fib(n)\n if n == 1 || n == 2\n return 1\n end\n return fib(n-1) + fib(n-2)\nend",
"def fib(n)\n if n == 1 || n == 2\n return 1\n end\n return fib(n-1) + fib(n-2)\nend",
"def fibonacci(n)\n if n == 0 or n == 1\n return n\n else\n return fibonacci(n - 1) + fibonacci(n - 2)\n end\nend",
"def fib(n)\n if n == 1 || n == 2\n n\n else\n fib(n-1) + fib(n-2)\n end\nend",
"def fibonacci( n )\n return n if n <= 1 \n fibonacci( n - 1 ) + fibonacci( n - 2 ) \nend",
"def fibonacci(integer)\n return 1 if integer <= 2\n\n fibonacci(integer - 1) + fibonacci(integer - 2)\nend",
"def fibonacci(n)\n if n == 0\n 1\n elsif n == 1\n 1\n else\n fibonacci(n-2) + fibonacci(n-1)\n end\nend",
"def fib(num)\n if num == 0\n return 0\n elsif num == 1\n return 1\n else\n result = fib(num - 1) + fib(num - 2)\n return result\n end\nend",
"def fib(n)\n return 0 if n == 0\n fib_helper(0, 1, n-1)\nend",
"def recursive_fib n\n return 1 if n == 1 || n == 2\n recursive_fib(n-1) + recursive_fib(n-2)\nend",
"def fibonacci(number)\r\n if number < 2\r\n number\r\n else\r\n fibonacci(number - 1) + fibonacci(number - 2)\r\n end\r\nend",
"def fib(n)\n return 1 if n <= 2\n fib(n-1) + fib(n-2)\nend",
"def fibonacci(n)\n return 1 if n == 1\n return 1 if n == 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend",
"def fibonacci(n)\n if n <= 2\n 1\n else\n fibonacci(n - 1) + fibonacci(n - 2)\n end\nend",
"def fibonacci(n)\n\treturn 0 if n == 0\n\treturn 1 if n == 1\n\tfibonacci(n-1) + fibonacci(n-2)\nend",
"def fib n\n if n == 0\n 0\n elsif n == 1\n 1\n else\n fib(n-2) + fib(n-1)\n end\nend",
"def fib_rec( n )\n $call_count += 1\n # Define the base case\n if n < 2\n return 1\n else\n # do the recursive calculation:\n return fib_rec( n - 1 ) + fib_rec( n - 2 )\n end\n\nend",
"def fibs_sum(n)\n\nend",
"def fibs_sum(n)\n\nend",
"def fibs_sum(n)\n\nend",
"def fibs_sum(n)\n\nend",
"def fibs_sum(n)\n\nend",
"def fib(n)\n\treturn n if (n < 2)\n\treturn fib(n - 1) + fib(n - 2)\nend",
"def fibonacci(n)\n return 1 if n <= 2\n \n fibonacci(n - 1) + fibonacci(n - 2)\nend",
"def fib n\n return n if n < 2\n fib(n - 1) + fib(n - 2)\nend",
"def fibonacci(n)\n return 0 if n == 1\n return 1 if n == 2\n return fibonacci(n-1)+fibonacci(n-2)\nend",
"def fibonacci(n)\n if n < 2\n n\n else\n fibonacci(n - 1) + fibonacci(n - 2)\n end\nend",
"def fib(n)\n # return base cases of 0, 1\n return n if n == 0 || n == 1\n # call the function again to add the previous two numbers\n return fib(n-2)+fib(n-1)\nend",
"def fibonacci n\n return n if n < 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend",
"def fibonnaci(n)\n if n == 1 || n == 2\n 1\n else\n fibonnaci(n - 1) + fibonnaci(n - 2)\n end\nend",
"def fib(n)\n return n if (0..1).include? n\n fib(n-1) + fib(n-2)\nend",
"def fib(n)\n # your work here\nend",
"def fibonacci(n)\n return 1 if n <= 2\n fibonacci(n - 1 ) + fibonacci(n - 2)\nend",
"def fibonacci(n)\n return 1 if n <= 2\n fibonacci(n - 2) + fibonacci(n - 1)\nend",
"def fibonacci(n)\n return n unless n > 1\n fibonacci(n -1) + fibonacci(n -2)\nend",
"def fibonacci(n)\n if n <= 1\n return n\n else\n return fibonacci(n - 1) + fibonacci(n - 2)\n end\nend",
"def fib n\n return n if n < 2\n fib(n-2) + fib(n-1)\nend",
"def fibonacci(n)\n return 1 if n <= 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend",
"def fibonacci(n)\n return 1 if n <= 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend",
"def recursive_fib(number)\n _recursive_fib(number, 0, 1)\nend",
"def fib(n)\n if n<2\n return n\n else\n return fib(n-2)+fib(n-1)\n end\nend",
"def fib(n)\n return 0 if n < 0\n return n if n < 2\n return fib(n-1) + fib(n-2)\nend",
"def recursive_fib(n, a=0, b=1)\r\n if n == 0\r\n return a\r\n else\r\n recursive_fib(n - 1, b, a + b)\r\n end\r\nend",
"def fib(n)\n case n\n when 0\n 1\n when 1\n 1\n else\n fib(n-1) + fib(n-2)\n end\nend",
"def fibonacci(n)\n \n return n if n == 1\n \n if n > 2 \n fibonacci(n-1) + fibonacci(n-2)\n else\n fibonacci(n-1)\n end\nend",
"def fib(i)\n\tif i.zero?\n\t\t0\n\telsif i == 1\n\t\t1\n\telse\n\t\tfib(i - 2) + fib(i - 1)\n\tend\nend",
"def fibonacci(number)\n if number < 2\n number\n else\n # 2 recursive calls in the recursive case\n fibonacci(number - 1) + fibonacci(number - 2)\n end\nend",
"def recursive_fibonacci(n)\n n <= 1 ? n : fibonacci( n - 1 ) + fibonacci( n - 2 )\nend",
"def fibonacci(n)\n if n == 1 || n == 2\n 1\n else\n fibonacci(n-1) + fibonacci(n-2)\n end\nend",
"def fib(n)\n if n <= 2\n n\n else\n fib(n-1) + fib(n-2)\n end\nend",
"def fibo_nth(n)\n puts \"computing fibo for n=#{n}\" if @debug\n\n case n\n when 0 then 0\n when 1 then 1\n else fibo_nth(n-2) + fibo_nth(n-1)\n end\nend",
"def fib(number)\n if number == 0\n 0\n elsif number == 1\n 1\n else\n test= fib(number-1) + fib(number-2)\n puts \"adding number #{number-1} and #{number-2} = #{test}\"\n test\n end\nend",
"def fibonacci(number)\n if number < 2\n number\n else\n fibonacci(number - 1) + fibonacci(number - 2)\n end\nend",
"def fibonacci(number)\n if number < 2\n number\n else\n fibonacci(number - 1) + fibonacci(number - 2)\n end\nend",
"def fibonacci(number)\n if number < 2\n number\n else\n fibonacci(number - 1) + fibonacci(number - 2)\n end\nend",
"def fibonacci(number)\n if number < 2\n number\n else\n fibonacci(number - 1) + fibonacci(number - 2)\n end\nend",
"def sum_of_fib(n)\n return fib(n+2)-1;\nend",
"def fibonacci(n)\n return n if (0..1).include? n\n (fibonacci(n - 1) + fibonacci(n - 2))\nend",
"def fibonacci(num)\n return 1 if num <= 2\n fibonacci(num - 1) + fibonacci(num -2)\nend",
"def fibonacci(n)\n return 1 if n == 1 || n == 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend",
"def fibonacci(n)\n return 1 if n == 1 || n == 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend",
"def fibonacci(n)\n\tif n == 0 || n == 1\n\t\treturn 1\n\telse\n\t\treturn fibonacci(n-1) + fibonacci(n-2)\n\tend\nend",
"def fibonacci(n)\n if n < 2\n return n\n else\n fibonacci(n-1) + fibonacci(n-2)\n end\nend",
"def fibonacciR( n )\r\n return n if n <= 1\r\n fibonacciR( n - 1) + fibonacciR( n - 2)\r\nend",
"def fib_basic(n)\n if (0..1).include? n\n return n\n else\n (fib_basic(n - 1) + fib_basic(n - 2))\n end\nend",
"def fibonacci(num)\n if num < 2\n num\n else\n fibonacci(num - 1) + fibonacci(num - 2)\n end\nend"
] | [
"0.82992566",
"0.8173859",
"0.8171077",
"0.81431806",
"0.81364584",
"0.8131829",
"0.8127512",
"0.81112874",
"0.8095844",
"0.8091374",
"0.80884045",
"0.8083399",
"0.8082532",
"0.8081151",
"0.80761147",
"0.8069016",
"0.80641234",
"0.8039872",
"0.80366755",
"0.80366755",
"0.80270964",
"0.8024323",
"0.8021109",
"0.8016269",
"0.8015777",
"0.8014478",
"0.80131173",
"0.8011968",
"0.8006185",
"0.80054224",
"0.80021775",
"0.80011857",
"0.7997113",
"0.7987851",
"0.79867905",
"0.7983271",
"0.7983271",
"0.79826117",
"0.79746956",
"0.79721385",
"0.7970661",
"0.797035",
"0.79695463",
"0.7968469",
"0.7967431",
"0.7966609",
"0.7964284",
"0.7964221",
"0.7963946",
"0.79636705",
"0.7960473",
"0.79572284",
"0.7953774",
"0.7953774",
"0.7953774",
"0.7953774",
"0.7953774",
"0.7952062",
"0.7951266",
"0.79509765",
"0.79479307",
"0.7945129",
"0.7943796",
"0.79358125",
"0.79357433",
"0.7934617",
"0.79194605",
"0.7917179",
"0.79165405",
"0.7916344",
"0.79117584",
"0.7907745",
"0.79057616",
"0.79057616",
"0.78997725",
"0.7899682",
"0.7898848",
"0.7898626",
"0.7894892",
"0.7892973",
"0.7889785",
"0.7887719",
"0.7886731",
"0.788355",
"0.78818774",
"0.7879973",
"0.7878966",
"0.7878351",
"0.7878351",
"0.7878351",
"0.7878351",
"0.7871328",
"0.786575",
"0.78654814",
"0.78635496",
"0.78635496",
"0.7862683",
"0.78598523",
"0.78587437",
"0.7858444",
"0.78559136"
] | 0.0 | -1 |
p fib_rec(8) def subsets_practice(array) subset_arr=[[], array] array.each_index do |idx| next_idx = idx+1 subset_arr << [array[idx]] subset_arr << [array[idx], array[next_idx] || array[0]] end p subset_arr end | def subsets(array)
return [[]] if array.empty?
subs = array[0...-1]
smaller_subs = subsets(subs)
bigger_subs = []
smaller_subs.each do |sub|
bigger_subs << sub + [array[-1]]
end
smaller_subs + bigger_subs
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subsets(array)\n return [[]] if array.empty?\n number = array.pop\n prev_subsets = subsets(array)\n new_subsets = []\n prev_subsets.each do |subset|\n new_subsets << ([number] + subset)\n end\n prev_subsets + new_subsets\nend",
"def subsets(array)\n\nend",
"def subsets(array)\n\nend",
"def subsets(array)\n\nend",
"def subsets(array)\n if array.length <= 1\n return array\n end\n subset_array = []\n (0..array.length - 1).each do |i|\n subset_array << subsets(array[0...i]) << subsets(array[0...i]).concat([array[-1]])\n end\n return subset_array\nend",
"def subsets(arr)\n return [[]] if arr == [] \n\n new_arr = []\n last = arr[-1]\n subset = subsets(arr[0..-2])\n\n subset.each do |suba|\n new_arr << suba + [last]\n end\n \n subset + new_arr\n\nend",
"def subsets(arr)\n return [arr] if arr.empty?\nsubsets(arr[])\nend",
"def subsets(arr)\n return [arr] unless arr.is_a?(Array)\n return [arr] if arr.empty?\n\n # return [arr] if arr.length == 1\n # first = arr.shift\n # all_subsets << subsets(first)\n # all_subsets << subsets(arr)\n\n # [[],[1]] << [2],[1,2] [each, last] << [last] [each,last]\n # subsets(arr-1) << subsets(arr)[-1]\n all_subsets = [[]]\n\n arr.each { |ele| all_subsets << [ele] }\n\n (0...(arr.length - 1)).each do |idx1|\n # all_subsets << [arr[idx1]] unless all_subsets.include?(arr[idx1])\n (1...arr.length).each do |idx2|\n if idx2 > idx1 && !all_subsets.include?(arr[idx2])\n # all_subsets << [arr[idx2]]\n all_subsets << arr[idx1..idx2]\n end\n end\n end\n\n all_subsets\nend",
"def subsets(arr)\n return [[]] if arr.length == 0\n #return [arr] if arr.length == 1\n\n prev_set = subsets(arr[0..-2])\n new_subset = prev_set.map { |subarr| subarr + [arr[-1]] }\n\n prev_set + new_subset\nend",
"def subsets(arr)\n subsets_helper(result = [], temp = [], arr, 0)\nend",
"def subsets(arr)\n return [arr] if arr.empty?\n prev = subsets(arr[0..-2]) \n next_one = []\n prev.each { |sub| next_one << sub + [arr[-1]] }\n return prev + next_one\nend",
"def subsets(arr)\n ans = [[]]\n arr.length.times do |id|\n id2 = id + 1\n ans << [arr[id]]\n while id2 < arr.length\n ans << arr[id..id2]\n id2 += 1\n end\n end\n ans\nend",
"def subsets (arr)\n return [[]] if arr.length == 0\n\n interim = subsets(arr[0...-1])\n interim + interim.map do |el|\n el + [arr[-1]]\n end\nend",
"def subsets(arr)\n return [[]] if arr.empty?\n subsets_arr = []\n cur_el = arr[0]\n prior_subs = subsets(arr[1..-1])\n prior_subs.each do |subset|\n subsets_arr << subset.dup.push(cur_el)\n end\n subsets_arr + prior_subs\nend",
"def subsets(arr)\n return [arr] if arr.empty?\n # p arr\n # if arr.length == 1\n # return subsets(arr[0...0]) + [arr]\n # end\n\n arr.each {|ele| subsets(arr -[ele]) } + [arr]\nend",
"def find_subsets(arr, target_value)\n rec(arr, target_value, arr.length - 1)\nend",
"def subsets(arr)\n return [[]] if arr.empty?\n\n # new_series = subsets(arr[0..-2]).each do |subarr|\n # subarr << arr[-1]\n # end\n # subsets(arr[0..-2]) + new_series\n\n prev = subsets(arr[0..-2])\n prev.concat( prev.map { |subarr| subarr + [arr.last] } )\n\nend",
"def subsets(array)\n if array.empty?\n return [[]]\n end\n\n el = array.shift[0]\n old_subsets = subsets(array)\n new_subsets = old_subsets.map { |old_subset| [el] + old_subset }\n new_subsets + old_subsets\nend",
"def subsets(arr)\n return [arr] if arr.empty?\n out = []\n subsets(arr[1..-1]).each do |s|\n out << s\n out << [arr[0]] + s\n end\n out\nend",
"def subsets(arr)\n return [[]] if arr.empty?\n # debugger\n # take - return first n elements\n\n subArr = arr.take(arr.count - 1)\n\n subs = subsets(subArr)\n\n # concat Appends the elements of other_ary to self.\n # tyle co +\n subArrays = subs.map { |sub| sub + [arr.last] }\n subs.concat(subArrays)\nend",
"def subsets(arr)\n return [[]] if arr.empty?\n\n last_el = arr.last\n results = []\n\n\n subsets(arr[0..-2]).each do |el|\n sub_arr = el << last_el\n results << sub_arr\n end\n\n subsets(arr[0..-2]) + results\nend",
"def subsets(arr)\n return [[]] if arr.empty?\n s = subsets(arr - [arr.last])\n s + s.map { |el| el + [arr.last] }\nend",
"def subsets(arr)\n #base case(s)\n p arr\n return [arr] if arr.empty?\n # return [[], arr] if arr.length == 1\n #inductive step\n remaining_arr = subsets(arr[0...-1])\n remaining_arr + remaining_arr.map { |ele| ele + [arr.last] }\n # subsets(arr) + subsets(arr[0...-1])\nend",
"def subsets(nums)\n result = []\n subsets_helper(nums, [], result, 0)\n result\nend",
"def subsets(array)\n return [[]] if array.empty?\n\n val = array[0]\n subs = subsets(array.drop(1))\n new_subs = subs.map { |sub| sub + [val] }\n\n subs + new_subs\nend",
"def subsets(nums)\n return [[]] if nums.empty?\n first = nums[0]\n prev_subs = subsets(nums[1..-1])\n new_subs = prev_subs.map do |sub|\n sub + [first]\n end \n prev_subs + new_subs\nend",
"def subsets(array) # [1, 2], [1]\n return [[]] if array.length == 0\n # return [[], array ] if array.length == 1\n\n except_last = subsets(array[0...-1]) #subsets([1]), subsets([])\n combination = except_last.map { |ele| ele += [array[-1]]} #map subsets([1]) + [2], \n\n except_last + combination\nend",
"def subsets(array)\n return [[]] if array.empty?\n\n subs = subsets(array[0..-2])\n subs.concat(subs.map{|el| el += [array.last]})\nend",
"def subsets(array)\n return [[]] if array.empty?\n\n subs = subsets(array[0..-2])\n subs.concat(subs.map{|el| el += [array.last]})\nend",
"def subsets(array)\n return [[]] if array.empty?\n\n dupped = array.dup\n last = dupped.pop\n sets = subsets(dupped)\n\n subsets(dupped).each do |set|\n sets << (set << last)\n end\n\n sets\nend",
"def subsets(arr)\n res = [] \n if arr.length == 1 \n res << [] \n res << [arr[0]]\n return res \n elsif arr.empty?\n return [[]]\n end\n \n last = arr.pop \n old_set = subsets(arr)\n res = old_set\n \n res += old_set.map{ |i| i + [last] }\nend",
"def subsets(arr)\n return [[]] if arr.empty?\n\n val = arr[0]\n subs = subsets(arr.drop(1))\n new_subs = subs.map{ |sub| sub + val }\n\n subs + new_subs\nend",
"def subsets(arr)\n return [ [] ] if arr.empty?\n subs = subsets(arr.drop(1)) # [ [] ]\n return subs.concat(subs.map { |sub| [arr.first].concat(sub) })\nend",
"def subsets(nums)\n return [[]] if nums.empty?\n return [[],[nums.first]] if nums.size == 1\n [[], (0...nums.size).map {|x|\n [[nums[x]], subsets(nums[x + 1..-1]).map { |y| [nums[x]] + y }]\n }.flatten]\nend",
"def find_subsets(nums)\n\tsorted_nums = nums.sort()\n\n\tsubsets = []\n\tsubsets.append([])\n\n\tstart_index, end_index = 0, 0\n\n\tfor i in 0..(nums.length - 1)\n\t\tstart_index = 0\n\t\t0\n\t\t0\n\t\tif i > 0 and nums[i] == nums[i - 1]\n\t\t\tstart_index = end_index + 1\n\t\tend\n\n\t\tend_index = subsets.length - 1\n\t\t0\n\t\t1\n\t\tfor j in start_index..end_index\n\t\t\tsubset1 = Array.new(subsets[j])\n\t\t\t[]\n\t\t\t[]\n\t\t\tsubset1.append(nums[i])\n\t\t\t[1]\n\t\t[3]\n\t\t\tsubsets.append(subset1)\n\t\t\t[[],[1],[3]]\n\t\tend\n\tend\n\n\treturn subsets\nend",
"def array_subsets(arr)\n return arr if arr.length == 0 || arr.length == 1\n new_arr = []\n new_arr << [arr[0]] + array_subsets(arr[1..-1])\n \n # length = 1\n # new_arr = [[]]\n # while length <= arr.length\n # arr.each do |el|\n # new_arr << Array.new(length) { el }\n # end\n # length += 1\n # end\nend",
"def subsets(arr)\r\n comb = [] #set up return array\r\n\r\n for x in 0..arr.length do # gives a value from 0 to arr.length to pass below\r\n arr.combination(x) {|y| comb << y} # pushes to the return all of the possible combinations of the array\r\n end # the x insures that all possible lengths of combinations are returned.\r\n\r\n comb # returns all combinations\r\nend",
"def subsets(array)\n return [[]] if array == []\n\n sets = subsets(array[0...-1])\n sets + sets.map { |el| el += [array.last] }\nend",
"def array_subsets(arr)\n return [[]] if arr.empty?\n partial_subset = array_subsets(arr[0..-2])\n addition = partial_subset.map {|ele| ele + [arr[-1]]}\n partial_subset + addition\nend",
"def subsets(array)\n\n return [[]] if array == []\n all_but_last = subsets(array[0...array.length - 1].dup)\n last = array.last\n all_but_last.map { |el| el.dup } + all_but_last.map { |el| el << last }\nend",
"def subsets(arr)\n return [self] if arr.length == 1\n\n subs + subsets()\nend",
"def subsets(set)\n return [[]] if set == []\n \n res= [[]]\n \n 0.upto set.length-1 do |i|\n subsets(set[(i+1)..-1]).each do |subsubset|\n res << [set[i]] + subsubset\n end\n end\n \n res\nend",
"def subsets(arr)\n # return an empty array (tech a subset of an empty array) - base case\n return [[]] if arr.empty?\n # take out the last el\n last = arr[-1]\n # take all the other els\n # find all subsets don't have the last element\n subsets_without_last = subsets(arr[0...-1])\n # create an array with a combo of s (the el) & the last ele in arr\n # find all subsets that have the last element\n subsets_with_last = subsets_without_last.map { |s| s.dup << last }\n # merge with prior subsets\n # all subsets of arr either have the last element, or they don't.\n subsets_without_last + subsets_with_last\nend",
"def subsets(array)\n return [[]] if array.empty?\n subs = subsets(array[0..-2])\n subs += subs.map { |el| el += [array.last] }\n end",
"def subsets_of(array)\n 0.upto(array.length).flat_map { |n| array.combination(n).to_a }\n end",
"def subsets_iter(arr)\n new_arr = [[]]\n # byebug\n i = 0\n while i < arr.length\n# byebug\n ele1 = arr[i]\n new_arr << [ele1]\n\n if arr.length > 2\n sub_arr = [ele1]\n j = i + 1\n while j < arr.length\n # byebug\n ele2 = arr[j]\n sub_arr << ele2\n new_arr << sub_arr.dup\n sub_arr.pop\n j += 1\n end\n end\n i += 1\n end\n# byebug\n new_arr << arr unless arr.length < 2\n\n new_arr\nend",
"def subsets(arr, n = arr.size-1)\n #Heaps permutations\n @sol = [] if n == arr.size - 1\n\n if n == 0\n p arr\n @sol << arr\n return arr\n else\n (n+1).times do |i|\n p i\n subsets(arr,n-1)\n if( (n - 1) % 2 == 1)\n arr[1],arr[n] = arr[n],arr[1]\n else\n arr[i],arr[n] = arr[n],arr[i]\n end\n end\n end\nend",
"def powerset(array)\n subsets = [[]]\n\n array.each do |elem|\n (1..subsets.length - 1).each do |i|\n current_subset = subsets[i]\n subsets.append(current_subset + [elem])\n end\n end\n\n return subsets\nend",
"def subsets(arr)\n return [[]] if arr.empty?\n sub = subsets(arr[0...-1])\n newsub = sub.map { |ele| ele + [arr.last] } \n sub + newsub\n\n\n# sub + arr[-1]\nend",
"def subsets(set)\n return [[]] if set.empty?\n smaller_set = set.take(set.count-1)\n smaller_subsets = subsets(smaller_set)\n bigger_subsets = []\n smaller_subsets.each do |smaller_subset|\n bigger_subsets << smaller_subset + [set.last]\n end\n\n smaller_subsets + bigger_subsets\nend",
"def powerset(array)\n subsets = [[]]\n array.each { |element|\n for i in 0..subsets.length - 1\n current_subset = subsets[i]\n subsets << (current_subset + [element])\n end\n }\n return subsets\nend",
"def recursive_subsets(arr)\n return [[]] if arr.empty?\n last_el = arr.pop\n p sub_arr = recursive_subsets(arr)\n p last_el\n sub_arr += sub_arr.map { |el| el + [last_el] }\nend",
"def array_subsets(array)\n return [array] if array.empty?\n \nend",
"def subsets(ary)\n # base case\n return [[]] if ary.empty?\n\n # create subsets without the last element (smaller array)\n subs = subsets(ary.take(ary.length - 1))\n\n # adds the subs with the last element that was omitted.\n subs.concat( subs.map { |sub| sub + [ary.last] })\n\nend",
"def subsets(arr)\n # byebug\n return [arr] if arr.empty?\n\n if arr.length.odd?\n mid_idx = arr.length / 2\n else\n mid_idx = arr.length / 2 - 1\n end\n# byebug\n with_last = subsets(arr[1..-1])\n # byebug\n without_last = subsets(arr[0...-1])\n # byebug\n combined1 = subsets(arr[0...mid_idx] + arr[mid_idx + 1..-1])\n # combined2 = subsets(arr[0..mid_idx] + arr[mid_idx + 2..-1]) # this didn't work. still missing [1, 2, 4] with [1, 2, 3, 4] original input\n# byebug\n output = without_last + combined1 + with_last + [arr] # combined2\n output.uniq\nend",
"def fibs_rec(number, array=[1])\n\t\n\tif number>2 then array.push(array[-2]+array[-1]); \n\t\tfibs_rec(number-1, array);\n\telsif number==2\n\t\treturn [1,1]\n\tend\n\treturn array\nend",
"def subsets_2(nums, results = [], solution = [], current_idx = 0)\n results << solution.clone\n return if current_idx >= nums.length\n\n current_idx.upto(nums.length - 1) do |i|\n solution << nums[i]\n subsets(nums, results, solution, i + 1)\n solution.pop\n end\n\n results\nend",
"def powerset(array, index = nil)\n if index.nil?\n index = array.length - 1\n elsif index < 0\n return [[]]\n end\n\n ele = array[index]\n subsets = power(array, index - 1)\n (0..subsets.length - 1).each do |i|\n current_subset = subsets[i]\n subsets.append(current_subset + [ele])\n end\n\n subsets\nend",
"def subsets_3(nums, results = [], solution = [], current_idx = 0)\n results << solution.clone\n return if current_idx == nums.length\n\n nums[current_idx..-1].each_with_index do |num, i|\n solution << num\n subsets(nums, results, solution, current_idx + i + 1)\n solution.pop\n end\n\n results\nend",
"def powerset(array, idx = nil)\n if (idx == nil)\n idx = array.length - 1\n end\n if (idx < 0)\n return [[]]\n end\n element = array[idx]\n subsets = powerset(array, idx - 1)\n for i in 0..subsets.length - 1\n current_subset = subsets[i]\n subsets << current_subset + ([element])\n end\n return subsets\nend",
"def largest_contiguous_subsum(arr)\n subsets = []\n\n (0...arr.length).each do |idx1|\n (idx1...arr.length).each do |idx2|\n subsets << arr[idx1..idx2]\n end\n end \n\n largest_sum = subsets.first.sum\n\n subsets.each do |subset|\n if subset.sum > largest_sum\n largest_sum = subset.sum\n end\n end\n\n print subsets\nend",
"def sub_sum(list) #quadratic\n subsets = []\n i = 0\n while i < list.length\n j = i\n while j < list.length\n subsets << list[i..j].reduce(:+)\n j += 1\n end\n i += 1\n end\n subsets.sort.last\nend",
"def find_subarrays(nums_ary)\n subarrays = []\n last_index = nums_ary.size - 1\n 0.upto(last_index) do |start_index|\n start_index.upto(last_index) do |end_index|\n subarrays << nums_ary[start_index..end_index]\n end\n end\n subarrays.push([])\nend",
"def contig_sum(array)\n greatest_diff = -Float::INFINITY\n subsets = []\n\n i = 0\n while i < array.length\n j = i + 1\n while j <= array.length\n subsets << array[i..j]\n j += 1\n end\n i += 1\n end\n\n subsets.each do |arr|\n sum = arr.inject(:+)\n if sum > greatest_diff\n greatest_diff = sum\n end\n end\n greatest_diff\n\nend",
"def largest_sub_sum(array)\n subsets = []\n i = 0\n while i < array.length\n j = i\n while j < array.length\n subsets << array[i..j]\n j += 1\n end\n i += 1\n end\n result = nil\n subsets.map {|subset| subset.inject(:+)}.each do |sum|\n result = sum if result.nil? || result < sum\n end\n result\nend",
"def subsets_with_dup(nums)\n result = []\n nums.sort!\n subsets_helper(nums, [], result, 0, {})\n result\nend",
"def sub_arrays(arr)\n sub_arr = []\n i_arr = []\n arr.length.times do |x|\n arr.map do |ele1|\n i_arr += [ele1]\n sub_arr << i_arr\n end\n i_arr = []\n arr.shift\n end\n sub_arr\nend",
"def problem_2_build_fib_array(upper_limit)\n fib_array = [1,2]\n while fib_array.last < upper_limit\n next_fib = fib_array[-1] + fib_array[-2]\n fib_array << next_fib\n end\n fib_array.pop\n fib_array\nend",
"def find_unsorted_subarray(nums)\n \nend",
"def fibs_rec(n)\n case n\n when 0\n return []\n when 1\n return [0]\n when 2\n return [0,1]\n else\n array = fibs_rec(n-1)\n # offset to n-3 and n-2 to acccount for 0 position start\n array.push(array[n-3] + array[n-2])\n return array\n end\nend",
"def generate_n_sets(array, number_of_sets)\n\nend",
"def fibs_rec(n, fib_array=[0,1])\n return [0] if n == 1\n return fib_array if fib_array.length == n\n fib_array << fib_array[-1] + fib_array[-2]\n fibs_rec(n, fib_array)\nend",
"def fibs_rec(num)\n # base cases 0 and 1\n return [0] if num.zero?\n return [0, 1] if num == 1\n\n array = fibs_rec(num - 1)\n array << array[-2] + array[-1]\nend",
"def largest_contiguous_subsum(arr)\n subsets = [] \n\n (0...arr.length).each do |i| \n (i...arr.length).each do |j| \n subsets << arr[i..j]\n end \n end \n \n subsets.map {|sub| sub.sum}.max \nend",
"def fib(number)\n array = []\n if number == 0\n return array\n elsif number == 1\n array << 0\n return array\n elsif number == 2\n array << 0\n array << 1\n return array\n elsif number > 2\n index = 2\n array << 0\n array << 1\n while index < number\n array << array[index - 1] + array[index - 2]\n index += 1\n end\n return array\n end \nend",
"def fib(n) #n indicates # of elements we want in array\r\n a = 0\r\n b = 1\r\n fib_arr = []\r\n #loop starts iff n >= 1, but x starts from 0 (when n=1, x=0; n=2, x=0,1)\r\n n.times do |x| \r\n if x == 0\r\n fib_arr << a\r\n elsif x == 1\r\n fib_arr << b\r\n else\r\n c = a+b #c is the new fib # we are generating\r\n fib_arr << c\r\n a = b\r\n b = c\r\n end\r\n end\r\n return fib_arr\r\nend",
"def fibs_rec(n)\n\tarr = [0,1]\n\tif n == 1\n\t\treturn arr[0]\n\telsif n == 2\n\t\treturn arr\n\telse\n\t\tarr = fibs_rec(n-1)\n\t\tarr << arr[-1] + arr[-2]\n\tend\n\nend",
"def fibs(n, ary = [0,1])\n n.times { ary << ary[-2] + ary[-1] until ary.length == n }\n return ary\nend",
"def output_els_with_fib_index(arr)\n matching_els = []\n arr.each_with_index do |el, i|\n matching_els << el if is_fib?(i)\n end\n matching_els\nend",
"def find_sub(arr)\r\n sub_arrs = []\r\n (0...arr.size).each do |start_index|\r\n (1..arr.size - start_index). each do |length|\r\n sub_arrs << arr[start_index, length]\r\n end\r\n end\r\n sub_arrs\r\nend",
"def create_fibonacci(integer, array=[])\n\n return [] if integer <= 0\n\n array.size < 2 ? array << 1 : array << array[-2] + array[-1]\n\n if array.last >= integer\n array.pop\n return array\n end\n\n create_fibonacci(integer, array)\nend",
"def sub(array)\n arr = []\n array.each_index do |i|\n (i...array.length).each do |j|\n arr << array[i..j]\n end\n end\n arr \nend",
"def largest_contiguous_subsum1(array)\r\n subset = []\r\n array.each_index do |i| # make subets, store into 'subset' array\r\n (i...array.length).each do |j| # o(n^2)\r\n subset << array[i..j] # o(n^3) cause slicing\r\n end\r\n end\r\n\r\n subset_sum = []\r\n subset.each do |ele|\r\n subset_sum << ele.sum\r\n end\r\n subset_sum.max\r\nend",
"def fib(num)\n \n if num == 0\n return []\n \n elsif num == 1\n return [0]\n \n else\n start_array = [0, 1]\n while start_array.length < num\n start_array << (start_array[-1] + start_array[-2])\n end\n end\n return start_array\nend",
"def fibs_rec(n)\n if n == 1\n [0]\n elsif n == 2\n [0,1]\n else\n fibs_rec(n-1) << fibs_rec(n-1)[-1] + fibs_rec(n-1)[-2]\n end\nend",
"def each_subset(array)\n subsets_of(array).each {|subset| yield(subset)}\n end",
"def subarray(array)\n sum_to_index = {}\n i = 0\n sum = 0\n while i < array.length do\n sum += array[i]\n if sum_to_index[0]\n return [0, sum_to_index[0]]\n elsif sum_to_index[sum]\n return [sum_to_index[sum] + 1, i]\n else\n sum_to_index[sum] = i\n end\n i += 1\n end\nend",
"def sub_sum2(array)\n arr = []\n sum = 0\n array.each do |el|\n arr << [el] \n end\n array.each do |el|\n array.shift\n arr << array\n end\n # p arr\n result = 0\n arr.each do |set|\n if set.reduce(:+) > result\n result = set.reduce(:+)\n end \n end \n result\nend",
"def largest_con_sum(arr)\n subsets = []\n\n arr.each_index do |i|\n j = i\n until j >= arr.length\n subsets << arr[i..j]\n j += 1\n end\n end\n subsets.map { |arr| arr.reduce(&:+) }.max\nend",
"def find_limit(universe, subset)\n \n large_number = 10_000_000_000\n resource = universe + 1\n my_array = Array.new\n \n (0...universe).each do |value|\n my_array\n .push([value+1, value, 0])\n .push([value, value +1, 1])\n end\n p my_array if $PRINT_ARRAY\n \n (0...universe+1).each do |value|\n my_array.push([resource, value, 0])\n end\n p my_array if $PRINT_ARRAY\n \n subset.each do |value|\n my_array\n .push([value[0]-1,value[1], value[2]])\n .push([value[1],value[0]-1, -value[2]])\n end\n p my_array if $PRINT_ARRAY\n \n distribution = [large_number]*(universe+2)\n distribution[resource] = 0\n \n (0...universe+1).each do |value|\n my_array.each do |value|\n distribution[value[1]] = [distribution[value[1]], distribution[value[0]]+value[2]].min\n end\n end\n distribution[universe]-distribution[0]\nend",
"def fibonacci_index(array)\n fibonacci_sequence = create_fibonacci(array.size)\n new_array = array.select { |num| fibonacci_sequence.include?(array.index(num)) }\nend",
"def fib_rec(sequence_length)\n if sequence_length == 0\n return [0]\n elsif sequence_length == 1\n return [0,1]\n end\n\n return fib_rec(sequence_length - 1) << fib_rec(sequence_length - 1)[-1] + fib_rec(sequence_length - 2)[-1]\n\n\nend",
"def find_fibonaccis(limit)\n fib_array = []\n i = 1\n while i <= limit\n first_num = fib_array[i-1] ||= 1 # 1, \n second_num = fib_array[i] ||= 1 # 1, \n result = first_num + second_num\n if result > limit\n break\n end\n fib_array << result\n i += 1\n end\n fib_array\nend",
"def fib_it(n)\n fib_array = [1, 1]\n return fib_array if n == 2\n return [1] if n == 1\n\n (3..n).count { fib_array << fib_array[-2] + fib_array[-1] }\n\n fib_array\nend",
"def subarray_bitwise_o_rs(a)\n result_set = Set.new()\n a.size.times do |i|\n (1..a.size-i).each do |length|\n subarray = a[i, length]\n #puts subarray.inspect\n result = subarray.reduce(0) do |bor, elem|\n bor | elem\n end\n #puts result\n result_set << result\n end\n end\n result_set.size\nend",
"def common_subsets(array_one, array_two)\n\nend",
"def largest_contiguous_subsum(list)\n subsets = []\n (0...list.length).each do |idx1|\n (idx1...list.length).each do |idx2|\n subsets << list[idx1..idx2]\n end\n end\n\n #orignial [1,2,3]\n\n #[1]\n #[1,2]\n #[1,2,3]\n #[2]\n #[2,3]\n #[3]\n\n\n largest = subsets[0].sum\n subsets.each do |subset|\n largest = subset.sum if subset.sum > largest\n end\n\n largest\nend",
"def fib(number)\narray = []\n if number == 0\narray = []\n return array\n else \n number == 1\narray = [0, 1]\nend\n\nwhile array.length < number\narray[array.length] = array[-1] + array[-2]\nend\nreturn array\nend",
"def subset_in_array?(array, value)\n result = 1.upto(array.length).flat_map do |n|\n array.combination(n).to_a\n end\n result.include?(value)\nend",
"def fibs_rec!(num, ary)\n ary[0] = 0 if ary.empty?\n return 0 if num == 0\n return ary[1] = 1 if num == 1\n ary << next_fib_term = fibs_rec!(num - 1, ary) + fibs_rec!(num - 2, [])\n next_fib_term \nend"
] | [
"0.776742",
"0.7642401",
"0.7642401",
"0.7642401",
"0.7631329",
"0.7573406",
"0.7554579",
"0.7546825",
"0.75399023",
"0.7527767",
"0.7527104",
"0.7451045",
"0.7399227",
"0.7384727",
"0.73667353",
"0.7314229",
"0.72788465",
"0.7266725",
"0.7253151",
"0.72347283",
"0.7219942",
"0.7211239",
"0.7209214",
"0.72090757",
"0.71880555",
"0.7182078",
"0.71808225",
"0.7176728",
"0.7176728",
"0.71353996",
"0.7131461",
"0.71102977",
"0.71064365",
"0.7090346",
"0.70825386",
"0.7063112",
"0.702988",
"0.70211256",
"0.70093584",
"0.7003711",
"0.70032156",
"0.69448006",
"0.6940644",
"0.6929605",
"0.69263846",
"0.69126284",
"0.6881297",
"0.6824504",
"0.6792777",
"0.6790874",
"0.6711005",
"0.67069787",
"0.6702125",
"0.66692656",
"0.6661921",
"0.6647775",
"0.6624746",
"0.657288",
"0.6483622",
"0.63997144",
"0.63204116",
"0.63056123",
"0.62913734",
"0.62694776",
"0.62656844",
"0.6250651",
"0.6250435",
"0.6216174",
"0.6211605",
"0.61922085",
"0.61744905",
"0.6109275",
"0.6072669",
"0.6058111",
"0.6047357",
"0.6019023",
"0.60079515",
"0.5997667",
"0.5997239",
"0.5994923",
"0.59865403",
"0.59856516",
"0.598119",
"0.59808475",
"0.5975195",
"0.59729594",
"0.5961655",
"0.59495074",
"0.5940743",
"0.5940418",
"0.5932063",
"0.5911212",
"0.5906962",
"0.589323",
"0.58890194",
"0.5873978",
"0.5872578",
"0.5871623",
"0.58662194",
"0.58541167"
] | 0.7574405 | 5 |
subsets([1, 2, 3, 4, 5]) permutations from solutions, but rework later | def permutations(array)
return [array] if array.length <= 1
first = array.shift
perms = permutations(array)
total_permutations = []
perms.each do |perm|
(0..perm.length).each do |i|
total_permutations << perm[0...i] + [first] + perm[i..-1]
end
end
total_permutations
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subsets(arr)\r\n comb = [] #set up return array\r\n\r\n for x in 0..arr.length do # gives a value from 0 to arr.length to pass below\r\n arr.combination(x) {|y| comb << y} # pushes to the return all of the possible combinations of the array\r\n end # the x insures that all possible lengths of combinations are returned.\r\n\r\n comb # returns all combinations\r\nend",
"def subsets_3(nums, results = [], solution = [], current_idx = 0)\n results << solution.clone\n return if current_idx == nums.length\n\n nums[current_idx..-1].each_with_index do |num, i|\n solution << num\n subsets(nums, results, solution, current_idx + i + 1)\n solution.pop\n end\n\n results\nend",
"def subsets_2(nums, results = [], solution = [], current_idx = 0)\n results << solution.clone\n return if current_idx >= nums.length\n\n current_idx.upto(nums.length - 1) do |i|\n solution << nums[i]\n subsets(nums, results, solution, i + 1)\n solution.pop\n end\n\n results\nend",
"def subsets(nums)\n result = []\n subsets_helper(nums, [], result, 0)\n result\nend",
"def subsets_of(array)\n 0.upto(array.length).flat_map { |n| array.combination(n).to_a }\n end",
"def find_subsets(nums)\n\tsorted_nums = nums.sort()\n\n\tsubsets = []\n\tsubsets.append([])\n\n\tstart_index, end_index = 0, 0\n\n\tfor i in 0..(nums.length - 1)\n\t\tstart_index = 0\n\t\t0\n\t\t0\n\t\tif i > 0 and nums[i] == nums[i - 1]\n\t\t\tstart_index = end_index + 1\n\t\tend\n\n\t\tend_index = subsets.length - 1\n\t\t0\n\t\t1\n\t\tfor j in start_index..end_index\n\t\t\tsubset1 = Array.new(subsets[j])\n\t\t\t[]\n\t\t\t[]\n\t\t\tsubset1.append(nums[i])\n\t\t\t[1]\n\t\t[3]\n\t\t\tsubsets.append(subset1)\n\t\t\t[[],[1],[3]]\n\t\tend\n\tend\n\n\treturn subsets\nend",
"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 subsets(nums)\n return [[]] if nums.empty?\n return [[],[nums.first]] if nums.size == 1\n [[], (0...nums.size).map {|x|\n [[nums[x]], subsets(nums[x + 1..-1]).map { |y| [nums[x]] + y }]\n }.flatten]\nend",
"def subsets(array) # [1, 2], [1]\n return [[]] if array.length == 0\n # return [[], array ] if array.length == 1\n\n except_last = subsets(array[0...-1]) #subsets([1]), subsets([])\n combination = except_last.map { |ele| ele += [array[-1]]} #map subsets([1]) + [2], \n\n except_last + combination\nend",
"def subsets(set)\n return [[]] if set.empty?\n smaller_set = set.take(set.count-1)\n smaller_subsets = subsets(smaller_set)\n bigger_subsets = []\n smaller_subsets.each do |smaller_subset|\n bigger_subsets << smaller_subset + [set.last]\n end\n\n smaller_subsets + bigger_subsets\nend",
"def subsets_with_dup(nums)\n result = []\n nums.sort!\n subsets_helper(nums, [], result, 0, {})\n result\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 subsets(nums)\n return [[]] if nums.empty?\n first = nums[0]\n prev_subs = subsets(nums[1..-1])\n new_subs = prev_subs.map do |sub|\n sub + [first]\n end \n prev_subs + new_subs\nend",
"def combinations(n)\n \n end",
"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 # 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 subsets(arr)\n return [arr] unless arr.is_a?(Array)\n return [arr] if arr.empty?\n\n # return [arr] if arr.length == 1\n # first = arr.shift\n # all_subsets << subsets(first)\n # all_subsets << subsets(arr)\n\n # [[],[1]] << [2],[1,2] [each, last] << [last] [each,last]\n # subsets(arr-1) << subsets(arr)[-1]\n all_subsets = [[]]\n\n arr.each { |ele| all_subsets << [ele] }\n\n (0...(arr.length - 1)).each do |idx1|\n # all_subsets << [arr[idx1]] unless all_subsets.include?(arr[idx1])\n (1...arr.length).each do |idx2|\n if idx2 > idx1 && !all_subsets.include?(arr[idx2])\n # all_subsets << [arr[idx2]]\n all_subsets << arr[idx1..idx2]\n end\n end\n end\n\n all_subsets\nend",
"def subsets(set)\n return [[]] if set == []\n \n res= [[]]\n \n 0.upto set.length-1 do |i|\n subsets(set[(i+1)..-1]).each do |subsubset|\n res << [set[i]] + subsubset\n end\n end\n \n res\nend",
"def get_power_set_1(set)\n\t(0..set.length).map {|i| set.combination(i).to_a}.flatten(1)\nend",
"def subsets(array)\n return [[]] if array.empty?\n number = array.pop\n prev_subsets = subsets(array)\n new_subsets = []\n prev_subsets.each do |subset|\n new_subsets << ([number] + subset)\n end\n prev_subsets + new_subsets\nend",
"def subsets(arr)\n subsets_helper(result = [], temp = [], arr, 0)\nend",
"def better_solution_to_multiples\n set.to_a.combination(2) do |number, number1|\n remainder = TOTAL - number - number1\n\n if set.include?(remainder)\n puts remainder * number * number1\n break\n end\n end\n end",
"def find_subsets_of_points(options={})\n puts \"Calculating subsets\"\n puts \"Set of #{@points_amount} points: 2^#{@points_amount} subsets = #{2**@points_amount} different subsets\"\n @points_subsets = Array.new(@points_amount) { Array.new }\n # amount of all subsets of a set 2^n-1 (-1, as we're excluding the empty set {})\n (1..2**@points.length-1).each { |i|\n p i if i%100000 == 0\n subset_size = subset_size(i)\n if (options[:with_first_point_only] != true) || (options[:with_first_point_only] == true and i % 2 == 1)\n @points_subsets[subset_size-1] << i\n end\n }\n\n (2..@points_amount).each do |subset_size|\n subsets = @points_subsets[subset_size-1]\n puts \"Subset size: \" + subset_size.to_s + \"; Subsets total: \" + subsets.size.to_s\n end\n\n puts \"Done calculating subsets\"\n end",
"def powerset(array)\n subsets = [[]]\n\n array.each do |elem|\n (1..subsets.length - 1).each do |i|\n current_subset = subsets[i]\n subsets.append(current_subset + [elem])\n end\n end\n\n return subsets\nend",
"def subsets(arr)\n return [arr] if arr.empty?\nsubsets(arr[])\nend",
"def get_matrix_of_possibilities(problem_set)\n possibilities = []\n\n problem_set.item_prices.each do |price|\n possibilities << find_possible_quantities(price, problem_set.total)\n end\n\n possibilities = possibilities[0].product(*possibilities[1..-1])\n possibilities\n end",
"def generate_n_sets(array, number_of_sets)\n\nend",
"def subsets(arr)\n ans = [[]]\n arr.length.times do |id|\n id2 = id + 1\n ans << [arr[id]]\n while id2 < arr.length\n ans << arr[id..id2]\n id2 += 1\n end\n end\n ans\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 subsets(arr)\n return [arr] if arr.empty?\n out = []\n subsets(arr[1..-1]).each do |s|\n out << s\n out << [arr[0]] + s\n end\n out\nend",
"def subsets(array)\n if array.length <= 1\n return array\n end\n subset_array = []\n (0..array.length - 1).each do |i|\n subset_array << subsets(array[0...i]) << subsets(array[0...i]).concat([array[-1]])\n end\n return subset_array\nend",
"def get_permutations(n)\r\n return (1..n).to_a.permutation.to_a\r\nend",
"def subsets(arr, n = arr.size-1)\n #Heaps permutations\n @sol = [] if n == arr.size - 1\n\n if n == 0\n p arr\n @sol << arr\n return arr\n else\n (n+1).times do |i|\n p i\n subsets(arr,n-1)\n if( (n - 1) % 2 == 1)\n arr[1],arr[n] = arr[n],arr[1]\n else\n arr[i],arr[n] = arr[n],arr[i]\n end\n end\n end\nend",
"def subsets(array)\n\nend",
"def subsets(array)\n\nend",
"def subsets(array)\n\nend",
"def all_possible_answers\n [1,2,3,4,5,6].repeated_permutation(4).to_a\n end",
"def powerset(array)\n subsets = [[]]\n array.each { |element|\n for i in 0..subsets.length - 1\n current_subset = subsets[i]\n subsets << (current_subset + [element])\n end\n }\n return subsets\nend",
"def array_subsets(arr)\n return arr if arr.length == 0 || arr.length == 1\n new_arr = []\n new_arr << [arr[0]] + array_subsets(arr[1..-1])\n \n # length = 1\n # new_arr = [[]]\n # while length <= arr.length\n # arr.each do |el|\n # new_arr << Array.new(length) { el }\n # end\n # length += 1\n # end\nend",
"def generate_combinations( n )\n\t# => since the first combination will replace ALL digits and the last one\n\t# => won't replace anything both won't be necessary\n\treturn [ true, false ].repeated_permutation( n ).to_a[ 1..-2 ]\nend",
"def subsets(array)\n return [[]] if array.empty?\n subs = array[0...-1]\n smaller_subs = subsets(subs)\n bigger_subs = []\n smaller_subs.each do |sub|\n bigger_subs << sub + [array[-1]]\n end\n smaller_subs + bigger_subs\nend",
"def subsets (arr)\n return [[]] if arr.length == 0\n\n interim = subsets(arr[0...-1])\n interim + interim.map do |el|\n el + [arr[-1]]\n end\nend",
"def skittle_combos(skittles)\n skittles.combination(2).map(&:sort).uniq\nend",
"def subsets(arr)\n return [arr] if arr.empty?\n # p arr\n # if arr.length == 1\n # return subsets(arr[0...0]) + [arr]\n # end\n\n arr.each {|ele| subsets(arr -[ele]) } + [arr]\nend",
"def combos\n first.product(*tail)\n end",
"def subsets(array)\n return [[]] if array.empty?\n\n dupped = array.dup\n last = dupped.pop\n sets = subsets(dupped)\n\n subsets(dupped).each do |set|\n sets << (set << last)\n end\n\n sets\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 permutations(array)\n \nend",
"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 subsets(arr)\n res = [] \n if arr.length == 1 \n res << [] \n res << [arr[0]]\n return res \n elsif arr.empty?\n return [[]]\n end\n \n last = arr.pop \n old_set = subsets(arr)\n res = old_set\n \n res += old_set.map{ |i| i + [last] }\nend",
"def find_subsets(arr, target_value)\n rec(arr, target_value, arr.length - 1)\nend",
"def multipleSet(n)\n return (n..99).step(n).to_a.to_set\nend",
"def mixed_combinations\n combination_generator.mixed_combinations\n end",
"def all_combinations(ingredients, total_to_allocate = 100)\n first_ingredient = ingredients.first\n remaining_ingredients = ingredients[1..-1]\n\n if remaining_ingredients.any?\n (0..total_to_allocate).flat_map do |tbsp|\n all_combinations(\n remaining_ingredients,\n total_to_allocate - tbsp\n ).flat_map do |rmc|\n rmc.merge({ first_ingredient => tbsp })\n end\n end\n else\n [{ first_ingredient => total_to_allocate }]\n end\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 permute_unique(nums, solution = [], results = [], visited_indices = {}, found = {}, start = 0)\n\n # if solution.size == nums.size && !found[solution]\n # found[solution] = 1\n # return results << solution.clone\n # end\n\n return results << solution.clone if solution.size == nums.size\n\n (0...nums.length).each do |idx|\n next if nums[idx] == nums[idx - 1] && idx != start\n\n next if visited_indices[idx]\n visited_indices[idx] = 1\n solution << nums[idx]\n\n permute_unique(nums, solution, results, visited_indices, found, idx + 1)\n\n visited_indices.delete(idx)\n solution.pop\n end\n results\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 get_power_set_2(set)\n\treturn [[]] if set.empty?\n\n\tnum = set.pop\n\tprevious_subsets = get_power_set_2(set)\n\n\tprevious_subsets.map do |subset|\n\t\t[subset.dup.push(num), subset]\n\tend.flatten(1)\n\nend",
"def permutation (array)\n# yields permutation set WITH duplicates\nend",
"def combos\n result = []\n radixs = reverse.map(&:size)\n inject(1){|r, i| r * i.size}.times{ |step|\n result << foldr(lambda{ |i, r|\n radix = radixs[r.size]\n r.unshift i[step % radix]\n step /= radix unless radix.nil?\n r\n }, [])\n }\n result\n end",
"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 permutations(base, result = [])\n base = base.dup\n base.empty? ? [result] : base.shift.map { |value| permutations(base, result + [value]) }.flatten(1)\n end",
"def all_the_choices\n solution_pool_temp = []\n for i in 0..5\n for j in 0..5\n for k in 0..5\n for l in 0..5\n solution_pool_temp.push([COLOR_CHOICES[i], COLOR_CHOICES[j], COLOR_CHOICES[k], COLOR_CHOICES[l]])\n end\n end\n end\n end\n solution_pool_temp\n end",
"def permutations(array)\n\nend",
"def permutations(array)\n\nend",
"def permutations(array)\n\nend",
"def permutations(array)\n\nend",
"def subsets(array)\n if array.empty?\n return [[]]\n end\n\n el = array.shift[0]\n old_subsets = subsets(array)\n new_subsets = old_subsets.map { |old_subset| [el] + old_subset }\n new_subsets + old_subsets\nend",
"def subsets(arr)\n return [[]] if arr.empty?\n s = subsets(arr - [arr.last])\n s + s.map { |el| el + [arr.last] }\nend",
"def number_permutations(number)\n permutations = []\n\n [3, 4, 5, 6, 7, 10].each do |pattern|\n permutations << split_in_two(number, pattern)\n end\n [[3, 3], [3, 4], [4, 3]].each do |pattern|\n permutations << split_in_three(number, pattern.first, pattern.last)\n end\n\n permutations\n end",
"def powerset(array, index = nil)\n if index.nil?\n index = array.length - 1\n elsif index < 0\n return [[]]\n end\n\n ele = array[index]\n subsets = power(array, index - 1)\n (0..subsets.length - 1).each do |i|\n current_subset = subsets[i]\n subsets.append(current_subset + [ele])\n end\n\n subsets\nend",
"def q(a);a.permutation;end",
"def subsets(arr)\n return [arr] if arr.empty?\n prev = subsets(arr[0..-2]) \n next_one = []\n prev.each { |sub| next_one << sub + [arr[-1]] }\n return prev + next_one\nend",
"def subsets_iter(arr)\n new_arr = [[]]\n # byebug\n i = 0\n while i < arr.length\n# byebug\n ele1 = arr[i]\n new_arr << [ele1]\n\n if arr.length > 2\n sub_arr = [ele1]\n j = i + 1\n while j < arr.length\n # byebug\n ele2 = arr[j]\n sub_arr << ele2\n new_arr << sub_arr.dup\n sub_arr.pop\n j += 1\n end\n end\n i += 1\n end\n# byebug\n new_arr << arr unless arr.length < 2\n\n new_arr\nend",
"def answer(input_nums)\n [2,3].each do |set_size|\n all_combinations = input_nums.combination(set_size)\n\n target_set = all_combinations.to_a.find do |x|\n x.sum == 2020\n end\n\n puts \"Answer for set size #{set_size} is #{target_set.reduce(:*)}\"\n end\nend",
"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 subsets(arr)\n #base case(s)\n p arr\n return [arr] if arr.empty?\n # return [[], arr] if arr.length == 1\n #inductive step\n remaining_arr = subsets(arr[0...-1])\n remaining_arr + remaining_arr.map { |ele| ele + [arr.last] }\n # subsets(arr) + subsets(arr[0...-1])\nend",
"def subsets(arr)\n return [[]] if arr.empty?\n\n val = arr[0]\n subs = subsets(arr.drop(1))\n new_subs = subs.map{ |sub| sub + val }\n\n subs + new_subs\nend",
"def combinations_to(elements, k)\n result = []\n (1..k).each do |i|\n result |= combinations(elements, i)\n end\n result << []\n result\n end",
"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 recursive_subsets(arr)\n return [[]] if arr.empty?\n last_el = arr.pop\n p sub_arr = recursive_subsets(arr)\n p last_el\n sub_arr += sub_arr.map { |el| el + [last_el] }\nend",
"def all_choices_from(arrs) \n max_index = arrs.map { |x| x.size }.max - 1\n\n generate_power_set_of_size((0..max_index).to_a, arrs.size) do |indexes|\n next_set = []\n\n skip = false\n\n indexes.each_with_index do |j, i|\n v = arrs[i][j]\n skip ||= v.nil?\n next_set << v\n end\n\n yield next_set unless skip\n end\n end",
"def subsets(arr)\n return [[]] if arr.empty?\n\n last_el = arr.last\n results = []\n\n\n subsets(arr[0..-2]).each do |el|\n sub_arr = el << last_el\n results << sub_arr\n end\n\n subsets(arr[0..-2]) + results\nend",
"def generate_combos(n, item1, item2, item3, u1, u2, u3)\n used = []\n success = 0\n while (success < n)\n new_triplet = make_triplet(item1, item2, item3)\n if (triplet_included(new_triplet, used))\n # do nothing\n else\n success += 1\n used.push(new_triplet)\n end\n end\n end",
"def combinations(num_digits)\n combos = []\n (1..num_digits).each do |len|\n combos += (0...num_digits).to_a.combination(len).to_a\n end\n combos\nend",
"def recompute_recursive_subsets\n @recursive_subsets = subsets.inject(ValueSet.new) do |set, child|\n set.merge(child.recursive_subsets)\n end\n if parent\n parent.recompute_recursive_subsets\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 PermutationStep(num)\n possibilities = []\n possibilities = num.to_s.chars.map(&:to_i).permutation.to_a\n possibilities.reject! {|comb| comb.join.to_i <= num}\n possibilities.map! {|comb| comb.join.to_i}\n possibilities.empty? ? -1 : possibilities.min\nend",
"def array_subsets(arr)\n return [[]] if arr.empty?\n partial_subset = array_subsets(arr[0..-2])\n addition = partial_subset.map {|ele| ele + [arr[-1]]}\n partial_subset + addition\nend",
"def permute(nums)\n result = []\n permute_helper(nums, [], result)\n result\nend",
"def find_combinations(source, selection_size)\n\t#RubyProf.start\n\tcombinations = []\n\tlen = 2 ** source.size - 1\n\t(1..len).each do |number| # each number 1..n\n\t\tselection = []\n\t\t(0..source.size).each do |ix| # each bit\n\t\t\tif selection.size <= selection_size\n\t\t\t\tselection << source[ix] if number & ( 1 << ix ) > 0\n\t\t\tend\n\t\tend\n\t\tcombinations << selection if !selection.empty? && selection.size == selection_size\n\tend\n\t#puts RubyProf::FlatPrinter.new(RubyProf.stop).print(STDOUT)\n\tcombinations\nend",
"def subsets(arr)\n return [ [] ] if arr.empty?\n subs = subsets(arr.drop(1)) # [ [] ]\n return subs.concat(subs.map { |sub| [arr.first].concat(sub) })\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(string)\n string.chars.permutation(string.length).map(&:join).uniq\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 subsets(array)\n return [[]] if array.empty?\n\n subs = subsets(array[0..-2])\n subs.concat(subs.map{|el| el += [array.last]})\nend",
"def subsets(array)\n return [[]] if array.empty?\n\n subs = subsets(array[0..-2])\n subs.concat(subs.map{|el| el += [array.last]})\nend",
"def subsets(arr)\n return [[]] if arr.empty?\n subsets_arr = []\n cur_el = arr[0]\n prior_subs = subsets(arr[1..-1])\n prior_subs.each do |subset|\n subsets_arr << subset.dup.push(cur_el)\n end\n subsets_arr + prior_subs\nend",
"def naive_non_divisible_subsets(s, k)\n modulos = s.map { |n| n % k }\n subsets = []\n \n i = 0\n while i < modulos.length\n subset = [modulos[i]]\n subsets_hash = Hash.new\n subsets_hash[modulos[i]] = true\n\n j = 0\n while j < modulos.length\n if i == j\n j += 1\n next\n else\n pair = k - modulos[j]\n if subsets_hash[pair].nil?\n subset << modulos[j]\n subsets_hash[modulos[j]] = true\n end\n j += 1\n end\n end\n\n subsets << subset\n i += 1\n end\n\n counts = subsets.map { |subset| subset.length }\n counts.max\nend",
"def permute(nums)\n result = []\n permute_helper(nums, [], result)\n result\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"
] | [
"0.7278352",
"0.7276052",
"0.70709395",
"0.7019749",
"0.70070785",
"0.6922254",
"0.6807237",
"0.6786557",
"0.67762256",
"0.67367136",
"0.6718677",
"0.67099756",
"0.6698847",
"0.6638068",
"0.66285825",
"0.6628188",
"0.6618909",
"0.6575037",
"0.65309405",
"0.6519524",
"0.6474446",
"0.641739",
"0.6414206",
"0.6409515",
"0.6392927",
"0.63844424",
"0.63791734",
"0.6344905",
"0.63421804",
"0.63261193",
"0.63217926",
"0.6313887",
"0.63112855",
"0.63091725",
"0.63091725",
"0.63091725",
"0.6294412",
"0.6275278",
"0.62746674",
"0.62469745",
"0.6242758",
"0.6216728",
"0.62087065",
"0.6194048",
"0.6182325",
"0.61817026",
"0.61753255",
"0.616451",
"0.6150807",
"0.6150342",
"0.61455774",
"0.6141203",
"0.6129506",
"0.61288446",
"0.6127514",
"0.612155",
"0.6106898",
"0.60944515",
"0.609157",
"0.60900515",
"0.60899353",
"0.608668",
"0.6084263",
"0.60813874",
"0.60813874",
"0.60813874",
"0.60813874",
"0.6052521",
"0.6045223",
"0.6039759",
"0.6036558",
"0.6030877",
"0.6028646",
"0.60032725",
"0.5986613",
"0.5966315",
"0.5962932",
"0.59592867",
"0.5958611",
"0.5925312",
"0.59247774",
"0.5920295",
"0.59171164",
"0.5908926",
"0.5897346",
"0.5884751",
"0.5880718",
"0.5874676",
"0.5868781",
"0.5868097",
"0.58670646",
"0.5856861",
"0.5856717",
"0.5855317",
"0.5850151",
"0.58463675",
"0.58463675",
"0.58405584",
"0.5836714",
"0.5836193",
"0.58293307"
] | 0.0 | -1 |
p permutations([1, 2, 3]) | def bsearch(array, target)
return nil unless array.include?(target)
middle = (array.length - 1) / 2
return middle if target == array[middle]
if target < array[middle]
bsearch(array[0...middle], target)
elsif target > array[middle]
middle + 1 + bsearch(array[(middle + 1)..-1], target)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permutations(array)\n \nend",
"def permutations(array)\n\nend",
"def permutations(array)\n\nend",
"def permutations(array)\n\nend",
"def permutations(array)\n\nend",
"def get_permutations(n)\r\n return (1..n).to_a.permutation.to_a\r\nend",
"def print_permutations_of(array) \n array.permutation.to_a.each do |element|\n puts element.join(\", \")\n end\n end",
"def q(a);a.permutation;end",
"def permutations(array)\n\treturn array.permutation\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 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(str)\nend",
"def p1\n perm \" 1 2 4 3 4 3 5 6 \"\nend",
"def permutation (array)\n# yields permutation set WITH duplicates\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(string)\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 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 permutations(a, i)\n if i == a.size \n puts to_decimal(a)\n gets\n return\n end\n\n for j in i..a.size-1\n a[j], a[i] = a[i], a[j]\n permutations(a, i + 1)\n a[j], a[i] = a[i], a[j]\n end\nend",
"def permutations(p)\r\n p.to_s.scan(/\\d/).permutation.map{|e| e.join}.sort\r\nend",
"def permutations(input)\n return [] if input.empty?\n [permute(0,input)].flatten\n end",
"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 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 # 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\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 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(str)\n permutation(str.chars)\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 permutations(perms, digits)\n\tcounts = Array.new(digits.size, 0)\n\t\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 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(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(n, r)\n result = factorial(n) / factorial(n - r)\n puts \"\\nP(#{n},#{r}) = #{result}\"\n end",
"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 permutations(string)\n permute(string, 0, string.length)\nend",
"def permutations(arr)\n return [arr] if arr.length <= 1\n\n [arr.last] + permutations(arr[0...-1])\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 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 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 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(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 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 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 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 permutations_of_array(a, k)\n a.permutation(k).to_a\nend",
"def permutations(string)\n string.chars.permutation(string.length).map(&:join).uniq\nend",
"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(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 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(string)\n string.chars.permutation.to_a.map(&:join).uniq\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(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 [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 #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 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 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 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 permute(nums)\n result = []\n permute_helper(nums, [], result)\n result\nend",
"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\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 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(string)\n string.chars.permutation(string.length).to_a.map { |arr| arr.join }.uniq\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 permute(nums)\n result = []\n permute_helper(nums, [], result)\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 [[]] 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(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 perms(arr)\n result = []\n all_perms(arr, 0, result)\nend",
"def permutations(gems = @gems)\n (1..gems.count).reduce(:*) || 1\n end",
"def permutations(arrays, i)\n if i == arrays.length then return [[]] end\n\n res_next = permutations(arrays, i + 1)\n res = []\n arrays[i].each do |x|\n res_next.each do |y|\n res << ([x] + y)\n end\n end\n return res\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 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 results = []\n\n 1000.times do \n premutation = array.shuffle\n results << array << premutation\n end\n\n results.uniq.sort\nend",
"def permutations(n,k)\n binding.pry\n return 1 if k==0\n return n if k==1\n return factorial(n) if k==n\n (((n-k+1)..n).inject(1) {|ac,v| ac * v})\n #factorial(x).quo(factorial(x-n))\n end",
"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(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 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 get_permutation(range, n)\r\n range.to_a.permutation.lazy.drop(n-1).first.join.to_i\r\nend",
"def permutations(paths)\n permutations = paths.map(&:downcase).map(&:all_permutations)\n permutations = permutations.flatten.sort_by(&:length).reverse\n permutations\nend",
"def permsol(str)\n str.chars.permutation.to_a.map(&:join).uniq \nend",
"def prmutation(num)\n factrl(num)\nend",
"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 perm(nums, i, result)\n return result << nums.dup if i == nums.size\n\n (i...nums.size).each do |j|\n nums[i], nums[j] = nums[j], nums[i]\n perm(nums, i + 1, result)\n nums[i], nums[j] = nums[j], nums[i]\n end\nend",
"def get_signed_permutations(n)\r\n numbers = (-n..n).to_a\r\n numbers.delete(0)\r\n perms = numbers.permutation(n).to_a\r\n perms = perms.select{|item| item.map{|subitem|subitem.abs()}.uniq.length == item.length}\r\n return perms.uniq\r\nend",
"def lexicPerm1(list)\n\tlex_perms = list.permutation(10).to_a\n\tputs lex_perms[1_000_000 - 1].join()\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 nth_permutation(number_of_permutations)\n\t\tpermutation_array = []\n\t\tnumber_of_permutations -= 1 # assuming we start from the first permutation rather than the zeroth\n\t\twhile lexographic_array.length > 0\n\t\t\tindex = number_of_permutations / (lexographic_array.length - 1).factorial\n\t\t\tnumber_of_permutations %= (lexographic_array.length - 1).factorial\n\t\t\tpermutation_array.push(lexographic_array.delete_at(index))\n\t\tend\n\t\tpermutation_array\n\tend",
"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 permutation(numbers,i)\n temp = numbers[i] #la variable temp prend la valeur de l'index courant\n numbers[i] = numbers[i+1] #l'index courant prend la valeur de l'index suivant\n numbers[i+1] = temp #l'index suivant prend la valeur de la variable temp\n return true #la fonction retourne vrai\nend",
"def permutations(n,k)\n return 1 if k==0\n return n if k==1\n return factorial(n) if k==n\n (((n-k+1)..n).inject(1) {|ac,v| ac * v})\n #factorial(x).quo(factorial(x-n))\n end",
"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 array_permutation(array)\n return array[0] if array.size == 1\n first = array.shift\n return first.product( array_permutation(array) )\nend",
"def permutations_with_dups(str)\n permutations(str).uniq\nend",
"def permute(words)\n return nil if words.nil?\n return [] if words.empty?\n\n pwords = []\n words.each do |w|\n list = w.chars.to_a.permutation.map(&:join)\n pwords.concat list\n end\n pwords\n end",
"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 combinations(n)\n \n end",
"def PermutationStep(num)\n possibilities = []\n possibilities = num.to_s.chars.map(&:to_i).permutation.to_a\n possibilities.reject! {|comb| comb.join.to_i <= num}\n possibilities.map! {|comb| comb.join.to_i}\n possibilities.empty? ? -1 : possibilities.min\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 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 permutation(str, n = str.length)\n if n == 1\n puts str\n else\n n.times do |i|\n str[i], str[n - 1] = str[n - 1], str[i] # swap str[i] with str[n-1]\n permutation(str, n - 1)\n str[i], str[n - 1] = str[n - 1], str[i]\n end\n end\nend"
] | [
"0.8296482",
"0.8218106",
"0.8218106",
"0.8218106",
"0.8218106",
"0.8009701",
"0.7900354",
"0.78121173",
"0.7800992",
"0.75673807",
"0.7543668",
"0.75414795",
"0.7497943",
"0.7489763",
"0.7423502",
"0.7410712",
"0.7303234",
"0.73013717",
"0.7279626",
"0.72430295",
"0.7224034",
"0.7185999",
"0.7164188",
"0.7160279",
"0.7157557",
"0.71359915",
"0.71343464",
"0.71322626",
"0.71304995",
"0.71057725",
"0.7098552",
"0.7088348",
"0.70609975",
"0.7045893",
"0.7032448",
"0.70321774",
"0.7027972",
"0.702093",
"0.70111096",
"0.7008175",
"0.69932556",
"0.69869334",
"0.6986676",
"0.6985391",
"0.6985317",
"0.69827855",
"0.6977462",
"0.69617337",
"0.69573194",
"0.6947259",
"0.6937104",
"0.69243634",
"0.69217896",
"0.69217575",
"0.69182295",
"0.6913925",
"0.6894195",
"0.6892518",
"0.6890583",
"0.6885585",
"0.68831414",
"0.68683296",
"0.6858713",
"0.6852287",
"0.6852277",
"0.6851946",
"0.683804",
"0.68267757",
"0.6823585",
"0.6797331",
"0.6783601",
"0.67590904",
"0.6758016",
"0.6756126",
"0.67468786",
"0.6734854",
"0.6726325",
"0.67233765",
"0.6714059",
"0.67013913",
"0.66986436",
"0.6698463",
"0.66629696",
"0.6642913",
"0.663271",
"0.66218734",
"0.6617736",
"0.66008055",
"0.65837914",
"0.6578543",
"0.65772223",
"0.65301937",
"0.6527241",
"0.65247285",
"0.65111643",
"0.65105754",
"0.6495709",
"0.6447977",
"0.6436401",
"0.643165",
"0.6429511"
] | 0.0 | -1 |
GET /cafeteria GET /cafeteria.json | def index
@cafeteria = Cafeterium.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end",
"def show\n @cervejaria = Cervejaria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cervejaria }\n end\n end",
"def show\n @causale = Causale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @causale }\n end\n end",
"def show\n @chaine = Chaine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chaine }\n end\n end",
"def show\n @cita = Cita.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cita }\n end\n end",
"def show\n @cerveja = Cerveja.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cerveja }\n end\n end",
"def show\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronia }\n end\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def show\n @cancha = Cancha.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cancha }\n end\n end",
"def show\n @caixa = Caixa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caixa }\n end\n end",
"def show\n @aactio = Aactio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aactio }\n end\n end",
"def show\n @auditoria = Auditoria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @auditoria }\n end\n end",
"def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end",
"def show\n @cinema = Cinema.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cinema }\n end\n end",
"def show\n @cegonha = Cegonha.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cegonha }\n end\n end",
"def show\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end",
"def show\n @aroma = Aroma.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aroma }\n end\n end",
"def show\n @cofi = Cofi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cofi }\n end\n end",
"def index\n render json: @fiestas\n end",
"def show\n @ca = Ca.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ca }\n end\n end",
"def show\n @areco = Areco.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @areco }\n end\n end",
"def show\n @vachana = Vachana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vachana }\n end\n end",
"def show\n @vachana = Vachana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vachana }\n end\n end",
"def show\n @anuncio = Anuncio.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @anuncio }\n end\n end",
"def show\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @oferta }\n end\n end",
"def show\n @colegiatura = Colegiatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegiatura }\n end\n end",
"def show\n @cadet = Cadet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cadet }\n end\n end",
"def show\n @arcone = Arcone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @arcone }\n end\n end",
"def show\n @coisa = Coisa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @coisa }\n end\n end",
"def show\n @periodo_academico = PeriodoAcademico.find(params[:id])\n\n render json: @periodo_academico\n end",
"def show\n @atracao = Atracao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @atracao }\n end\n end",
"def show\n @escola = Escola.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @escola }\n end\n end",
"def show\n @etnia = Etnia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etnia }\n end\n end",
"def show\n @ficha = Ficha.find(params[:id])\n \n respond_to do |format| \n format.html # show.html.erb\n format.json { render json: @ficha } \n end\n end",
"def show\n @campanha = Campanha.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @campanha }\n end\n end",
"def show\n @sabio = Sabio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sabio }\n end\n end",
"def show\n @futbolada = Futbolada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @futbolada }\n end\n end",
"def index\n @cofis = Cofi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cofis }\n end\n end",
"def show\n @accesorio = Accesorio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @accesorio }\n end\n end",
"def show\n @rua = Rua.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rua }\n end\n end",
"def show\n @anuncio= set_anuncio\n render json: @anuncio, status: :ok\n end",
"def show\n @pichanga = Pichanga.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @pichanga }\n end\n end",
"def show\n @acuerdo = Acuerdo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @acuerdo }\n end\n end",
"def index\n @acoes = Acao.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @acoes }\n end\n end",
"def index\n @cabines = Cabine.all\n render json: @cabines\n end",
"def index\n @campanhas = Campanha.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @campanhas }\n end\n end",
"def show\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ginasio }\n end\n end",
"def show\n @incucai = Incucai.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incucai }\n end\n end",
"def show\r\n @asistencia = Asistencia.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @asistencia }\r\n end\r\n end",
"def show\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aviso }\n end\n end",
"def show\n @tea = Tea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tea }\n end\n end",
"def show\n @tea = Tea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tea }\n end\n end",
"def show\n @filial = Filial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @filial }\n end\n end",
"def show\n @nabe = Nabe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nabe }\n end\n end",
"def show\n @corgi = Corgi.find(params[:id])\n respond_to do |format|\n format.html \n format.json { render json: @corgi }\n end \n end",
"def show\n @giang_vien = GiangVien.find(params[:id])\n\n respond_to do |format| \n format.json { render json: @giang_vien }\n end\n end",
"def show\n @craque = Craque.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json \n end\n end",
"def show\n @amplicon = Amplicon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @amplicon }\n end\n end",
"def show\n @aa = Aa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aa }\n end\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def show\n @aboutshetuan = Aboutshetuan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aboutshetuan }\n end\n end",
"def show\n @quiniela = Quiniela.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quiniela }\n end\n end",
"def show\n @capacidad = Capacidad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @capacidad }\n end\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def show\n @cuerpo = Cuerpo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cuerpo }\n end\n end",
"def show\n\trespond_to do |format|\n format.json { render json: @conta.to_json, status: :ok }\n end\n end",
"def show\n @assunto = Assunto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @assunto }\n end\n end",
"def index\n @familia = Familium.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @familia }\n end\n end",
"def show\n @guille = Guille.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guille }\n end\n end",
"def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end",
"def show\n @campanium = Campanium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @campanium }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def index\n @cfos = Cfo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cfos }\n end\n end",
"def show\n @chuyen = Chuyen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chuyen }\n end\n end",
"def show\n @apunte = Apunte.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apunte }\n end\n end",
"def index\n @videoconferencias = Videoconferencium.all\n render json: @videoconferencias\n end",
"def show\n @situacao_avaliacao = SituacaoAvaliacao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @situacao_avaliacao }\n end\n end",
"def show\n\n respond_to do |format|\n format.json { render json: @cage }\n end\n end",
"def show\n @lieu = Lieu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lieu }\n end\n end",
"def show\n @spaethi = Spaethi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spaethi }\n end\n end",
"def show\n @cue = Cue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cue }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render json: @maudio}\n end\n end",
"def index\n @appeals = @conference.appeals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @appeals }\n end\n end",
"def show\n @caballo = Caballo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caballo }\n end\n end",
"def index\n @anuncios = Anuncio.all\n render json: @anuncios, status: :ok\n end",
"def show\n @zayavka = Zayavka.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zayavka }\n end\n end",
"def new\n @cervejaria = Cervejaria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cervejaria }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tecnico }\n end\n end",
"def show\n @jamaat = Jamaat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jamaat }\n end\n end",
"def show\n render json: Alien.find(params[\"id\"])\n end",
"def show\n @asignatura = Asignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asignatura }\n end\n end",
"def show\n @asignatura = Asignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asignatura }\n end\n end",
"def index\n @ruas = Rua.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ruas }\n end\n end",
"def show\n @humanidades3 = Humanidades3.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @humanidades3 }\n end\n end",
"def show\n @bitacora = Bitacora.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bitacora }\n end\n end",
"def show\n @taf = Taf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taf }\n end\n end",
"def show\n @paise = Paise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paise }\n end\n end",
"def show\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @veiculo }\n end\n end",
"def show\r\n @imobiliaria = Imobiliaria.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.json { render json: @imobiliaria }\r\n end\r\n end"
] | [
"0.75647",
"0.70506305",
"0.68938243",
"0.68855804",
"0.6780552",
"0.6775602",
"0.6770315",
"0.67238694",
"0.66846067",
"0.66804296",
"0.6669971",
"0.6646032",
"0.65990245",
"0.6592552",
"0.6590905",
"0.65752727",
"0.65680426",
"0.65612596",
"0.6557963",
"0.6540947",
"0.65331936",
"0.65123576",
"0.65123576",
"0.6506242",
"0.6501691",
"0.649548",
"0.64720803",
"0.64537036",
"0.6450989",
"0.6440566",
"0.6430234",
"0.641982",
"0.6416663",
"0.6395537",
"0.6395409",
"0.6381335",
"0.6380007",
"0.63734204",
"0.6356228",
"0.63561887",
"0.6347251",
"0.6341649",
"0.6334674",
"0.63287336",
"0.6322951",
"0.6313911",
"0.6310327",
"0.63050234",
"0.63010216",
"0.6300492",
"0.62974674",
"0.62974674",
"0.6293703",
"0.6285647",
"0.62722576",
"0.6261753",
"0.62602407",
"0.62600255",
"0.6257859",
"0.62531006",
"0.6234339",
"0.62342936",
"0.6231508",
"0.6228567",
"0.6226869",
"0.6226596",
"0.62252915",
"0.62098706",
"0.62063354",
"0.6205268",
"0.62017566",
"0.62012064",
"0.62012064",
"0.62006843",
"0.6198384",
"0.619451",
"0.61934704",
"0.6192298",
"0.61920744",
"0.6191733",
"0.61915356",
"0.6183511",
"0.61797774",
"0.6179724",
"0.61769414",
"0.6175185",
"0.61706483",
"0.6170496",
"0.6169809",
"0.61691904",
"0.6165573",
"0.61600906",
"0.61600906",
"0.61587816",
"0.6151786",
"0.6143675",
"0.6138372",
"0.6133759",
"0.61327815",
"0.6130152"
] | 0.65449345 | 19 |
GET /cafeteria/1 GET /cafeteria/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end",
"def show\n @chaine = Chaine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chaine }\n end\n end",
"def show\n @cervejaria = Cervejaria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cervejaria }\n end\n end",
"def show\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronia }\n end\n end",
"def show\n @causale = Causale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @causale }\n end\n end",
"def show\n @cerveja = Cerveja.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cerveja }\n end\n end",
"def show\n @caixa = Caixa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caixa }\n end\n end",
"def show\n @cita = Cita.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cita }\n end\n end",
"def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end",
"def show\n @cancha = Cancha.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cancha }\n end\n end",
"def show\n @cofi = Cofi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cofi }\n end\n end",
"def show\n @aactio = Aactio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aactio }\n end\n end",
"def show\n @auditoria = Auditoria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @auditoria }\n end\n end",
"def show\n @cinema = Cinema.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cinema }\n end\n end",
"def show\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def show\n @cegonha = Cegonha.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cegonha }\n end\n end",
"def show\n @ca = Ca.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ca }\n end\n end",
"def show\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @oferta }\n end\n end",
"def show\n @anuncio = Anuncio.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @anuncio }\n end\n end",
"def show\n @aroma = Aroma.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aroma }\n end\n end",
"def show\n @coisa = Coisa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @coisa }\n end\n end",
"def show\n @areco = Areco.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @areco }\n end\n end",
"def show\n @colegiatura = Colegiatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegiatura }\n end\n end",
"def show\n @ficha = Ficha.find(params[:id])\n \n respond_to do |format| \n format.html # show.html.erb\n format.json { render json: @ficha } \n end\n end",
"def index\n render json: @fiestas\n end",
"def show\n @vachana = Vachana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vachana }\n end\n end",
"def show\n @vachana = Vachana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vachana }\n end\n end",
"def show\n @cadet = Cadet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cadet }\n end\n end",
"def show\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ginasio }\n end\n end",
"def show\n @atracao = Atracao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @atracao }\n end\n end",
"def show\n @escola = Escola.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @escola }\n end\n end",
"def show\n @periodo_academico = PeriodoAcademico.find(params[:id])\n\n render json: @periodo_academico\n end",
"def show\n @rua = Rua.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rua }\n end\n end",
"def show\n @humanidades3 = Humanidades3.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @humanidades3 }\n end\n end",
"def show\n @campanha = Campanha.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @campanha }\n end\n end",
"def show\n @sabio = Sabio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sabio }\n end\n end",
"def index\n @cafeteria = Cafeterium.all\n end",
"def show\n @arcone = Arcone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @arcone }\n end\n end",
"def show\n @etnia = Etnia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etnia }\n end\n end",
"def show\n @humanidades1 = Humanidades1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @humanidades1 }\n end\n end",
"def show\n @incucai = Incucai.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incucai }\n end\n end",
"def show\n @corgi = Corgi.find(params[:id])\n respond_to do |format|\n format.html \n format.json { render json: @corgi }\n end \n end",
"def show\n @futbolada = Futbolada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @futbolada }\n end\n end",
"def show\n @lieu = Lieu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lieu }\n end\n end",
"def show\n @campanium = Campanium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @campanium }\n end\n end",
"def index\n @cofis = Cofi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cofis }\n end\n end",
"def show\r\n @asistencia = Asistencia.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @asistencia }\r\n end\r\n end",
"def show\n @accesorio = Accesorio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @accesorio }\n end\n end",
"def show\n @giang_vien = GiangVien.find(params[:id])\n\n respond_to do |format| \n format.json { render json: @giang_vien }\n end\n end",
"def show\n @acuerdo = Acuerdo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @acuerdo }\n end\n end",
"def show\n @craque = Craque.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json \n end\n end",
"def show\n @quiniela = Quiniela.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quiniela }\n end\n end",
"def show\n @pichanga = Pichanga.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @pichanga }\n end\n end",
"def show\n @filial = Filial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @filial }\n end\n end",
"def show\n @jamaat = Jamaat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jamaat }\n end\n end",
"def show\n @cue = Cue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cue }\n end\n end",
"def show\n @amplicon = Amplicon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @amplicon }\n end\n end",
"def show\n @nabe = Nabe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nabe }\n end\n end",
"def show\r\n @imobiliaria = Imobiliaria.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.json { render json: @imobiliaria }\r\n end\r\n end",
"def show\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @veiculo }\n end\n end",
"def show\n @bitacora = Bitacora.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bitacora }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def index\n @campanhas = Campanha.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @campanhas }\n end\n end",
"def show\n @cuerpo = Cuerpo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cuerpo }\n end\n end",
"def show\n @assunto = Assunto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @assunto }\n end\n end",
"def show\n @guille = Guille.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guille }\n end\n end",
"def show\n @aa = Aa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aa }\n end\n end",
"def index\n @familia = Familium.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @familia }\n end\n end",
"def show\n @tea = Tea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tea }\n end\n end",
"def show\n @tea = Tea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tea }\n end\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tecnico }\n end\n end",
"def show\n @fluxomatricula = Fluxomatricula.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fluxomatricula }\n end\n end",
"def index\n @acoes = Acao.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @acoes }\n end\n end",
"def show\n render json: Alien.find(params[\"id\"])\n end",
"def show\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end",
"def show\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end",
"def show\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end",
"def show\n @chuyen = Chuyen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chuyen }\n end\n end",
"def show\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aviso }\n end\n end",
"def show\n @leito = Leito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leito }\n end\n end",
"def show\n @humanidades2 = Humanidades2.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @humanidades2 }\n end\n end",
"def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end",
"def index\n @cabines = Cabine.all\n render json: @cabines\n end",
"def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end",
"def show\n @capacidad = Capacidad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @capacidad }\n end\n end",
"def show\n\trespond_to do |format|\n format.json { render json: @conta.to_json, status: :ok }\n end\n end",
"def show\n @cerc = Cerc.find(params[:id])\n\n render json: @cerc\n end",
"def show\n @cake = Cake.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cake }\n end\n end",
"def show\n @asignatura = Asignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asignatura }\n end\n end",
"def show\n @asignatura = Asignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asignatura }\n end\n end",
"def show\n @anuncio= set_anuncio\n render json: @anuncio, status: :ok\n end",
"def show\n @spaethi = Spaethi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spaethi }\n end\n end",
"def show\n @caballo = Caballo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caballo }\n end\n end",
"def index\n @uchronias = Uchronia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronias }\n end\n end",
"def show\n @realiza = Realiza.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @realiza }\n end\n end",
"def show\n @fulcliente = Fulcliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fulcliente }\n end\n end",
"def show\n @cervejarium = Cervejarium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cervejarium }\n end\n end"
] | [
"0.7491183",
"0.6978278",
"0.6967292",
"0.6901161",
"0.6856197",
"0.68064713",
"0.6784394",
"0.6766664",
"0.6701423",
"0.67002946",
"0.66830736",
"0.6648445",
"0.6646943",
"0.66411",
"0.6620773",
"0.6606457",
"0.6598598",
"0.6594374",
"0.6590194",
"0.65894777",
"0.6558039",
"0.6557343",
"0.6527638",
"0.6515665",
"0.6514651",
"0.6497491",
"0.64940435",
"0.64940435",
"0.64893234",
"0.64680225",
"0.64668685",
"0.6460738",
"0.64448667",
"0.64425653",
"0.6439881",
"0.64345396",
"0.64290005",
"0.64203566",
"0.6416982",
"0.6415001",
"0.6412147",
"0.63926846",
"0.63920385",
"0.63900656",
"0.6387603",
"0.6377763",
"0.637768",
"0.6366226",
"0.63639265",
"0.6362671",
"0.63599527",
"0.6359586",
"0.6358531",
"0.63574404",
"0.63392264",
"0.6339078",
"0.633595",
"0.6332081",
"0.63266337",
"0.6326545",
"0.63255817",
"0.6324009",
"0.6321751",
"0.6321751",
"0.63215023",
"0.63181996",
"0.6317539",
"0.63102984",
"0.63084704",
"0.6302291",
"0.63007075",
"0.62975085",
"0.62975085",
"0.6292411",
"0.6290988",
"0.6288859",
"0.62882507",
"0.6285683",
"0.6276229",
"0.6276229",
"0.6276229",
"0.6275917",
"0.62727624",
"0.6272516",
"0.6268785",
"0.6257548",
"0.62569195",
"0.6255914",
"0.6252728",
"0.6251165",
"0.6250506",
"0.6244088",
"0.623841",
"0.623841",
"0.6231555",
"0.62298214",
"0.6228799",
"0.6226221",
"0.62255836",
"0.6225221",
"0.6215417"
] | 0.0 | -1 |
POST /cafeteria POST /cafeteria.json | def create
@cafeterium = Cafeterium.new(cafeterium_params)
respond_to do |format|
if @cafeterium.save
format.html { redirect_to @cafeterium, notice: 'Cafeterium was successfully created.' }
format.json { render action: 'show', status: :created, location: @cafeterium }
else
format.html { render action: 'new' }
format.json { render json: @cafeterium.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @oferta_academica = OfertaAcademica.new(params[:oferta_academica])\n\n if @oferta_academica.save\n render json: @oferta_academica, status: :created, location: @oferta_academica\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end",
"def create\n @auditoria = Auditoria.new(params[:auditoria])\n\n respond_to do |format|\n if @auditoria.save\n format.html { redirect_to @auditoria, :notice => 'Auditoria was successfully created.' }\n format.json { render :json => @auditoria, :status => :created, :location => @auditoria }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @auditoria.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @oferta_academica = OfertaAcademica.new(oferta_academica_params)\n\n respond_to do |format|\n if @oferta_academica.save\n format.html { redirect_to @oferta_academica, notice: 'Oferta academica was successfully created.' }\n format.json { render :show, status: :created, location: api_v1_oferta_academica_url(@oferta_academica) }\n else\n format.html { render :new }\n format.json { render json: @oferta_academica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @chaine = Chaine.new(params[:chaine])\n\n respond_to do |format|\n if @chaine.save\n format.html { redirect_to @chaine, notice: 'Chaine was successfully created.' }\n format.json { render json: @chaine, status: :created, location: @chaine }\n else\n format.html { render action: \"new\" }\n format.json { render json: @chaine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cervejaria = Cervejaria.new(params[:cervejaria])\n\n respond_to do |format|\n if @cervejaria.save\n format.html { redirect_to @cervejaria, notice: 'Cervejaria was successfully created.' }\n format.json { render json: @cervejaria, status: :created, location: @cervejaria }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cervejaria.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @aactio = Aactio.new(params[:aactio])\n\n respond_to do |format|\n if @aactio.save\n format.html { redirect_to @aactio, notice: 'Aactio was successfully created.' }\n format.json { render json: @aactio, status: :created, location: @aactio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @aactio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def creacion\n fiesta = Fiesta.new (params[:id])\n if Fiesta.save\n puts \"su fiesta a sido registrada\"\n else \n puts \"su fiesta no a sido registrada\"\n end\n render = json: fiesta \n end",
"def create\n @causale = Causale.new(params[:causale])\n\n respond_to do |format|\n if @causale.save\n format.html { redirect_to @causale, notice: 'Causale creata con successo.' }\n format.json { render json: @causale, status: :created, location: @causalo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @causale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @etnia = Etnia.new(params[:etnia])\n\n respond_to do |format|\n if @etnia.save\n format.html { redirect_to @etnia, notice: 'Etnia was successfully created.' }\n format.json { render json: @etnia, status: :created, location: @etnia }\n else\n format.html { render action: \"new\" }\n format.json { render json: @etnia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @uchronia = Uchronia.new(params[:uchronia])\n\n respond_to do |format|\n if @uchronia.save\n format.html { redirect_to @uchronia, notice: 'Uchronia was successfully created.' }\n format.json { render json: @uchronia, status: :created, location: @uchronia }\n else\n format.html { render action: \"new\" }\n format.json { render json: @uchronia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @taco = Taco.new(taco_params)\n\n respond_to do |format|\n if @taco.save\n format.html { redirect_to @taco, notice: 'Taco was successfully created.' }\n format.json { render :show, status: :created, location: @taco }\n else\n format.html { render :new }\n format.json { render json: @taco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n puts 'AQQQQQUUUUUUUIIIIII'\n json = ActiveSupport::JSON.decode(params[:pessoa])\n puts json\n @pessoa = Pessoa.new(json)\n # @address = Address.new(params[:address])\n\n # @client.addresses = @address\n\n respond_to do |format|\n if @pessoa.save\n format.html { redirect_to @pessoa, notice: 'Pessoa was successfully created.' }\n format.json { render json: @pessoa, status: :created, location: @pessoa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @saida = Saida.new(saida_params)\n\n respond_to do |format|\n if @saida.save\n format.html { redirect_to @saida, notice: 'Saida was successfully created.' }\n format.json { render :show, status: :created, location: @saida }\n else\n format.html { render :new }\n format.json { render json: @saida.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @etapa = Etapa.new(etapa_params)\n\n respond_to do |format|\n if @etapa.save\n format.html { redirect_to @etapa, notice: 'Etapa fue creada exitosamente.' }\n format.json { render :show, status: :created, location: @etapa }\n else\n format.html { render :new }\n format.json { render json: @etapa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @faixa_etarium = FaixaEtarium.new(faixa_etarium_params)\n\n respond_to do |format|\n if @faixa_etarium.save\n format.html { redirect_to @faixa_etarium, notice: 'Faixa etarium was successfully created.' }\n format.json { render :show, status: :created, location: @faixa_etarium }\n else\n format.html { render :new }\n format.json { render json: @faixa_etarium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cerveja = Cerveja.new(params[:cerveja])\n\n respond_to do |format|\n if @cerveja.save\n format.html { redirect_to @cerveja, notice: 'Cerveja was successfully created.' }\n format.json { render json: @cerveja, status: :created, location: @cerveja }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cerveja.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cinema = Cinema.new(params[:cinema])\n\n respond_to do |format|\n if @cinema.save\n format.html { redirect_to @cinema, :notice => 'Cinema was successfully created.' }\n format.json { render :json => @cinema, :status => :created, :location => @cinema }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cinema.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @quiniela = Quiniela.new(params[:quiniela])\n\n respond_to do |format|\n if @quiniela.save\n format.html { redirect_to @quiniela, notice: 'Quiniela was successfully created.' }\n format.json { render json: @quiniela, status: :created, location: @quiniela }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quiniela.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @quinto = Quinto.new(quinto_params)\n \n @quinto.anio = params[:anio]\n @quinto.mes = params[:mes]\n \n \n respond_to do |format|\n if @quinto.save\n format.html { redirect_to @quinto, notice: 'Quinto was successfully created.' }\n format.json { render :show, status: :created, location: @quinto }\n else\n format.html { render :new }\n format.json { render json: @quinto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @periodo_academico = PeriodoAcademico.new(params[:periodo_academico])\n\n if @periodo_academico.save\n render json: @periodo_academico, status: :created, location: @periodo_academico\n else\n render json: @periodo_academico.errors, status: :unprocessable_entity\n end\n end",
"def create\n @atracao = Atracao.new(params[:atracao])\n\n respond_to do |format|\n if @atracao.save\n format.html { redirect_to @atracao, :notice => 'Atracao was successfully created.' }\n format.json { render :json => @atracao, :status => :created, :location => @atracao }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @atracao.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @tapioca = Tapioca.new(tapioca_params)\n\n respond_to do |format|\n if @tapioca.save\n format.html { redirect_to @tapioca, notice: 'Tapioca was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tapioca }\n else\n format.html { render action: 'new' }\n format.json { render json: @tapioca.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cha = Cha.new(cha_params)\n\n respond_to do |format|\n if @cha.save\n format.html { redirect_to @cha, notice: 'Cha was successfully created.' }\n format.json { render :show, status: :created, location: @cha }\n else\n format.html { render :new }\n format.json { render json: @cha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asana = Asana.new(asana_params)\n\n respond_to do |format|\n if @asana.save\n format.html { redirect_to @asana, notice: 'Asana criado com sucesso.' }\n format.json { render :show, status: :created, location: @asana }\n else\n format.html { render :new }\n format.json { render json: @asana.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tea = Tea.new(params[:tea])\n\n respond_to do |format|\n if @tea.save\n format.html { redirect_to @tea, notice: 'Tea was successfully created.' }\n format.json { render json: @tea, status: :created, location: @tea }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pai = Pai.new(pai_params)\n\n respond_to do |format|\n if @pai.save\n format.html { redirect_to pais_path, notice: 'Pais creado existosamente.' }\n format.json { render :index, status: :created, location: @pai }\n else\n format.html { render :new }\n format.json { render json: @pai.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @anuncio = Anuncio.new(anuncio_params)\n\n if @anuncio.save\n render :show, status: :created, location: @anuncio\n else\n render json: @anuncio.errors, status: :unprocessable_entity\n end\n end",
"def create\n @azienda = Azienda.new(azienda_params)\n\n respond_to do |format|\n if @azienda.save\n format.html { redirect_to @azienda, notice: 'Azienda was successfully created.' }\n format.json { render :show, status: :created, location: @azienda }\n else\n format.html { render :new }\n format.json { render json: @azienda.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @caixa = Caixa.new(params[:caixa])\n\n respond_to do |format|\n if @caixa.save\n format.html { redirect_to @caixa, notice: 'Caixa was successfully created.' }\n format.json { render json: @caixa, status: :created, location: @caixa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @caixa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @agronomiaquimica = Agronomiaquimica.new(params[:agronomiaquimica])\n\n respond_to do |format|\n if @agronomiaquimica.save\n format.html { redirect_to @agronomiaquimica, notice: 'Agronomiaquimica was successfully created.' }\n format.json { render json: @agronomiaquimica, status: :created, location: @agronomiaquimica }\n else\n format.html { render action: \"new\" }\n format.json { render json: @agronomiaquimica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cautela = Cautela.new(cautela_params)\n\n respond_to do |format|\n if @cautela.save\n format.html { redirect_to \"/cautelas\", notice: 'A Cautela foi Criada Com Sucesso!' }\n format.json { render :show, status: :created, location: @cautela }\n else\n format.html { render :new }\n format.json { render json: @cautela.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @auditorio = Auditorio.new(auditorio_params)\n\n respond_to do |format|\n if @auditorio.save\n format.html { redirect_to @auditorio, notice: 'Auditorio was successfully created.' }\n format.json { render :show, status: :created, location: @auditorio }\n else\n format.html { render :new }\n format.json { render json: @auditorio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @causa = Causa.new(causa_params)\n\t\[email protected]_id = current_user.id\n\n respond_to do |format|\n if @causa.save\n format.html { redirect_to @causa, notice: 'Causa was successfully created.' }\n format.json { render :show, status: :created, location: @causa }\n else\n format.html { render :new }\n format.json { render json: @causa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @aa = Aa.new(params[:aa])\n\n respond_to do |format|\n if @aa.save\n format.html { redirect_to root_path , notice: '登録されました' }\n format.json { render json: @aa, status: :created, location: @aa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @aa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @anio = Anio.new(anio_params)\n\n respond_to do |format|\n if @anio.save\n format.html { redirect_to @anio, notice: 'Anio was successfully created.' }\n format.json { render :show, status: :created, location: @anio }\n else\n format.html { render :new }\n format.json { render json: @anio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @arqueo_caja = ArqueoCaja.new(arqueo_caja_params)\n\n respond_to do |format|\n if @arqueo_caja.save\n format.html { redirect_to @arqueo_caja, notice: 'Arqueo caja was successfully created.' }\n format.json { render :show, status: :created, location: @arqueo_caja }\n else\n format.html { render :new }\n format.json { render json: @arqueo_caja.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n pai = params[:pai] ? Conta.find_by_id(params[:pai]): nil\n @conta = Conta.new(nome: params[:nome], status: params[:status])\n @conta.pai = pai\n @conta.data_criacao = Time.now\n \n respond_to do |format|\n if @conta.save\n #format.html { redirect_to @conta, notice: 'Conta was successfully created.' }\n #format.json { render :show, status: :created, location: @conta }\n format.json { render json: @conta.to_json, status: :created }\n #@conta.to_json\n else\n #format.html { render :new }\n format.json { render json: @conta.errors, status: :unprocessable_entity } \n end\n end\n end",
"def create\n @asignatura = Asignatura.new(asignatura_params)\n\n respond_to do |format|\n if @asignatura.save\n format.json { render json: \"Asignatura Creada\", status: :created, location: @asignatura }\n else\n format.json { render json: @asignatura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pichanga = Pichanga.new(params[:pichanga])\n\n respond_to do |format|\n if @pichanga.save\n format.html { redirect_to @pichanga, :notice => 'Pichanga was successfully created.' }\n format.json { render :json => @pichanga, :status => :created, :location => @pichanga }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @pichanga.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @cancha = Cancha.new(params[:cancha])\n\n respond_to do |format|\n if @cancha.save\n format.html { redirect_to @cancha, notice: 'Cancha was successfully created.' }\n format.json { render json: @cancha, status: :created, location: @cancha }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cancha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @viaje = Viaje.new(viaje_params)\n\n respond_to do |format|\n if @viaje.save\n format.html { redirect_to @viaje, notice: 'Viaje was successfully created.' }\n format.json { render :show, status: :created, location: @viaje }\n else\n format.html { render :new }\n format.json { render json: @viaje.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @foca = Foca.new(foca_params)\n\n respond_to do |format|\n if @foca.save\n format.html { redirect_to @foca, notice: 'Foca criada com sucesso.' }\n format.json { render :show, status: :created, location: @foca }\n else\n format.html { render :new }\n format.json { render json: @foca.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @apertura_caja = AperturaCaja.new(apertura_caja_params)\r\n\r\n respond_to do |format|\r\n if @apertura_caja.save\r\n format.html { redirect_to @apertura_caja, success: 'La caja se ha abierto correctamente.' }\r\n format.json { render :show, status: :created, location: @apertura_caja }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @apertura_caja.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @falta = Falta.new(falta_params)\n\n respond_to do |format|\n if @falta.save\n format.html { redirect_to @falta, notice: \"Falta was successfully created.\" }\n format.json { render :show, status: :created, location: @falta }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @falta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @aliado = Aliado.new(aliado_params)\n\n respond_to do |format|\n if @aliado.save\n format.html { redirect_to @aliado, notice: 'Aliado was successfully created.' }\n format.json { render :show, status: :created, location: @aliado }\n else\n format.html { render :new }\n format.json { render json: @aliado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @spaethi = Spaethi.new(params[:spaethi])\n\n respond_to do |format|\n if @spaethi.save\n format.html { redirect_to @spaethi, notice: 'Spaethi was successfully created.' }\n format.json { render json: @spaethi, status: :created, location: @spaethi }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spaethi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @apoio = Apoio.new(apoio_params)\n\t\t\n\t\[email protected]_id = current_user.id\n\t\[email protected]_id = @causa.id\n\t\t\n\t\[email protected]\n\t\t\n\t\tredirect_to @causa\n #respond_to do |format|\n # if @apoio.save\n # format.html { redirect_to @apoio, notice: 'Apoio was successfully created.' }\n # format.json { render :show, status: :created, location: @apoio }\n # else\n # format.html { render :new }\n # format.json { render json: @apoio.errors, status: :unprocessable_entity }\n # end\n end",
"def create\n @academia = Academia.new(academia_params)\n\n respond_to do |format|\n if @academia.save\n format.html { redirect_to @academia, notice: 'Academia was successfully created.' }\n format.json { render :show, status: :created, location: @academia }\n else\n format.html { render :new }\n format.json { render json: @academia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @uva = Uva.new(uva_params)\n\n respond_to do |format|\n if @uva.save\n format.html { redirect_to @uva, notice: 'Uva was successfully created.' }\n format.json { render :show, status: :created, location: @uva }\n else\n format.html { render :new }\n format.json { render json: @uva.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @caixa = Caixa.new(caixa_params)\n\n respond_to do |format|\n if @caixa.save\n format.html { redirect_to @caixa, notice: 'Caixa was successfully created.' }\n format.json { render :show, status: :created, location: @caixa }\n else\n format.html { render :new }\n format.json { render json: @caixa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @aki = Aki.new(aki_params)\n\n respond_to do |format|\n if @aki.save\n format.html { redirect_to @aki, notice: 'Aki was successfully created.' }\n format.json { render :show, status: :created, location: @aki }\n else\n format.html { render :new }\n format.json { render json: @aki.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @campanha = Campanha.new(params[:campanha])\n\n respond_to do |format|\n if @campanha.save\n format.html { redirect_to @campanha, notice: 'Campanha was successfully created.' }\n format.json { render json: @campanha, status: :created, location: @campanha }\n else\n format.html { render action: \"new\" }\n format.json { render json: @campanha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @palabra = Palabra.new(params[:palabra])\n @palabra.significados = params[:significados] \n respond_to do |format|\n if @palabra.save\n format.html { redirect_to @palabra, notice: 'La palabra fue guardada correctamente.' }\n format.json { render json: @palabra, status: :created, location: @palabra }\n else\n format.html { render action: \"new\" }\n format.json { render json: @palabra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @okugai = Okugai.new(okugai_params)\n\n respond_to do |format|\n if @okugai.save\n format.html { redirect_to @okugai, notice: 'Okugai was successfully created.' }\n format.json { render :show, status: :created, location: @okugai }\n else\n format.html { render :new }\n format.json { render json: @okugai.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @objeto = Cita.new(cita_params)\n\n respond_to do |format|\n if @objeto.save\n format.html { redirect_to @objeto, notice: \"Cita was successfully created.\" }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @oferta = Oferta.new(params[:oferta])\n\n respond_to do |format|\n if @oferta.save\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully created.' }\n format.json { render :json => @oferta, :status => :created, :location => @oferta }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @taf = Taf.new(params[:taf])\n\n respond_to do |format|\n if @taf.save\n format.html { redirect_to @taf, notice: 'Taf was successfully created.' }\n format.json { render json: @taf, status: :created, location: @taf }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @saida = Saida.new(saida_params)\n\n respond_to do |format|\n if @saida.save\n format.html { redirect_to @saida, notice: 'Saida foi criado com sucesso.' }\n format.json { render :show, status: :created, location: @saida }\n else\n format.html { render :new }\n format.json { render json: @saida.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rua = Rua.new(params[:rua])\n\n respond_to do |format|\n if @rua.save\n format.html { redirect_to @rua, notice: 'Rua was successfully created.' }\n format.json { render json: @rua, status: :created, location: @rua }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rua.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ulica = Ulica.new(ulica_params)\n\n respond_to do |format|\n if @ulica.save\n format.html { redirect_to @ulica, notice: 'Ulica was successfully created.' }\n format.json { render :show, status: :created, location: @ulica }\n else\n format.html { render :new }\n format.json { render json: @ulica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pizza = Pizza.new(pizza_params)\n if @pizza.save\n ActionCable.server.broadcast 'pizzas', {}\n render json: @pizza\n else\n render json: @pizza.errors, status: :unprocessable_entity\n end\n end",
"def create\n @sabio = Sabio.new(params[:sabio])\n\n respond_to do |format|\n if @sabio.save\n format.html { redirect_to @sabio, notice: 'El Sabio a sido creado exitosamente.' }\n format.json { render json: @sabio, status: :created, location: @sabio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sabio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @osoba = Osoba.new(params[:osoba])\n\n if @osoba.save\n render json: @osoba, status: :created, location: @osoba\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def create\n @vachana = Vachana.new(params[:vachana])\n\n respond_to do |format|\n if @vachana.save\n format.html { redirect_to @vachana, notice: 'Vachana was successfully created.' }\n format.json { render json: @vachana, status: :created, location: @vachana }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vachana.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vachana = Vachana.new(params[:vachana])\n\n respond_to do |format|\n if @vachana.save\n format.html { redirect_to @vachana, notice: 'Vachana was successfully created.' }\n format.json { render json: @vachana, status: :created, location: @vachana }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vachana.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @accesorio = Accesorio.new(params[:accesorio])\n\n respond_to do |format|\n if @accesorio.save\n format.html { redirect_to @accesorio, notice: 'Accesorio was successfully created.' }\n format.json { render json: @accesorio, status: :created, location: @accesorio }\n else\n format.html { render \"new\" }\n format.json { render json: @accesorio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asignatura = Asignatura.new(params[:asignatura])\n\n respond_to do |format|\n if @asignatura.save\n format.html { redirect_to @asignatura, notice: 'Asignatura was successfully created.' }\n format.json { render json: @asignatura, status: :created, location: @asignatura }\n else\n format.html { render action: \"new\" }\n format.json { render json: @asignatura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @coisa = Coisa.new(params[:coisa])\n\n respond_to do |format|\n if @coisa.save\n format.html { redirect_to @coisa, :notice => 'Coisa was successfully created.' }\n format.json { render :json => @coisa, :status => :created, :location => @coisa }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @coisa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @eva = Eva.new(eva_params)\n\n respond_to do |format|\n if @eva.save\n format.html { redirect_to :back, notice: '✔ 評価が送信されました' }\n format.json { render :show, status: :created, location: @eva }\n else\n format.html { render :new }\n format.json { render json: @eva.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @chamado = Chamado.new(params[:chamado])\n\n respond_to do |format|\n if @chamado.save\n #fmt = '/chamados/%s.json'\n #response = fmt % [@chamado.id]\n format.html { redirect_to @chamado, notice: 'Chamado was successfully created.' }\n format.html { render json: @chamado, status: :created, location: @chamado }\n else\n format.html { render action: \"new\" }\n format.json { render json: @chamado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @musica = Musica.new(musica_params)\n\n respond_to do |format|\n if @musica.save\n format.html { redirect_to @musica, notice: 'Álbum publicada com sucesso!' }\n format.json { render :show, status: :created, location: @musica }\n else\n format.html { render :new }\n format.json { render json: @musica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cancha = Cancha.new(cancha_params)\n\n respond_to do |format|\n if @cancha.save\n format.html { redirect_to @cancha, notice: 'Cancha creado con exito' }\n format.json { render :show, status: :created, location: @cancha }\n else\n format.html { render :new }\n format.json { render json: @cancha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @nebulosa = Nebulosa.new(nebulosa_params)\n\n respond_to do |format|\n if @nebulosa.save\n format.html { redirect_to @nebulosa, notice: 'Nebulosa was successfully created.' }\n format.json { render :show, status: :created, location: @nebulosa }\n else\n format.html { render :new }\n format.json { render json: @nebulosa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @auditorium = @theatre.auditoria.new(params[:auditorium])\n\n respond_to do |format|\n if @auditorium.save\n format.html { redirect_to [:admin, @theatre, @auditorium], notice: 'Auditorium was successfully created.' }\n format.json { render json: @auditorium, status: :created, location: @auditorium }\n else\n format.html { render action: \"new\" }\n format.json { render json: @auditorium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"def create\n @keiyaku = Keiyaku.new(keiyaku_params)\n\n respond_to do |format|\n if @keiyaku.save\n format.html { redirect_to @keiyaku, notice: 'Keiyaku was successfully created.' }\n format.json { render :show, status: :created, location: @keiyaku }\n else\n format.html { render :new }\n format.json { render json: @keiyaku.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pacienti = Pacienti.new(pacienti_params)\n\n respond_to do |format|\n if @pacienti.save\n format.html { redirect_to @pacienti, notice: 'Pacienti was successfully created.' }\n format.json { render :show, status: :created, location: @pacienti }\n else\n format.html { render :new }\n format.json { render json: @pacienti.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @escola = Escola.new(params[:escola])\n\n respond_to do |format|\n if @escola.save\n format.html { redirect_to @escola, :notice => 'Escola was successfully created.' }\n format.json { render :json => @escola, :status => :created, :location => @escola }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @escola.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @theloaisach = Theloaisach.new(theloaisach_params)\n\n respond_to do |format|\n if @theloaisach.save\n format.html { redirect_to @theloaisach, notice: \"Theloaisach was successfully created.\" }\n format.json { render :show, status: :created, location: @theloaisach }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @theloaisach.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @azul = Azul.new(azul_params)\n\n respond_to do |format|\n if @azul.save\n format.html { redirect_to @azul, notice: 'Azul was successfully created.' }\n format.json { render :show, status: :created, location: @azul }\n else\n format.html { render :new }\n format.json { render json: @azul.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @alejandro = Alejandro.new(alejandro_params)\n\n respond_to do |format|\n if @alejandro.save\n format.html { redirect_to @alejandro, notice: 'Alejandro was successfully created.' }\n format.json { render :show, status: :created, location: @alejandro }\n else\n format.html { render :new }\n format.json { render json: @alejandro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @busca = Busca.new(busca_params)\n\n respond_to do |format|\n if @busca.save\n format.html { redirect_to @busca, notice: 'Busca was successfully created.' }\n format.json { render :show, status: :created, location: @busca }\n else\n format.html { render :new }\n format.json { render json: @busca.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ficha = Ficha.new(ficha_params)\n\n respond_to do |format|\n if @ficha.save\n format.html { redirect_to @ficha, notice: 'Ficha was successfully created.' }\n format.json { render :show, status: :created, location: @ficha }\n else\n format.html { render :new }\n format.json { render json: @ficha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ficha = Ficha.new(ficha_params)\n\n respond_to do |format|\n if @ficha.save\n format.html { redirect_to @ficha, notice: 'Ficha was successfully created.' }\n format.json { render :show, status: :created, location: @ficha }\n else\n format.html { render :new }\n format.json { render json: @ficha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tarefa = Tarefa.new(params[:tarefa])\n\n respond_to do |format|\n if @tarefa.save\n format.html { redirect_to @tarefa, notice: 'Tarefa was successfully created.' }\n format.json { render json: @tarefa, status: :created, location: @tarefa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tarefa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tiezi = Tiezi.new(params[:tiezi])\n\n respond_to do |format|\n if @tiezi.save\n format.html { redirect_to @tiezi, notice: 'Tiezi was successfully created.' }\n format.json { render json: @tiezi, status: :created, location: @tiezi }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tiezi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @campana = Campana.new(campana_params)\n\n respond_to do |format|\n if @campana.save\n format.html { redirect_to backoffice_campanas_path, notice: 'Campana creado con exito.' }\n format.json { render :show, status: :created, location: @campana }\n else\n format.html { render :new }\n format.json { render json: @campana.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cepa = Cepa.new(cepa_params)\n\n respond_to do |format|\n if @cepa.save\n format.html { redirect_to @cepa, notice: \"Cepa was successfully created.\" }\n format.json { render :show, status: :created, location: @cepa }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @cepa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @uni_aso = UniAso.new(uni_aso_params)\n\n respond_to do |format|\n if @uni_aso.save\n format.html { redirect_to @uni_aso, notice: 'Uni aso was successfully created.' }\n format.json { render :show, status: :created, location: @uni_aso }\n else\n format.html { render :new }\n format.json { render json: @uni_aso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @causal = Causal.new(causal_params)\n\n respond_to do |format|\n if @causal.save\n format.html { redirect_to @causal, notice: 'Causal was successfully created.' }\n format.json { render :show, status: :created, location: @causal }\n else\n format.html { render :new }\n format.json { render json: @causal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fabrica = Fabrica.new(fabrica_params)\n\n respond_to do |format|\n if @fabrica.save\n format.html { redirect_to @fabrica, notice: 'Fabrica was successfully created.' }\n format.json { render action: 'show', status: :created, location: @fabrica }\n else\n format.html { render action: 'new' }\n format.json { render json: @fabrica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tuiguang = Tuiguang.new(tuiguang_params)\n\n respond_to do |format|\n if @tuiguang.save\n format.html { redirect_to @tuiguang, notice: 'Tuiguang was successfully created.' }\n format.json { render :show, status: :created, location: @tuiguang }\n else\n format.html { render :new }\n format.json { render json: @tuiguang.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @conta = Conta.new(conta_params)\n\n # @conta.correntista = Correntista.find(params[:id])\n respond_to do |format|\n if @conta.save\n format.html { redirect_to correntista_conta_index_path, notice: 'Conta was successfully created.' }\n format.json { render :show, status: :created, location: @conta }\n else\n format.html { render :new }\n format.json { render json: @conta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @esjiaoben = Esjiaoben.new(esjiaoben_params)\n\n respond_to do |format|\n if @esjiaoben.save\n format.html { redirect_to @esjiaoben, notice: 'Esjiaoben was successfully created.' }\n format.json { render :show, status: :created, location: @esjiaoben }\n else\n format.html { render :new }\n format.json { render json: @esjiaoben.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sugerencia = Sugerencia.new(params[:sugerencia])\n\n respond_to do |format|\n if @sugerencia.save\n format.html { redirect_to @sugerencia, :notice => 'Sugerencia was successfully created.' }\n format.json { render :json => @sugerencia, :status => :created, :location => @sugerencia }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @sugerencia.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @cuisine = Cuisine.new(spice_params)\n\n if @cuisine.save\n render json: @cuisine, status: :created\n else\n render json: @cuisine.errors, status: :unprocessable_entity\n end\n end",
"def create\n @farmaceutico = Farmaceutico.new(farmaceutico_params)\n\n respond_to do |format|\n if @farmaceutico.save\n format.html { redirect_to @farmaceutico, notice: 'Farmaceutico was successfully created.' }\n format.json { render :show, status: :created, location: @farmaceutico }\n else\n format.html { render :new }\n format.json { render json: @farmaceutico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @daw_alianza = DawAlianza.new(daw_alianza_params)\n\n respond_to do |format|\n if @daw_alianza.save\n format.html { redirect_to @daw_alianza, notice: 'Daw alianza was successfully created.' }\n format.json { render :show, status: :created, location: @daw_alianza }\n else\n format.html { render :new }\n format.json { render json: @daw_alianza.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @accesorio = Accesorio.new(accesorio_params)\n\n respond_to do |format|\n if @accesorio.save\n format.html { redirect_to @accesorio, notice: 'Accesorio was successfully created.' }\n format.json { render :show, status: :created, location: @accesorio }\n else\n format.html { render :new }\n format.json { render json: @accesorio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @chamada = Chamada.new(chamada_params)\n\n respond_to do |format|\n if @chamada.save\n format.html { redirect_to @chamada, notice: 'Chamada was successfully created.' }\n format.json { render :show, status: :created, location: @chamada }\n else\n format.html { render :new }\n format.json { render json: @chamada.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7250657",
"0.6621574",
"0.6618546",
"0.65646803",
"0.6487049",
"0.63877565",
"0.63803977",
"0.6367475",
"0.63408524",
"0.6338208",
"0.62922406",
"0.62674403",
"0.6248319",
"0.62299573",
"0.6224079",
"0.6215595",
"0.62037885",
"0.62019455",
"0.61973596",
"0.61928076",
"0.61883014",
"0.6188137",
"0.6184192",
"0.6170887",
"0.61584234",
"0.6154862",
"0.6149371",
"0.6147449",
"0.614565",
"0.61439276",
"0.61418074",
"0.61339307",
"0.61260873",
"0.6124239",
"0.61223584",
"0.6120783",
"0.61156046",
"0.61102897",
"0.6106817",
"0.6096486",
"0.6093508",
"0.6092747",
"0.60888195",
"0.6083061",
"0.60693055",
"0.6068979",
"0.6066046",
"0.60648286",
"0.6062407",
"0.6061251",
"0.60533786",
"0.60446924",
"0.6034423",
"0.6033155",
"0.6031281",
"0.6031279",
"0.60245335",
"0.60235256",
"0.60233974",
"0.6019462",
"0.601943",
"0.6018412",
"0.6016885",
"0.6013121",
"0.6013121",
"0.60130876",
"0.6006145",
"0.60041344",
"0.600315",
"0.5998854",
"0.59986",
"0.5998307",
"0.5996157",
"0.5994893",
"0.59926075",
"0.59920657",
"0.59870595",
"0.5979842",
"0.5979671",
"0.5978328",
"0.59740496",
"0.59717184",
"0.5960584",
"0.5960584",
"0.59553146",
"0.5951548",
"0.59510654",
"0.5948491",
"0.5948436",
"0.59457433",
"0.5944569",
"0.594194",
"0.59412616",
"0.5939981",
"0.59381217",
"0.59364533",
"0.59364533",
"0.5933158",
"0.59320813",
"0.59266627"
] | 0.6549736 | 4 |
PATCH/PUT /cafeteria/1 PATCH/PUT /cafeteria/1.json | def update
respond_to do |format|
if @cafeterium.update(cafeterium_params)
format.html { redirect_to @cafeterium, notice: 'Cafeterium was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @cafeterium.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n if @oferta_academica.update(params[:oferta_academica])\n head :no_content\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end",
"def update\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n if @oferta.update_attributes(params[:oferta])\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n @caixa = Caixa.find(params[:id])\n\n respond_to do |format|\n if @caixa.update_attributes(params[:caixa])\n format.html { redirect_to @caixa, notice: 'Caixa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @caixa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tapioca.update(tapioca_params)\n format.html { redirect_to @tapioca, notice: 'Tapioca was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tapioca.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 put!\n request! :put\n end",
"def update\n @chaine = Chaine.find(params[:id])\n\n respond_to do |format|\n if @chaine.update_attributes(params[:chaine])\n format.html { redirect_to @chaine, notice: 'Chaine was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chaine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @bla = Bla.find(params[:id])\n\n respond_to do |format|\n if @bla.update_attributes(params[:bla])\n format.html { redirect_to @bla, :notice => 'Bla was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bla.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @aactio = Aactio.find(params[:id])\n\n respond_to do |format|\n if @aactio.update_attributes(params[:aactio])\n format.html { redirect_to @aactio, notice: 'Aactio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aactio.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(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\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 @atracao = Atracao.find(params[:id])\n\n respond_to do |format|\n if @atracao.update_attributes(params[:atracao])\n format.html { redirect_to @atracao, :notice => 'Atracao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @atracao.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @persona = Persona.find(params[:id])\n \n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.json { head :ok }\n else\n format.json { render :json => @persona.errors,\n :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 @cerveja = Cerveja.find(params[:id])\n\n respond_to do |format|\n if @cerveja.update_attributes(params[:cerveja])\n format.html { redirect_to @cerveja, notice: 'Cerveja was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cerveja.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n respond_to do |format|\n if @ficheiro.update(ficheiro_params)\n format.html { redirect_to @ficheiro, notice: 'File was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ficheiro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def update\n respond_to do |format|\n if @fabrica.update(fabrica_params)\n format.html { redirect_to @fabrica, notice: 'Fabrica was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fabrica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @caixa.update(caixa_params)\n format.html { redirect_to @caixa, notice: 'Caixa was successfully updated.' }\n format.json { render :show, status: :ok, location: @caixa }\n else\n format.html { render :edit }\n format.json { render json: @caixa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cautela.update(cautela_params)\n format.html { redirect_to @cautela, notice: 'Cautela atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cautela.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fucker = Fucker.find(params[:id])\n\n respond_to do |format|\n if @fucker.update_attributes(params[:fucker])\n format.json { head :no_content }\n else\n format.json { render json: @fucker.errors, status: :internal_server_error }\n end\n end\n end",
"def update\n @foam = Foam.find(params[:id])\n\n respond_to do |format|\n if @foam.update_attributes(params[:foam])\n format.html { redirect_to @foam, notice: 'Foam was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @foam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n if @specie.update_attributes(params[:specie])\n format.html { redirect_to @specie, notice: 'Specie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n @cervejaria = Cervejaria.find(params[:id])\n\n respond_to do |format|\n if @cervejaria.update_attributes(params[:cervejaria])\n format.html { redirect_to @cervejaria, notice: 'Cervejaria was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cervejaria.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @kela.update(kela_params)\n format.html { redirect_to @kela, notice: 'Kela was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kela.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @ficha = Ficha.find(params[:id])\n\n respond_to do |format|\n if @ficha.update_attributes(params[:ficha])\n format.html { redirect_to @ficha, notice: 'Ficha alterada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ficha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fluxomatricula = Fluxomatricula.find(params[:id])\n\n respond_to do |format|\n if @fluxomatricula.update_attributes(params[:fluxomatricula])\n format.html { redirect_to @fluxomatricula, notice: 'Fluxomatricula was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fluxomatricula.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n if @ginasio.update_attributes(params[:ginasio])\n format.html { redirect_to @ginasio, :flash => { :success => 'Dados do ginasio alterados com successo!' } }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @ginasio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @placa.update(placa_params)\n format.html { redirect_to @placa, notice: 'Placa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @placa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fascicle.update(fascicle_params)\n format.html { redirect_to @fascicle, notice: 'Fascicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fascicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @foca.update(foca_params)\n format.html { redirect_to @foca, notice: 'Foca atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @foca }\n else\n format.html { render :edit }\n format.json { render json: @foca.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @osoba = Osoba.find(params[:id])\n\n if @osoba.update(params[:osoba])\n head :no_content\n else\n render json: @osoba.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\n @sabio = Sabio.find(params[:id])\n\n respond_to do |format|\n if @sabio.update_attributes(params[:sabio])\n format.html { redirect_to @sabio, notice: 'El Sabio fue actualizado.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sabio.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 @apoio.update(apoio_params)\n format.html { redirect_to @apoio, notice: 'Apoio was successfully updated.' }\n format.json { render :show, status: :ok, location: @apoio }\n else\n format.html { render :edit }\n format.json { render json: @apoio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @coisa = Coisa.find(params[:id])\n\n respond_to do |format|\n if @coisa.update_attributes(params[:coisa])\n format.html { redirect_to @coisa, :notice => 'Coisa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @coisa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n if @colegio.update_attributes(params[:colegio])\n format.html { redirect_to @colegio, notice: 'El Colegio fue actualizado satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colegio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(cita_params)\n format.html { redirect_to @objeto, notice: \"Cita 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 @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 @areco = Areco.find(params[:id])\n\n respond_to do |format|\n if @areco.update_attributes(params[:areco])\n format.html { redirect_to @areco, notice: 'Areco was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @areco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @acao = Acao.find(params[:id])\n\n respond_to do |format|\n if @acao.update_attributes(params[:acao])\n format.html { redirect_to acao_url(@acao), notice: 'Acao atualizada.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @acao.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 update\n @escola = Escola.find(params[:id])\n\n respond_to do |format|\n if @escola.update_attributes(params[:escola])\n format.html { redirect_to @escola, :notice => 'Escola was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @escola.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n if @articulo.update_attributes(params[:articulo])\n format.html { redirect_to @articulo, notice: 'Articulo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @articulo.errors, status: :unprocessable_entity }\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 respond_to do |format|\n if @anio.update(anio_params)\n format.html { redirect_to @anio, notice: 'Anio was successfully updated.' }\n format.json { render :show, status: :ok, location: @anio }\n else\n format.html { render :edit }\n format.json { render json: @anio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @apologetic.update(apologetic_params)\n format.html { redirect_to @apologetic, notice: 'Apologetic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @apologetic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @quiniela = Quiniela.find(params[:id])\n\n respond_to do |format|\n if @quiniela.update_attributes(params[:quiniela])\n format.html { redirect_to @quiniela, notice: 'Quiniela was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quiniela.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n if @uchronia.update_attributes(params[:uchronia])\n format.html { redirect_to @uchronia, notice: 'Uchronia was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @uchronia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n if @articulo.update_attributes(params[:articulo])\n format.html { redirect_to @articulo, notice: 'Articulo se ha actualizado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @articulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @oferta_academica.update(oferta_academica_params)\n format.html { redirect_to @oferta_academica, notice: 'Oferta academica was successfully updated.' }\n format.json { render :show, status: :ok, location: api_v1_oferta_academica_url(@oferta_academica) }\n else\n format.html { render :edit }\n format.json { render json: @oferta_academica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Alien.update(params[\"id\"], params[\"alien\"])\n end",
"def update\n @tarefa = Tarefa.find(params[:id])\n\n respond_to do |format|\n if @tarefa.update_attributes(params[:tarefa])\n format.html { redirect_to @tarefa, notice: 'Tarefa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tarefa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @one = One.find(params[:id])\n\n respond_to do |format|\n if @one.update_attributes(params[:one])\n format.html { redirect_to @one, notice: 'One was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @one.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cake = Cake.find(params[:id])\n\n respond_to do |format|\n if @cake.update_attributes(params[:cake])\n format.html { redirect_to @cake, notice: 'Cake was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cake.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @chronicle = Chronicle.find(params[:id])\n\n respond_to do |format|\n if @chronicle.update_attributes(params[:chronicle])\n format.html { redirect_to @chronicle, notice: 'Chronicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chronicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @causale = Causale.find(params[:id])\n\n respond_to do |format|\n if @causale.update_attributes(params[:causale])\n format.html { redirect_to @causale, notice: 'Causale aggiornata con successo.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @causale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @foto = Foto.find(params[:id])\n\n respond_to do |format|\n if @foto.update_attributes(params[:foto])\n format.html { redirect_to @foto, notice: 'Foto was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @foto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @sivic_celula.update(sivic_celula_params)\r\n format.html { redirect_to @sivic_celula, notice: 'Registro alterado com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_celula.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @tea = Tea.find(params[:id])\n\n respond_to do |format|\n if @tea.update_attributes(params[:tea])\n format.html { redirect_to @tea, notice: 'Tea was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ocorrencia.update(ocorrencia_params)\n format.html { redirect_to @ocorrencia, notice: 'Ocorrencia was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ocorrencia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @caso.update_attributes(caso_params)\n format.html { redirect_to @caso, notice: 'Caso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @caso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipoapreensao.update(tipoapreensao_params)\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoapreensao.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 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 update\n respond_to do |format|\n if @taco.update(taco_params)\n format.html { redirect_to @taco, notice: 'Taco was successfully updated.' }\n format.json { render :show, status: :ok, location: @taco }\n else\n format.html { render :edit }\n format.json { render json: @taco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @taf = Taf.find(params[:id])\n\n respond_to do |format|\n if @taf.update_attributes(params[:taf])\n format.html { redirect_to @taf, notice: 'Taf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cautela.update(cautela_params)\n format.html { redirect_to \"/cautelas\", notice: 'A Cautela foi Editada Com Sucesso!' }\n format.json { render :show, status: :ok, location: @cautela }\n else\n format.html { render :edit }\n format.json { render json: @cautela.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cargo_eleicao = CargoEleicao.find(params[:id])\n\n respond_to do |format|\n if @cargo_eleicao.update_attributes(params[:cargo_eleicao])\n format.html { redirect_to @cargo_eleicao, notice: 'Cargo eleicao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cargo_eleicao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rotina.update(rotina_params)\n format.html { redirect_to rotinas_path, notice: 'Rotina atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rotina.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @telefon = Telefon.find(params[:id])\n @telefon.update_attributes(params[:telefon])\n respond_with(@telefon)\n end",
"def update\n respond_to do |format|\n if @solicitacoes_avaliacoes_servico.update(solicitacoes_avaliacoes_servico_params)\n format.html { redirect_to @solicitacoes_avaliacoes_servico, notice: 'Solicitacoes avaliacoes servico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @solicitacoes_avaliacoes_servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cha.update(cha_params)\n format.html { redirect_to @cha, notice: 'Cha was successfully updated.' }\n format.json { render :show, status: :ok, location: @cha }\n else\n format.html { render :edit }\n format.json { render json: @cha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vibe.update(vibe_params)\n format.html { redirect_to @vibe, notice: 'Vibe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vibe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @aroma = Aroma.find(params[:id])\n\n respond_to do |format|\n if @aroma.update_attributes(params[:aroma])\n format.html { redirect_to @aroma, notice: 'Aroma was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aroma.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @campana.update(campana_params)\n format.html { redirect_to backoffice_campanas_path, notice: 'Campana modificada con exito.' }\n format.json { render :show, status: :ok, location: @campana }\n else\n format.html { render :edit }\n format.json { render json: @campana.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 @spoofer = Spoofer.find(params[:id])\n\n respond_to do |format|\n if @spoofer.update_attributes(params[:spoofer])\n format.html { redirect_to @spoofer, notice: 'Spoofer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spoofer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fortune = Fortune.find(params[:id])\n\n respond_to do |format|\n if @fortune.update_attributes(params[:fortune])\n format.html { redirect_to @fortune, notice: 'Piosenka pozytywnie zaktualizowana.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fortune.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @jamaat = Jamaat.find(params[:id])\n\n respond_to do |format|\n if @jamaat.update_attributes(params[:jamaat])\n format.html { redirect_to @jamaat, notice: 'Jamaat was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jamaat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @etnia = Etnia.find(params[:id])\n\n respond_to do |format|\n if @etnia.update_attributes(params[:etnia])\n format.html { redirect_to @etnia, notice: 'Etnia was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @etnia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @giang_vien = GiangVien.find(params[:id])\n\n respond_to do |format|\n if @giang_vien.update_attributes(params[:giang_vien]) \n format.json { head :no_content }\n else \n format.json { render json: @giang_vien.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n activo = params[:lab_far][:activo]\n farmacia_id = session[:farmacia_id]\n id = params[:id]\n LabFar.where(laboratorio_id: id, farmacium_id:farmacia_id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def update\n @alumno = Alumno.find(params[:id])\n\n respond_to do |format|\n if @alumno.update_attributes(params[:alumno])\n head :no_content\n else\n render json: @alumno.errors, status: :unprocessable_entity\n end\n end\n end",
"def update\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.html { redirect_to personas_path, notice: 'Persona was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6631359",
"0.65522707",
"0.6487744",
"0.6462324",
"0.6413346",
"0.6405309",
"0.64001495",
"0.63958323",
"0.63838375",
"0.63707155",
"0.6347921",
"0.6342091",
"0.62983274",
"0.62928516",
"0.6286737",
"0.6283196",
"0.62810034",
"0.6268396",
"0.62418675",
"0.62286943",
"0.6214612",
"0.6203219",
"0.6187842",
"0.6185326",
"0.6181158",
"0.6174564",
"0.6172506",
"0.6164405",
"0.6156623",
"0.6152332",
"0.6139481",
"0.6137351",
"0.61252636",
"0.61156297",
"0.6107617",
"0.6106302",
"0.6105694",
"0.61031306",
"0.6100225",
"0.61001384",
"0.60928744",
"0.60856324",
"0.60833055",
"0.607972",
"0.6078684",
"0.60771",
"0.6071125",
"0.6071125",
"0.6070823",
"0.6069433",
"0.6068203",
"0.6065744",
"0.60647494",
"0.60639703",
"0.60591704",
"0.60591704",
"0.6054565",
"0.6054505",
"0.6053788",
"0.60505587",
"0.60492265",
"0.60465217",
"0.6046432",
"0.6043021",
"0.6041701",
"0.60413927",
"0.6039606",
"0.6036559",
"0.6033539",
"0.60284877",
"0.60251504",
"0.6020925",
"0.60206693",
"0.6017122",
"0.60164994",
"0.6016139",
"0.6013757",
"0.60117674",
"0.6007758",
"0.60020304",
"0.60009724",
"0.60005987",
"0.59996104",
"0.59978575",
"0.5994098",
"0.5992639",
"0.5988091",
"0.59873617",
"0.5985343",
"0.5984385",
"0.5983114",
"0.5981717",
"0.59769124",
"0.59757656",
"0.5974627",
"0.5974363",
"0.5971165",
"0.59707606",
"0.59692025",
"0.5967478"
] | 0.6308627 | 12 |
DELETE /cafeteria/1 DELETE /cafeteria/1.json | def destroy
@cafeterium.destroy
respond_to do |format|
format.html { redirect_to cafeteria_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @chaine = Chaine.find(params[:id])\n @chaine.destroy\n\n respond_to do |format|\n format.html { redirect_to chaines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @aactio = Aactio.find(params[:id])\n @aactio.destroy\n\n respond_to do |format|\n format.html { redirect_to aactios_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\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 @agronomiaquimica = Agronomiaquimica.find(params[:id])\n @agronomiaquimica.destroy\n\n respond_to do |format|\n format.html { redirect_to agronomiaquimicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @oferta_academica = OfertaAcademica.find(params[:id])\n @oferta_academica.destroy\n\n head :no_content\n end",
"def destroy\n @causale = Causale.find(params[:id])\n @causale.destroy\n\n respond_to do |format|\n format.html { redirect_to causali_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @auditoria = Auditoria.find(params[:id])\n @auditoria.destroy\n\n respond_to do |format|\n format.html { redirect_to auditorias_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @ficha = Ficha.find(params[:id])\n @ficha.destroy\n\n respond_to do |format|\n format.html { redirect_to fichas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aucrecord.destroy\n respond_to do |format|\n format.html { redirect_to aucrecords_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @caixa = Caixa.find(params[:id])\n @caixa.destroy\n\n respond_to do |format|\n format.html { redirect_to caixas_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @cerveja = Cerveja.find(params[:id])\n @cerveja.destroy\n\n respond_to do |format|\n format.html { redirect_to cervejas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @atracao = Atracao.find(params[:id])\n @atracao.destroy\n\n respond_to do |format|\n format.html { redirect_to atracaos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sabio = Sabio.find(params[:id])\n @sabio.destroy\n\n respond_to do |format|\n format.html { redirect_to sabios_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @colegio = Colegio.find(params[:id])\n @colegio.destroy\n\n respond_to do |format|\n format.html { redirect_to colegios_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @tapioca.destroy\n respond_to do |format|\n format.html { redirect_to tapiocas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades3 = Humanidades3.find(params[:id])\n @humanidades3.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades3s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cargo_eleicao = CargoEleicao.find(params[:id])\n @cargo_eleicao.destroy\n\n respond_to do |format|\n format.html { redirect_to cargo_eleicaos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ginasio = Ginasio.find(params[:id])\n @ginasio.destroy\n\n respond_to do |format|\n format.html { redirect_to ginasios_url, :flash => { :notice => 'Ginasio apagado.' } }\n format.json { head :ok }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n @escola = Escola.find(params[:id])\n @escola.destroy\n\n respond_to do |format|\n format.html { redirect_to escolas_url }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def destroy\n @musica.audios.purge\n @musica.destroy\n respond_to do |format|\n format.html { redirect_to musicas_url, notice: 'Álbum apagado com sucesso!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vachana = Vachana.find(params[:id])\n @vachana.destroy\n\n respond_to do |format|\n format.html { redirect_to vachanas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vachana = Vachana.find(params[:id])\n @vachana.destroy\n\n respond_to do |format|\n format.html { redirect_to vachanas_url }\n format.json { head :no_content }\n end\n end",
"def delete\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.find(params[:id])\n @aviso.destroy\n\n respond_to do |format|\n format.html { redirect_to avisos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @areco = Areco.find(params[:id])\n @areco.destroy\n\n respond_to do |format|\n format.html { redirect_to arecos_url }\n format.json { head :no_content }\n end\n end",
"def cfa_delete\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in cfa titles cfa_delete method\"\n begin\n id=params[\"format\"] \n cfa=RestClient.delete $api_service+'/cfa_titles/'+id\n rescue =>e\n Rails.logger.custom_log.error { \"#{e} Cfa controller delete method\" }\n end\n redirect_to action: \"index\"\n end",
"def destroy\n @aquarium = Aquarium.find(params[:id])\n @aquarium.destroy\n\n respond_to do |format|\n format.html { redirect_to aquaria_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @fabrica.destroy\n respond_to do |format|\n format.html { redirect_to fabricas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @futbolada = Futbolada.find(params[:id])\n @futbolada.destroy\n\n respond_to do |format|\n format.html { redirect_to gestion_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @giang_vien = GiangVien.find(params[:id])\n @giang_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @cegonha = Cegonha.find(params[:id])\n @cegonha.destroy\n\n respond_to do |format|\n format.html { redirect_to cegonhas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cervejaria = Cervejaria.find(params[:id])\n @cervejaria.destroy\n\n respond_to do |format|\n format.html { redirect_to cervejarias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couche was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end",
"def destroy\n @anio.destroy\n respond_to do |format|\n format.html { redirect_to anios_url, notice: 'Anio was successfully destroyed.' }\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 @etnia = Etnia.find(params[:id])\n @etnia.destroy\n\n respond_to do |format|\n format.html { redirect_to etnias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n string = \"DELETE FROM notes WHERE famille_id = #{@famille.id}\"\n connection = Demande.connection\n connection.delete(string)\n @famille.destroy\n respond_to do |format|\n format.html { redirect_to familles_url, notice: 'Famille was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete!\n request! :delete\n end",
"def destroy\n @ocorrencia.destroy\n respond_to do |format|\n format.html { redirect_to ocorrencias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @coisa = Coisa.find(params[:id])\n @coisa.destroy\n\n respond_to do |format|\n format.html { redirect_to coisas_url }\n format.json { head :no_content }\n end\n end",
"def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end",
"def destroy\n @arcone = Arcone.find(params[:id])\n @arcone.destroy\n\n respond_to do |format|\n format.html { redirect_to arcones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quiniela = Quiniela.find(params[:id])\n @quiniela.destroy\n\n respond_to do |format|\n format.html { redirect_to quinielas_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 api(\"Delete\")\n end",
"def destroy\n @accesorio = Accesorio.find(params[:id])\n @accesorio.destroy\n\n respond_to do |format|\n format.html { redirect_to accesorios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fulcliente = Fulcliente.find(params[:id])\n @fulcliente.destroy\n\n respond_to do |format|\n format.html { redirect_to fulclientes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @farmacium.destroy\n respond_to do |format|\n msg = { :status => \"ok\", :message => \"Eliminado!\" }\n format.json { render :json => msg }\n end\n end",
"def destroy\n @uginuce.sheep.update status:'na farmi'\n @uginuce.destroy\n respond_to do |format|\n format.html { redirect_to uginuces_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ruby.destroy\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clientepedido = Clientepedido.find(params[:id])\n @clientepedido.destroy\n\n respond_to do |format|\n format.html { redirect_to clientepedidos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @realiza = Realiza.find(params[:id])\n @realiza.destroy\n\n respond_to do |format|\n format.html { redirect_to realizas_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n request(:delete, path)\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def delete(path)\n request 'DELETE', path\n end",
"def destroy\n @apuesta_detail = ApuestaDetail.find(params[:id])\n @apuesta_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to apuesta_details_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @faixa_etarium.destroy\n respond_to do |format|\n format.html { redirect_to faixa_etaria_url, notice: 'Faixa etarium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @jamaat = Jamaat.find(params[:id])\n @jamaat.destroy\n\n respond_to do |format|\n format.html { redirect_to jamaats_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @ficha.destroy\n respond_to do |format|\n format.html { redirect_to fichas_url, notice: 'Ficha was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ficha.destroy\n respond_to do |format|\n format.html { redirect_to fichas_url, notice: 'Ficha was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @adocao_animal = AdocaoAnimal.find(params[:id])\n @adocao_animal.destroy\n\n respond_to do |format|\n format.html { redirect_to adocao_animals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @retroaspecto = Retroaspecto.find(params[:id])\n @retroaspecto.destroy\n\n respond_to do |format|\n format.html { redirect_to retroaspectos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lieu = Lieu.find(params[:id])\n @lieu.destroy\n\n respond_to do |format|\n format.html { redirect_to lieus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @correntista.destroy\n respond_to do |format|\n format.html { redirect_to correntista_index_url, notice: 'Correntista was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @causa.destroy\n respond_to do |format|\n format.html { redirect_to causas_url, notice: 'Causa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teste_anamnese.destroy\n respond_to do |format|\n format.html { redirect_to teste_anamneses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def destroy\n @asthenium.destroy\n respond_to do |format|\n format.html { redirect_to asthenia_url }\n format.json { head :no_content }\n end\n end",
"def borrar \n\n fiesta.destroy\n render json: fiesta \n end",
"def destroy\r\n @sivic_celula.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_celulas_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @ulica.destroy\n respond_to do |format|\n format.html { redirect_to ulicas_url, notice: 'Ulica was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @veiculo = Veiculo.find(params[:id])\n @veiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to veiculos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cio.destroy\n respond_to do |format|\n format.html { redirect_to cios_url, notice: 'Cio excluido.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @caixa.destroy\n respond_to do |format|\n format.html { redirect_to caixas_url, notice: 'Caixa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asiento = Asiento.find(params[:id])\n @asiento.destroy\n\n respond_to do |format|\n format.html { redirect_to asientos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @tea = Tea.find(params[:id])\n @tea.destroy\n\n respond_to do |format|\n format.html { redirect_to teas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tea = Tea.find(params[:id])\n @tea.destroy\n\n respond_to do |format|\n format.html { redirect_to teas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @auditorio.destroy\n respond_to do |format|\n format.html { redirect_to auditorios_url, notice: 'Auditorio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cha.destroy\n respond_to do |format|\n format.html { redirect_to chas_url, notice: 'Cha was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @relogio = Relogio.find(params[:id])\n @relogio.destroy\n\n respond_to do |format|\n format.html { redirect_to relogios_url }\n format.json { head :ok }\n end\n end"
] | [
"0.7249788",
"0.72042596",
"0.70798326",
"0.70749754",
"0.7054742",
"0.6980377",
"0.69713724",
"0.69465536",
"0.6944013",
"0.6928243",
"0.6918093",
"0.6893774",
"0.6884394",
"0.6882612",
"0.6879807",
"0.68471354",
"0.6843041",
"0.684175",
"0.68413794",
"0.6839263",
"0.68232787",
"0.68097305",
"0.68097305",
"0.68082213",
"0.680543",
"0.68046695",
"0.67930025",
"0.67900175",
"0.6789619",
"0.678942",
"0.678942",
"0.678942",
"0.678942",
"0.67879677",
"0.6786404",
"0.6786404",
"0.67845553",
"0.67827994",
"0.67808473",
"0.67755675",
"0.67755675",
"0.67754596",
"0.676363",
"0.6760598",
"0.6759165",
"0.6757749",
"0.67569965",
"0.67542535",
"0.6750435",
"0.6749244",
"0.6742842",
"0.6741462",
"0.67334366",
"0.6730449",
"0.6729801",
"0.67297983",
"0.67292184",
"0.6727545",
"0.672679",
"0.6722193",
"0.6721623",
"0.67194825",
"0.67191255",
"0.6718059",
"0.6715279",
"0.6713786",
"0.6713281",
"0.66963667",
"0.66933656",
"0.66901463",
"0.6689513",
"0.6688638",
"0.66847235",
"0.6684711",
"0.66826725",
"0.66810197",
"0.66800076",
"0.6679532",
"0.6677413",
"0.6677413",
"0.6673459",
"0.66719025",
"0.66675305",
"0.66633296",
"0.66623384",
"0.6661391",
"0.6659603",
"0.6657862",
"0.66564935",
"0.66561323",
"0.6653983",
"0.6651264",
"0.6645936",
"0.66457444",
"0.66450554",
"0.66448736",
"0.66448736",
"0.6641489",
"0.6641315",
"0.66382915"
] | 0.7359775 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_cafeterium
@cafeterium = Cafeterium.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 cafeterium_params
params.require(:cafeterium).permit(:item_name, :item_description, :item_price, :cafeteria_category_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] | 0.0 | -1 |
END OF Input view generator modules Graph generator modules | def cols_and_spline
type = params[:type]
section = Section.find(params[:section_id])
@series = []
@categories = []
@average = []
hash = mark_columns(section)
@y_axis_text = 'Marks'
@subtitle_text = "Section: #{section.name}"
# comparing multiple subjects and tests for one student
#This will also be called from 'student_master_graphs' view, since that generates
# graphs for only one student
if type.eql?('one_student')
student = Student.find(params[:student_id])
test_ids = params[:test_ids]
subject_ids = params[:subject_ids]
@title_text = "#{student.name} Marks"
for test_id in test_ids
#for the x-axis units
@categories << Test.find(test_id).name
#for the spline
end
for sub_id in subject_ids
req_col = hash[Subject.find(sub_id).name]
marks = []
#Loop for each of the subjects
for test_id in test_ids
marks << Mark.by_test_id(test_id).by_student_id(student.id).first.send(req_col)
end
@series << {:name => Subject.find(sub_id).name, :marks => marks}
end
# comparing one subject in multiple tests for multiple students
elsif type.eql?('one_subject')
subject = Subject.find(params[:subject_id])
test_ids = params[:test_ids]
student_ids = params[:student_ids].split(",")
@title_text = "#{subject.name} Marks"
for test_id in test_ids
#for the x-axis units
@categories << Test.find(test_id).name
#for the spline
#@average << (Mark.total_on(section.id, subject.id, map.test_id))/section.students.count
end
req_col = hash[Subject.find(subject.id).name]
for id in student_ids
marks = []
#Loop for each of the subjects
for test_id in test_ids
marks << Mark.by_test_id(test_id).by_student_id(id).first.send(req_col)
end
@series << {:name => Student.find(id).name, :marks => marks}
end
#comparing multiple subjects in one test for multiple students
elsif type.eql?('one_test')
test = Test.find(params[:test_id])
subject_ids = params[:subject_ids]
student_ids = params[:student_ids].split(",")
@title_text = "#{test.name} Marks"
for sub_id in subject_ids
#for the x-axis units
@categories << Subject.find(sub_id).name
#for the spline
#@average << (Mark.total_on(section.id, map.subject_id, map.test.id))/section.students.count
end
for id in student_ids
marks = Array.new
#Loop for each of the subjects
for sub_id in subject_ids
req_col = hash[Subject.find(sub_id).name]
marks << Mark.by_test_id(test.id).by_student_id(id).first.send(req_col)
end
@series << {:name => Student.find(id).name, :marks => marks}
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_graph\n end",
"def graph\n \n \n @graphml = \"<graphml><key id='label' for='all' attr.name='label' attr.type='string'/><key id='link' for='all' attr.name='link' attr.type='string'/><key id='weight' for='all' attr.name='weight' attr.type='double'/><key id='edgetype' for='edge' attr.name='edgetype' attr.type='string'/><key id='nodetype' for='node' attr.name='nodetype' attr.type='string'/><graph edgedefault='directed'>\" \n @sif = ''\n \n @max = 2\n @log = Array.new\n @additional = {'cleavage' => {}, 'inverse_cleavage' => {}, 'inhibition' => {}, 'inverse_inhibition' => {}, 'interaction' => {}}\n add_nodes(nil,self.protein,nil,0,nil)\n add_additional_nodes(@additional['cleavage'],'cleavage')\n add_additional_nodes(@additional['inverse_cleavage'],'inverse_cleavage')\n add_additional_nodes(@additional['inhibition'],'inhibition')\n add_additional_nodes(@additional['inverse_inhibition'],'inverse_inhibition')\n \n @graphml << \"</graph></graphml>\"\n\n \n # f = File.open(\"#{RAILS_ROOT}/public/images/dynamic/#{self.protein.name}-#{'ppi' if ppi}network.graphml\", 'w')\n # f << @graphml\n # f.close\n\n return @graphml\n end",
"def nodes; end",
"def nodes; end",
"def nodes; end",
"def graph_new(program, gopts={}, nopts={}, eopts={})\n # initialize new Graphviz graph\n # g = GraphViz::new( \"G\" )\n # program should be one of dot / neato / twopi / circo / fdp\n g = GraphViz::new( :G, :type => :graph, :use=>program)\n g[:overlap] = gopts[:overlap] || \"orthoxy\"\n g[:rankdir] = gopts[:rankdir] || \"LR\"\n \n # set global node options\n g.node[:color] = nopts[:color] || \"#3d0d4c\"\n g.node[:style] = nopts[:style] || \"filled\"\n g.node[:shape] = nopts[:shape] || \"box\"\n g.node[:penwidth] = nopts[:penwidth] || \"1\"\n g.node[:fontname] = nopts[:fontname] || \"Arial\" # \"Trebuchet MS\"\n g.node[:fontsize] = nopts[:fontsize] || \"8\"\n g.node[:fillcolor]= nopts[:fillcolor] || LatticeGridHelper.default_fill_color\n g.node[:fontcolor]= nopts[:fontcolor] || \"#474724\"\n g.node[:margin] = nopts[:margin] || \"0.0\"\n g.node[:width] = nopts[:width] || \"0.2\"\n g.node[:height] = nopts[:height] || \"0.1\"\n g.node[:shape] = nopts[:shape] || \"ellipse\"\n g.node[:margin] = nopts[:margin] || \"0.05\"\n \n # set global edge options\n g.edge[:color] = eopts[:color] || \"#999999\"\n g.edge[:len] = eopts[:len] || \"1\"\n g.edge[:fontsize] = eopts[:fontsize] || \"6\"\n g.edge[:fontcolor] = eopts[:fontcolor] || \"#444444\"\n g.edge[:fontname] = eopts[:fontname] || \"Verdana\"\n g.edge[:dir] = eopts[:dir] || \"forward\"\n g.edge[:arrowsize] = eopts[:arrowsize] || \"0.0\"\n \n return g\nend",
"def show\n\t\tputs @graph\n\tend",
"def inject_graph_values!\n end",
"def generate_input(graph,inputs)\r\n \r\nputs\"--- INPUT --------\" \r\n\r\n # ciclo gli Inputs\r\n inputs.each_with_index do |inline,i|\r\n fields = inline.split(',')\r\n \r\n#---------------------creo l'elenco dei job -------------------------\r\n\r\n found_job = fields[0].split('(').last\r\n @Jobs << found_job\r\n \r\n \r\n#---------------------creo l'elenco delle risorse IO ----------------\r\n\r\n io_resource = \"IO_\" + fields[1].chomp(')')\r\n unless @InOut.include? io_resource\r\n #Se non é giá stata creata, aggiungo la risorsa di IO al grafo\r\n graph.add_node(\"\\\"\" + io_resource + \"\\\"\",\"is_resourceIO\")\r\n puts \"aggiunta risorsa IO: \" + io_resource\r\n @InOut << io_resource\r\n end \r\n \r\n \r\n#---------------------creo gli elementi INPUT ----------------------- \r\n \r\n #aggiungo il nodo di input e il collegamento con la risorse IO \r\n input_name = found_job + \".\" + \"INPUT_\" + fields[1].chomp(')') \r\n \r\n #aggiungo il nodo \r\n graph.add_node(\"\\\"\" + input_name + \"\\\"\",\"is_input\")\r\n puts \"aggiunto input: \" + input_name\r\n \r\n # aggiungo il link\r\n graph.add_link(io_resource, input_name,\"\")\r\n puts \"aggiunto link: \" + \"\\\"\" + io_resource + \"\\\"\" + \"->\" + input_name\r\n \r\n \r\n # analizzo gli inputPath Multipli \r\n unless fields[3].nil? \r\n classe = fields[3].split('.') \r\n mapper_name = found_job + \".\" + \"MAPPER_\" + classe[0]\r\n \r\n #aggiungo il nodo\r\n graph.add_node(mapper_name,\"is_mapper\")\r\n puts \"aggiunto multiMapper: \" + mapper_name\r\n \r\n # aggiungo il link\r\n graph.add_link(input_name, mapper_name,\"\")\r\n puts \"aggiunto link: \" + \"\\\"\" + input_name + \"\\\"\" + \"->\" + mapper_name\r\n \r\n # memorizzo i link aperti (per creare i futuri link) \r\n @OpenLink.push(mapper_name); \r\n \r\n \r\n else # allore é un iputPath semplice che punta al mapper class definito\r\n #inserisco l'input nella lista dei nodi aperti per il job corrent\r\n @OpenLink.push(input_name);\r\n \r\n end \r\n end \r\n\r\n end",
"def get_graph\n @graph = Graph.new\n @tparses.each do |p|\n if p[:args]\n p[:args].each do |type, arg|\n @graph.add_edge(p[:idx], arg, 1) if arg >= 0\n end\n end\n end\n\n g = GraphViz.new(:G, :type => :digraph)\n g.node[:shape] = \"box\"\n g.node[:fontsize] = 11\n g.edge[:fontsize] = 9\n\n n = []\n @tparses.each do |p|\n n[p[:idx]] = g.add_nodes(p[:idx].to_s, :label => \"#{p[:word]}/#{p[:pos]}/#{p[:cat]}\")\n end\n\n @tparses.each do |p|\n if p[:args]\n p[:args].each do |type, arg|\n if arg >= 0 then g.add_edges(n[p[:idx]], n[arg], :label => type) end\n end\n end\n end\n\n g.get_node(@root.to_s).set {|_n| _n.color = \"blue\"} if @root >= 0\n g.get_node(@focus.to_s).set {|_n| _n.color = \"red\"} if @focus >= 0\n\n @graph_rendering = g.output(:svg => String)\n end",
"def gv_object\n return @gv_object if @gv_object\n return unless defined? GraphViz\n @gv_object = GraphViz.new gv_graph_name, :type => :digraph\n @gv_object.node_attrs[:style] = 'filled, solid'\n\n each_task do |task|\n next unless task.node == gv_filter_node if gv_filter_node\n gv_node = @gv_object.add_node task.to_s\n gv_node.fillcolor = gv_task_color(task)\n end\n\n each_task do |task|\n task.each_dependency do |dep_task|\n next unless dep_task.node == gv_filter_node if gv_filter_node\n next unless @gv_object.find_node dep_task.to_s and @gv_object.find_node task.to_s\n @gv_object.add_edges dep_task.to_s, task.to_s\n end\n end\n @gv_object\n end",
"def get_graphviz\n handle_graphviz_setup\n @file_name = build_graphviz_restfulpath(params, @output_format)\n # @file_name = get_graph_dir(\"#{@graph_path}#{params[:program]}.#{@output_format}\")\n \n render :layout=>false\n end",
"def graph\n @g ||= GraphViz.new(:G, :type => :digraph)\n end",
"def graphviz(oGraph, c0, c1, c2, c3, c4)\n return if @src_id.nil? || @dst_id.nil?\n return if @count > 1 # TODO: eliminate dupulicate trans\n\n guard = @block.condition_success unless @block.nil?\n guard = \"unknown\" if guard.nil?\n\n if @title.nil?\n title = ''\n else\n title = \"#{@title}\"\n end\n @label = @type + '(' + title + ')\\n' + guard + '\\n' + @block.id\n\n if (@src_id =~ /^V_/) && (@dst_id =~ /^V_/)\n # V to V form\n src_id = @src_id + '_inbound'\n dst_id = @dst_id + '_inbound'\n\n elsif (@src_id =~ /^V_/) && (@dst_id =~ /^C_/)\n src_id = @src_id + '_inbound'\n dst_id = @dst_id\n\n c2.add_node(dst_id) if $graphviz_with_rank\n elsif (@src_id =~ /^C_/) && (@dst_id =~ /^V_/)\n src_id = @src_id\n dst_id = @dst_id + '_outbound'\n c2.add_node(src_id) if $graphviz_with_rank\n c4.add_node(dst_id) if $graphviz_with_rank\n elsif (@src_id =~ /^C_/) && (@dst_id =~ /^C_/)\n # redirect\n src_id = @src_id\n dst_id = @dst_id\n c2.add_node(src_id) if $graphviz_with_rank\n c3.add_node(dst_id) if $graphviz_with_rank\n else\n src_id = @src_id\n dst_id = @dst_id\n end\n\n # draw\n e = oGraph.add_edge(src_id, dst_id, label: @label)\n end",
"def to_dot\n template = <<-eos\ndigraph \"<%= uid || 'graph' %>\" {\n node[ style = \"filled, solid\"];\n<% each_task do |task| -%>\n<% next unless task.name =~ dot_task_filter if dot_task_filter -%>\n<% next unless task.node.name =~ dot_node_filter if dot_node_filter and task.node -%>\n \"<%= task %>\" [label = \"<%= task %>\", fillcolor = \"<%= task.color %>\"];\n<% end -%>\n\n<% each_task do |task| -%>\n<% task.each_forward_dependency do |forward_task| -%>\n<% next unless task.name =~ dot_task_filter if dot_task_filter -%>\n<% next unless task.node.name =~ dot_node_filter if dot_node_filter and task.node -%>\n<% next unless forward_task.name =~ dot_task_filter if dot_task_filter -%>\n<% next unless forward_task.node.name =~ dot_node_filter if dot_node_filter and forward_task.node -%>\n \"<%= task %>\" -> \"<%= forward_task %>\";\n<% end -%>\n<% end -%>\n}\n eos\n ERB.new(template, nil, '-').result(binding)\n end",
"def visualize\n require 'open3'\n Open3.popen3('graph-easy') do |i,o,_|\n i.write to_graph_easy\n i.close\n puts o.read\n end\n end",
"def create_dot_graph\r\n\r\n \t# Create the base object, then add edges/nodes later etc\r\n \tmy_graph = Graph.new\r\n \tmy_graph.name= \"State_Model\"\r\n \tmy_graph.node_style= :ellipse\r\n \tmy_graph.type = :digraph\r\n\r\n \t# For each entry in the Adjacency matrix extract the relationships and add the graph edges.\r\n \tself.adjacency_matrix.each_key do |table_key|\r\n \t\ttransition_list=self.adjacency_matrix[table_key]\r\n \t\ttransition_list.each do |transition|\r\n \t\t # is the action guarded?\r\n \t\t if self.guarded_actions !=nil\r\n \t\t guarded=self.guarded_actions.include? transition.action\r\n \t\t\tend # end if \r\n \t\t\t# add the edge...\r\n \t\t\tmy_graph.add_edge(transition.start_state, transition.end_state, \" #{transition.action} \", guarded)\r\n \t\tend # end add transitions\r\n \tend # end add nodes\r\n\r\n \treturn my_graph\r\n end",
"def show\n @workflow = Workflow.find(params[:id])\n \n default_graph_settings = \"node [shape=box,style=filled];\\n\"\n \n @processed_graph = default_graph_settings + @workflow.graph + process_graph(@workflow)\n \n gv = IO.popen(\"/usr/local/bin/dot -q -Tpng\", \"w+\")\n gv.puts \"digraph G{\", @processed_graph, \"}\"\n gv.close_write\n @gvpng = gv.read\n\n\n gv = IO.popen(\"/usr/local/bin/dot -q -Tcmapx\", \"w+\")\n gv.puts \"digraph G{\", @processed_graph, \"}\"\n gv.close_write\n @gvmap = gv.read\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @workflow }\n end\n end",
"def initialize\n @graph_command = []\n end",
"def init_graph(name, data, viz_type = 'network', opts = {})\n # i = 0\n def_viz_opts = {\n #:schema => table.schema \n }\n \n gopts = {\n :data_sources => data,\n :dynamic => {\n :updateInterval => 1\n },\n :viz_type => viz_type,\n :wopts => def_viz_opts.merge(opts)\n \n }\n OMF::Web::Widget::Graph.addGraph(name, gopts) \nend",
"def graph(name, options = {}, &block)\n GraphViz::DSL.new(name, options.merge( { :type => \"graph\" } ), &block).graph\nend",
"def dot(io)\n log \"drawing graph \"\n io << <<END\ndigraph test_definition {\ngraph [ rankdir=TB ]\nnode [shape=record,fontname=helvetica]\nedge [fontname=helvetica, arrowsize=0.5]\nEND\n # nodes,transitions = collect_nodes\n # transitions.to_a.flatten.to_set.each do |n|\n @nodes.each do |n|\n next if n.record # if we are a port, skip, record handles drawing\n if n.is_record? # if we are a record, call specialized function\n n.dot_code(io)\n else\n label_sym = (n.is_a?(JoinNode) ? :xlabel : :label)\n attrs={label_sym => '\"'+n.dot_label+'\"'}\n # if n.symbol\n # attrs[:xlabel]=n.symbol\n # end\n if n.respond_to? :dot_node_shape\n attrs[:shape]='\"'+n.dot_node_shape+'\"'\n end\n attr_string=attrs.map do |k,v|\n \"#{k.to_s}=#{v}\"\n end.join(\", \")\n io.puts \"#{n.node_name} [#{attr_string}]\"\n end\n end\n @control_edges.each do |s,d,label|\n log \"adding control edge: [#{s},#{d},#{label}]\"\n attrs={color:\"red\",fontcolor:\"red\"}\n attrs[:label] = '\"'+label.to_s+'\"' if label\n draw_transition(s,d,io,attrs)\n end\n @data_edges.each do |s,d|\n log \"adding data edge\"\n draw_transition(s,d,io,{color: \"green\"})\n end\n io.puts \"}\"\n self\n end",
"def export\n # takes nodes and edges.. and exports something nice\n p @nodes\n p @edges\n end",
"def index\n @graphs = Graph.all\n end",
"def new_graph\n # Clear physics\n physics.clear\n center = TVec2D.new(width / 2, height / 2)\n @clusters = (0..8).map do\n Cluster.new(\n app: self,\n number: rand(3..8),\n diameter: rand(20..100),\n center: center\n )\n end\n #\tAll clusters connect to all clusters\n clusters.each_with_index do |ci, i|\n clusters[i + 1..clusters.size - 1].each do |cj|\n ci.connect(cj)\n end\n end\nend",
"def graph t\n puts \"graphing #{@graphname}\"\n $end_time = Time.now.to_i - @step + 1\n $start_time = $end_time - 3600 #one hour\n $unc, $ucr, $unr = t\n RRD.graph(\n \"#{@graphname}\",\n \"--title\", \"#{@name.reverse.chomp(@r_db_path).reverse.chomp(\".rrd\")}\",\n# \"--vertical-label\",\"Ambient Temp\",\n \"--start\", \"#{$start_time}\",\n \"--end\", \"#{$end_time}\",\n \"--interlaced\",\n \"--imgformat\", \"PNG\",\n \"DEF:amb_#{@ds_label}=#{@name}:#{@ds_label}:#{@rra_cf}\",\n \"LINE1:amb_#{@ds_label}#555555:Ambient Temperature\",\n \"HRULE:#{$unc}#FF4500:Threshold - Non-Critical\",\n \"HRULE:#{$ucr}#FF0000:Threshold - Critical\"\n )\n end",
"def graph_name; @options[:graph_name]; end",
"def index\n retrieve_data_for_graph\n end",
"def for_node; end",
"def plot; end",
"def show\n @nodes = [ { id: 'plot_' + @plot.id.to_s, group: '1', name: @plot.name } ]\n @plot.characters.each do |c|\n link_item( 'plot_' + @plot.id.to_s, { id: 'char_' + c.id.to_s, group: '2', name: c.name } )\n end\n\n @plot.characters.each do |c|\n c.groups.each do |group|\n @nodes << { id: 'group_' + group.id.to_s, group: '3', name: group.name }\n @links << { source: 'char_' + c.id.to_s, target: 'group_' + group.id.to_s, value: 1 }\n\n group.characters.each do |connected_c|\n link_item( 'group_' + group.id.to_s, { id: 'char_' + connected_c.id.to_s, group: '2', name: connected_c.name } )\n end\n \n end\n end\n\n @graph = { nodes: @nodes, links: @links }\n end",
"def Graph(name=:G, type=:digraph, &blk)\n Gviz.new(name, type).graph(&blk)\nend",
"def get_graph_rendering(parse)\n return '' if parse.nil? || parse[:root].nil?\n\n tokens = parse[:tokens]\n root = parse[:root]\n focus = parse[:focus]\n\n g = GraphViz.new(:G, :type => :digraph)\n g.node[:shape] = \"box\"\n g.node[:fontsize] = 10\n g.edge[:fontsize] = 9\n\n n = []\n tokens.each do |p|\n n[p[:idx]] = g.add_nodes(p[:idx].to_s, :label => \"#{p[:lex]}/#{p[:pos]}/#{p[:cat]}\")\n end\n\n tokens.each do |p|\n if p[:args]\n p[:args].each do |type, arg|\n if arg >= 0 then g.add_edges(n[p[:idx]], n[arg], :label => type) end\n end\n end\n end\n\n g.get_node(root.to_s).set {|_n| _n.color = \"blue\"} if root >= 0\n g.get_node(focus.to_s).set {|_n| _n.color = \"red\"} if focus >= 0\n g.output(:svg => String)\n end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def emit_body(anIO)\n anIO.puts <<-DOT\n subgraph island {\n node [shape = box, style=filled, color=lightgray];\nDOT\n feature_files.each_with_index do |ff, i|\n draw_node(anIO, ff, i) if ff.feature.anonymous?\n end\n\n anIO.puts <<-DOT\n label = \"Isolated features\";\n }\n\n subgraph dependencies {\n node [shape = box, fillcolor = none];\nDOT\n feature_files.each_with_index do |ff, i|\n draw_node(anIO, ff, i) unless ff.feature.anonymous?\n end\n anIO.puts <<-DOT\n label = \"Dependencies\";\n }\n\n // The edges represent dependencies\nDOT\n dependencies.each { |a_dep| draw_edge(anIO, a_dep) }\n end",
"def main\n args = get_input\n directed_graph = create_directed_graph(args.fetch(:raw_edge_list))\n display_adjacency_matrix(args.fetch(:num_nodes), directed_graph)\nend",
"def inputs\n raise GraphException.new \"Graph Failure -- input is nil\" if @g_inputs.nil?\n @g_inputs\n end",
"def initialize(graph)\n @graph = graph\n end",
"def generate_graph\n nodes = User.where(team_id: @team.id)\n links = []\n\n (0..nodes.length-1).to_a.each do |index1|\n\n (0..nodes.length-1).to_a.each do |index2|\n\n if index1 != index2 \n message_count = Message.where(user_id_from: nodes[index1].id, user_id_to: nodes[index2].id).length\n link = {\n source: index1,\n target: index2,\n value: message_count\n }\n links.push(link)\n end\n\n end\n\n end\n render json: {\n nodes: nodes,\n links: links\n }\n rescue Exception => e\n render json: {error: e.message}\n end",
"def view_flow; end",
"def generate\n end",
"def map\n shape = @opts.fetch :shape, 'record'\n rslt = StringIO.new\n rslt.puts \"digraph #{@model[:name]} {\"\n rslt.puts ' graph [rankdir=\"LR\"]'\n rslt.puts ''\n\n @model[:tables].each do |table|\n # nodes\n rslt.puts \" \\\"#{table[:name]}\\\" [label=\\\"#{table[:name]}\\\", shape=\\\"#{shape}\\\"]\"\n # @nodes.puts \" \\\"#{table[:name]}\\\" [label=\\\"<f0> #{table[:name]}|<f1> #{table[:desc]}\\\", shape=\\\"#{shape}\\\"]\"\n # edges\n table.fetch(:fks, []).each do |fk|\n rslt.puts \" \\\"#{table[:name]}\\\"->\\\"#{fk[:table]}\\\"\"\n end\n # graphviz\n table.fetch(:graphvizs, []).each do |text|\n rslt.puts \" #{text}\"\n end\n end\n\n rslt.puts '}'\n rslt.string\n end",
"def generate\n super\n end",
"def performance_graph_list\n super\n end",
"def initialize(g, params = {})\n\n require 'set'\n \n params = { :pbar => false, :file => '', :color => true, :circo => false }.merge(params)\n @pbar = params[:pbar]\n file = params[:file]\n color = params[:color]\n circo = params[:circo]\n\n if @pbar\n require 'facets/progressbar'\n @labeling_pbar = Console::ProgressBar.new(\"Labeled nodes\", g.num_vertices)\n end\n\n # initializza etichette e contatori\n @i = 0\n @m = 0\n @l = Hash.new\n @c = Hash.new\n @ude_counter = Hash.new\n @unlabeled_v = g.vertices.to_set\n\n if g.cyclic?\n # applica l'algoritmo generalizzato\n until @unlabeled_v.empty?\n\tlabel_and_counter(g)\n\tinf_label(g)\n\t@i += 1\n end\n else\n # applica l'algoritmo lineare\n succ = Hash.new\n g.vertices.each do |v|\n\tsuccessivi = Array.new\n\tg.adjacent_vertices(v).each do |sv| \n\t successivi << sv\n\tend # each\n\tsucc[v] = successivi\n end # each\n coda = Array.new\n g.vertices.each do |v| \n\tif g.adjacent_vertices(v) == []\n\t @l[v] = 0\n\t @labeling_pbar.inc if @pbar\n\t coda.push(v) \n\tend # if\n end # each\n while coda != [] do\n\tx = coda[0]\n\tcoda.delete(x)\n\tg.prev_vertices(x).each do |v|\n\t succ[v].delete(x)\n\t if succ[v] == []\n\t @l[v] = mes(v,g)\n\t coda.push(v)\n\t @labeling_pbar.inc if @pbar\n\t end # if\n\tend # each\n end # while\n end # if\n @labeling_pbar.finish if @pbar\n count_ude(g)\n\n write_to_graphic_file(g, fmt='png', dotfile=file, color, circo) if (file != '' and file.is_a?(String))\n end",
"def view\n @isSample = false\n #use to show sample flowchart\n if params[:isSample] == \"yes\"\n @isSample = true\n @course = Course.find(params[:course_id])\n end\n #end\n \n @tagassignments=TagAssignment.all\n @student=Student.where(random_url: params[:id]).first\n #use to show sample flowchart\n if params[:isSample] == \"yes\"\n @student=Student.where(course_id: params[:course_id]).first\n end\n #end\n\n #end\n if [email protected]? #case 1: viewing the grade view page\n @course=Course.find(@student.course_id)\n @tags = @course.tags.group(:name)\n \n @nodes=Assignment.where(course_id: @student.course_id).map {|x|x}\n #add individualized grade and tag data to each node\n @totalpoints=0\n @nodes.each do |node|\n #modyfied \n if node.points_possible.nil?\n @totalpoints = 10\n else\n @totalpoints+=node.points_possible\n end\n grade=Grade.where(student_id: @student.id, assignment_id: node.id).first\n if grade.nil?\n node[\"points\"]=0\n else\n node[\"points\"]=grade.points\n end\n\t #node[\"tagnames\"]=node.tags.map{|x|x}\n node[\"tagnames\"] = \"\"\n idx = 0\n @course.tags.each do |t|\n if (t.course_id == @student.course_id) && (t.assignmentnames == node.name)\n node[\"tagnames\"] = node[\"tagnames\"] + t.name + ','\n end\n end\n\n end\n else #case 2: accessing the list of students to edit, add, or destroy\n #do nothing; we don't need the else actually. i put it there so that i can do some explaining\n\n\n\n\n end\n end",
"def graph\n @graph ||= Codependency::Graph.new\n end",
"def index\n @graphs = Graph.all.order('path ASC')\n end",
"def graph_it\n\t\tputs \"Calling R\"\n\t\tr = RSRuby.instance\n\n\t\tputs \"R Summary Statistics:\"\n\t\tputs \"Median Edits Per User: #{r.median(@users.values)}\"\n\t\tputs \"Average Edits Per User: #{r.mean(@users.values)}\"\n\t\tputs \"Variance in Edits Per User: #{r.var(@users.values)}\"\n\t\tputs \"The Standard Deviation is: #{r.sd(@users.values)}\"\n\n\t\tr.png(\"img_exports/#{@dataset}_edits_per_user.png\", :width=>1200, :height=>600)\n\t\tr.barplot(\t:height =>(@users.values.sort.reverse), \n\t\t\t \t\t:log=>'y',\n\t\t\t \t\t:ylab=>\"Number of Edits\", \n\t\t\t \t\t:xlab=>\"Users\", \n\t\t\t \t\t:main=>\"#{@dataset.capitalize}: Number of Edits per User\",\n\t\t\t \t\t:cex_main=>2,\n\t\t\t \t\t:cex_lab=>1.2)\n\t\tr.eval_R \"dev.off()\"\n\t\tputs \"Finished Writing Graph\"\n\tend",
"def display\n # tree-font is where we start with the fonts\n # min-tree-font is how far we go down... translates into\n # tree-depth, one depth increment corresponds to 2 font increments\n # absolute-min-tree-font is what you think it is\n init_session\n\t@level = 1\n @maxlevel = session[:'max-level']\t\n @font = session[:'tree-font']\n @individual = Individual.by_uid( params[:uid] ) \n\tif !@individual\n\t redirect_to root_path\n\telsif session[:display] == \"graph\"\n\t is_user = @current_user and @current_user.user?\n\t is_editor = @current_user and @current_user.user?\t \n\t @nodes = [] \n\t @edges = [] \n\t @nodes << @individual.graph_focus_node( is_user, (is_editor and session[:edit] == 'on') )\t\t \n\t @nodes, @edges = @individual.graph_up( \n\t 0, @maxlevel, @nodes, @edges, is_user, (is_editor and session[:edit] == 'on') )\t\t \n\t @nodes, @edges = @individual.graph_down( \n\t 0, @maxlevel, @nodes, @edges, is_user, (is_editor and session[:edit] == 'on') )\t \n\t render :graph\t\n\telse\n\t render\n\tend\n end",
"def new\n @graph = Graph.new\n 3.times { @graph.graph_membership_graphs.build }\n 3.times { @graph.graph_membership_nodes.build }\n \n Action.log :controller => params[:controller], :action => params[:action], :user => current_user\n\n respond_to do |format|\n format.html { render :layout => !request.xhr? } # new.html.erb\n format.json { render json: @graph }\n end\n end",
"def generate_graph(text, pos_tagger, coreNLPTagger, forRelevance, forPatternIdentify)\n #initializing common arrays \n @vertices = Array.new\n @num_vertices = 0\n @edges = Array.new\n @num_edges = 0\n\n @pos_tagger = pos_tagger #part of speech tagger\n @pipeline = coreNLPTagger #dependency parsing\n #iterate through the sentences in the text\n for i in (0..text.length-1)\n if(text[i].empty? or text[i] == \"\" or text[i].split(\" \").empty?)\n next\n end\n unTaggedString = text[i].split(\" \")\n # puts \"UnTagged String:: #{unTaggedString}\"\n taggedString = @pos_tagger.get_readable(text[i])\n# puts \"taggedString:: #{taggedString}\"\n \n #Initializing some arrays\n nouns = Array.new\n nCount = 0\n verbs = Array.new\n vCount = 0\n adjectives = Array.new\n adjCount = 0\n adverbs = Array.new\n advCount = 0\n \n parents = Array.new\n labels = Array.new\n \n #------------------------------------------#------------------------------------------\n #finding parents\n parents = find_parents(text[i])\n parentCounter = 0\n #------------------------------------------#------------------------------------------\n #finding parents\n labels = find_labels(text[i])\n labelCounter = 0\n #------------------------------------------#------------------------------------------\n #find state\n sstate = SentenceState.new\n states_array = sstate.identify_sentence_state(taggedString)\n states_counter = 0\n state = states_array[states_counter]\n states_counter += 1\n #------------------------------------------#------------------------------------------\n \n taggedString = taggedString.split(\" \")\n prevType = nil #initlializing the prevyp\n \n #iterate through the tokens\n for j in (0..taggedString.length-1)\n taggedToken = taggedString[j]\n plainToken = taggedToken[0...taggedToken.index(\"/\")].to_s\n posTag = taggedToken[taggedToken.index(\"/\")+1..taggedToken.length].to_s \n #ignore periods\n if(plainToken == \".\" or taggedToken.include?(\"/POS\") or (taggedToken.index(\"/\") == taggedToken.length()-1) or (taggedToken.index(\"/\") == taggedToken.length()-2))#this is for strings containinig \"'s\" or without POS\n next\n end\n \n #SETTING STATE\n #since the CC or IN are part of the following sentence segment, we set the STATE for that segment when we see a CC or IN\n if(taggedToken.include?(\"/CC\"))#{//|| ps.contains(\"/IN\")\n state = states_array[states_counter]\n states_counter+=1\n end\n # puts(\"**Value:: #{plainToken} LabelCounter:: #{labelCounter} ParentCounter:: #{parentCounter} POStag:: #{posTag} .. state = #{state}\")\n\n #------------------------------------------\n #if the token is a noun\n if(taggedToken.include?(\"NN\") or taggedToken.include?(\"PRP\") or taggedToken.include?(\"IN\") or taggedToken.include?(\"/EX\") or taggedToken.include?(\"WP\"))\n #either add on to a previous vertex or create a brand new noun vertex\n if(prevType == NOUN) #adding to a previous noun vertex\n nCount -= 1 #decrement, since we are accessing a previous noun vertex\n prevVertex = search_vertices(@vertices, nouns[nCount], i) #fetching the previous vertex\n nouns[nCount] = nouns[nCount].to_s + \" \" + plainToken #concatenating with contents of the previous noun vertex\n #checking if the previous noun concatenated with \"s\" already exists among the vertices\n if((nounVertex = search_vertices(@vertices, nouns[nCount], i)) == nil) \n prevVertex.name = prevVertex.name.to_s + \" \" + plainToken #concatenating the nouns\n nounVertex = prevVertex #the current concatenated vertex will be considered\n if(labels[labelCounter] != \"NMOD\" or labels[labelCounter] != \"PMOD\")#resetting labels for the concatenated vertex\n nounVertex.label = labels[labelCounter]\n end\n #fAppendedVertex = 1\n end#if the vertex already exists, just use nounVertex - the returned vertex for ops. \n else #if the previous token is not a noun, create a brand new vertex\n nouns[nCount] = plainToken #this is checked for later on\n nounVertex = search_vertices(@vertices, plainToken, i)\n if(nounVertex == nil) #the string doesn't already exist\n @vertices[@num_vertices] = Vertex.new(nouns[nCount], NOUN, i, state, labels[labelCounter], parents[parentCounter], posTag)\n nounVertex = @vertices[@num_vertices] #the newly formed vertex will be considered\n @num_vertices+=1\n end\n end #end of if prevType was noun\n remove_redundant_vertices(nouns[nCount], i)\n nCount+=1 #increment nCount for a new noun vertex just created (or existing previous vertex appended with new text)\n \n #checking if a noun existed before this one and if the adjective was attached to that noun.\n #if an adjective was found earlier, we add a new edge\n if(prevType == ADJ)\n #set previous noun's property to null, if it was set, if there is a noun before the adjective\n if(nCount > 1)\n v1 = search_vertices(@vertices, nouns[nCount-2], i) #fetching the previous noun, the one before the current noun (therefore -2) \n v2 = search_vertices(@vertices, adjectives[adjCount-1], i) #fetching the previous adjective \n #if such an edge exists - DELETE IT - search_edges_to_set_null() returns the position in the array at which such an edge exists\n if(!v1.nil? and !v2.nil? and (e = search_edges_to_set_null(@edges, v1, v2, i)) != -1) #-1 is when no such edge exists\n @edges[e] = nil #setting the edge to null\n #if @num_edges had been previously incremented, decrement it\n if(@num_edges > 0)\n @num_edges-=1 #deducting an edge count\n end\n end \n end\n #if this noun vertex was encountered for the first time, nCount < 1,\n #so do adding of edge outside the if condition \n #add a new edge with v1 as the adjective and v2 as the new noun\n v1 = search_vertices(@vertices, adjectives[adjCount-1], i)\n v2 = nounVertex #the noun vertex that was just created\n #if such an edge did not already exist\n if(!v1.nil? and !v2.nil? and (e = search_edges(@edges, v1, v2, i)) == -1)\n @edges[@num_edges] = Edge.new(\"noun-property\",VERB)\n @edges[@num_edges].in_vertex = v1\n @edges[@num_edges].out_vertex = v2\n @edges[@num_edges].index = i\n @num_edges+=1\n #since an edge was just added we try to check if there exist any redundant edges that can be removed\n remove_redundant_edges(v1, v2, i)\n end\n end\n #a noun has been found and has established a verb as an in_vertex and such an edge doesnt already previously exist\n if(vCount > 0) #and fAppendedVertex == 0 \n #add edge only when a fresh vertex is created not when existing vertex is appended to\n v1 = search_vertices(@vertices, verbs[vCount-1], i)\n v2 = nounVertex\n #if such an edge does not already exist add it\n if(!v1.nil? and !v2.nil? and (e = search_edges(@edges,v1, v2, i)) == -1)\n @edges[@num_edges] = Edge.new(\"verb\", VERB) \n @edges[@num_edges].in_vertex = v1 #for vCount = 0\n @edges[@num_edges].out_vertex = v2\n @edges[@num_edges].index = i\n @num_edges+=1\n #since an edge was just added we try to check if there exist any redundant edges that can be removed\n remove_redundant_edges(v1, v2, i)\n end\n end\n prevType = NOUN\n #------------------------------------------\n \n #if the string is an adjective\n #adjectives are vertices but they are not connected by an edge to the nouns, instead they are the noun's properties\n elsif(taggedToken.include?(\"/JJ\")) \n adjective = nil\n if(prevType == ADJ) #combine the adjectives\n # puts(\"PREV ADJ here:: #{plainToken}\")\n if(adjCount >= 1)\n adjCount = adjCount - 1\n prevVertex = search_vertices(@vertices, adjectives[adjCount], i) #fetching the previous vertex\n adjectives[adjCount] = adjectives[adjCount] + \" \" + plainToken \n #if the concatenated vertex didn't already exist\n if((adjective = search_vertices(@vertices, adjectives[adjCount], i)).nil?)\n prevVertex.name = prevVertex.name+\" \"+plainToken\n adjective = prevVertex #set it as \"adjective\" for further execution\n if(labels[labelCounter] != \"NMOD\" or labels[labelCounter] != \"PMOD\") #resetting labels for the concatenated vertex\n adjective.label = labels[labelCounter]\n end\n end\n end\n else #new adjective vertex\n adjectives[adjCount] = plainToken\n if((adjective = search_vertices(@vertices, plainToken, i)).nil?) #the string doesn't already exist\n @vertices[@num_vertices] = Vertex.new(adjectives[adjCount], ADJ, i, state, labels[labelCounter], parents[parentCounter], posTag)\n adjective = @vertices[@num_vertices]\n @num_vertices+=1\n end\n end\n remove_redundant_vertices(adjectives[adjCount], i) \n adjCount+=1 #incrementing, since a new adjective was created or an existing one updated.\n \n #by default associate the adjective with the previous/latest noun and if there is a noun following it immediately, then remove the property from the older noun (done under noun condition)\n if(nCount > 0) #gets the previous noun to form the edge\n v1 = search_vertices(@vertices, nouns[nCount-1], i) \n v2 = adjective #the current adjective vertex\n #if such an edge does not already exist add it\n if(!v1.nil? and !v2.nil? and (e = search_edges(@edges, v1, v2, i)) == -1)\n # puts \"** Adding noun-adj edge .. #{v1.name} - #{v2.name}\"\n @edges[@num_edges] = Edge.new(\"noun-property\",VERB)\n @edges[@num_edges].in_vertex = v1\n @edges[@num_edges].out_vertex = v2\n @edges[@num_edges].index = i\n @num_edges+=1 \n #since an edge was just added we try to check if there exist any redundant edges that can be removed\n remove_redundant_edges(v1, v2, i) \n end\n end\n prevType = ADJ\n #end of if condition for adjective\n #------------------------------------------\n \n #if the string is a verb or a modal//length condition for verbs is, be, are...\n elsif(taggedToken.include?(\"/VB\") or taggedToken.include?(\"MD\"))\n verbVertex = nil\n if(prevType == VERB) #combine the verbs \n vCount = vCount - 1\n prevVertex = search_vertices(@vertices, verbs[vCount], i) #fetching the previous vertex\n verbs[vCount] = verbs[vCount] + \" \" + plainToken \n #if the concatenated vertex didn't already exist\n if((verbVertex = search_vertices(@vertices, verbs[vCount], i)) == nil)\n prevVertex.name = prevVertex.name + \" \" + plainToken\n verbVertex = prevVertex #concatenated vertex becomes the new verb vertex\n if(labels[labelCounter] != \"NMOD\" or labels[labelCounter] != \"PMOD\")#resetting labels for the concatenated vertex\n verbVertex.label = labels[labelCounter]\n end\n end\n else\n verbs[vCount] = plainToken\n if((verbVertex = search_vertices(@vertices, plainToken, i)) == nil)\n @vertices[@num_vertices] = Vertex.new(plainToken, VERB, i, state, labels[labelCounter], parents[parentCounter], posTag)\n verbVertex = @vertices[@num_vertices] #newly created verb vertex will be considered in the future\n @num_vertices+=1\n end\n end\n remove_redundant_vertices(verbs[vCount], i)\n vCount+=1\n \n #if an adverb was found earlier, we set that as the verb's property\n if(prevType == ADV)\n #set previous verb's property to null, if it was set, if there is a verb following the adverb\n if(vCount > 1)\n v1 = search_vertices(@vertices, verbs[vCount-2], i) #fetching the previous verb, the one before the current one (hence -2) \n v2 = search_vertices(@vertices, adverbs[advCount-1], i) #fetching the previous adverb \n #if such an edge exists - DELETE IT\n if(!v1.nil? and !v2.nil? and (e = search_edges_to_set_null(@edges, v1, v2, i)) != -1)\n @edges[e] = nil #setting the edge to null\n if(@num_edges > 0)\n @num_edges-=1 #deducting an edge count\n end\n end\n end\n #if this verb vertex was encountered for the first time, vCount < 1,\n #so do adding of edge outside the if condition\n #add a new edge with v1 as the adverb and v2 as the new verb\n v1 = search_vertices(@vertices, adverbs[advCount-1], i)\n v2 = verbVertex\n #if such an edge did not already exist\n if(!v1.nil? and !v2.nil? and (e = search_edges(@edges, v1, v2, i)) == -1)\n @edges[@num_edges] = Edge.new(\"verb-property\",VERB)\n @edges[@num_edges].in_vertex = v1\n @edges[@num_edges].out_vertex = v2\n @edges[@num_edges].index = i\n @num_edges+=1 \n #since an edge was just added we try to check if there exist any redundant edges that can be removed\n remove_redundant_edges(v1, v2, i)\n end\n end\n \n #making the previous noun, one of the vertices of the verb edge\n if(nCount > 0) #and fAppendedVertex == 0 \n #gets the previous noun to form the edge\n v1 = search_vertices(@vertices, nouns[nCount-1], i)\n v2 = verbVertex\n #if such an edge does not already exist add it\n if(!v1.nil? and !v2.nil? and (e = search_edges(@edges, v1, v2, i)) == -1)\n @edges[@num_edges] = Edge.new(\"verb\",VERB)\n @edges[@num_edges].in_vertex = v1 #for nCount = 0;\n @edges[@num_edges].out_vertex = v2 #the verb\n @edges[@num_edges].index = i\n @num_edges+=1\n #since an edge was just added we try to check if there exist any redundant edges that can be removed\n remove_redundant_edges(v1, v2, i)\n end\n end\n prevType = VERB\n #------------------------------------------ \n #if the string is an adverb\n elsif(taggedToken.include?(\"RB\"))\n adverb = nil\n if(prevType == ADV) #appending to existing adverb\n if(advCount >= 1)\n advCount = advCount - 1\n end\n prevVertex = search_vertices(@vertices, adverbs[advCount], i) #fetching the previous vertex\n adverbs[advCount] = adverbs[advCount] + \" \" + plainToken\n #if the concatenated vertex didn't already exist\n if((adverb = search_vertices(@vertices, adverbs[advCount], i)) == nil)\n prevVertex.name = prevVertex.name + \" \" + plainToken\n adverb = prevVertex #setting it as \"adverb\" for further computation\n if(labels[labelCounter] != \"NMOD\" or labels[labelCounter] != \"PMOD\") #resetting labels for the concatenated vertex\n adverb.label = labels[labelCounter]\n end\n end\n else #else creating a new vertex\n adverbs[advCount] = plainToken\n if((adverb = search_vertices(@vertices, plainToken, i)) == nil)\n @vertices[@num_vertices] = Vertex.new(adverbs[advCount], ADV, i, state, labels[labelCounter], parents[parentCounter], posTag);\n adverb = @vertices[@num_vertices]\n @num_vertices+=1\n end\n end \n remove_redundant_vertices(adverbs[advCount], i) \n advCount+=1\n \n #by default associate it with the previous/latest verb and if there is a verb following it immediately, then remove the property from the verb\n if(vCount > 0) #gets the previous verb to form a verb-adverb edge\n v1 = search_vertices(@vertices, verbs[vCount-1], i)\n v2 = adverb\n #if such an edge does not already exist add it\n if(!v1.nil? and !v2.nil? && (e = search_edges(@edges, v1, v2, i)) == -1)\n @edges[@num_edges] = Edge.new(\"verb-property\",VERB)\n @edges[@num_edges].in_vertex = v1 #for nCount = 0;\n @edges[@num_edges].out_vertex = v2 #the verb\n @edges[@num_edges].index = i\n @num_edges+=1\n #since an edge was just added we try to check if there exist any redundant edges that can be removed\n remove_redundant_edges(v1, v2, i)\n end\n end\n prevType = ADV\n #end of if condition for adverb\n end #end of if condition\n #------------------------------------------ \n #incrementing counters for labels and parents\n labelCounter+=1\n parentCounter+=1 \n end #end of the for loop for the tokens\n #puts \"here outside the for loop for tokens\"\n nouns = nil\n verbs = nil\n adjectives = nil\n adverbs = nil\n end #end of number of sentences in the text\n\n @num_vertices = @num_vertices - 1 #since as a counter it was 1 ahead of the array's contents\n if(@num_edges != 0)\n @num_edges = @num_edges - 1 #same reason as for num_vertices\n end\n set_semantic_labels_for_edges\n #print_graph(@edges, @vertices)\n# puts(\"Number of edges:: #{@num_edges}\")\n# puts(\"Number of vertices:: #{@num_vertices}\")\n return @num_edges\nend",
"def draw_graph(section_name, hits)\n # puts \"draw_graph: #{section_name}, #{hits}\"\n graph = GraphViz.new type: 'digraph'\n @parts.each do |name, part|\n part.draw(graph)\n end\n graph.output png: \"#@dir/#{section_name}_#{hits}.png\"\n end",
"def show\n graph = GraphViz.new(:G, type: :digraph)\n competency = Competency.find(params[:id])\n graphviz(graph, competency)\n @file = Tempfile.new(['foo', '.png'], \"#{Rails.root}/public/images\")\n graph.output(png: @file.path)\n end",
"def flow\n end",
"def graph?\n show?\n end",
"def graph?\n show?\n end",
"def build_qml_dep_graph\n @ir.each do |key, ir|\n #puts \"#{key} dep is #{get_dep ir}\"\n @dep[key] = get_dep ir\n end\n end",
"def readGraph\r\n\tputs \"Please, input the Graph as a comma-separated \" +\r\n\t\t\"sequence of Edges and press Enter\"\r\n\tgraphString = gets\r\n\tpathsString = graphString.split(\",\")\r\n\tgraph0 = Graph.new\r\n\tpathsString.each do |pathString|\r\n\t\tpathString = pathString.strip()\r\n\t\tonode = nil\r\n\t\tdnode = nil\r\n\t\tif graph0.containsNode?(pathString[0])\r\n\t\t\tonode = graph0.getNode(pathString[0])\r\n\t\telse\r\n\t\t\tonode = Node.new(pathString[0])\r\n\t\t\tgraph0.addNode(onode)\r\n\t\tend\r\n\t\tif graph0.containsNode?(pathString[1])\r\n\t\t\tdnode = graph0.getNode(pathString[1])\r\n\t\telse\r\n\t\t\tdnode = Node.new(pathString[1])\r\n\t\t\tgraph0.addNode(dnode)\r\n\t\tend\r\n\t\tweight = pathString[2, pathString.size].to_i()\r\n\t\tp0 = Path.new(onode, dnode, weight)\r\n\t\tonode.addPath(p0)\r\n\tend\r\n\treturn graph0\r\nend",
"def print_graph()\n puts \"Adjacency Matrix\"\n @adjacent_list.each_with_index {|value, index| puts \"#{index} #{value} \\n\" }\n\n puts \"Indegree Matrix\"\n @indegree.each_with_index {|value, index| puts \"#{index} #{value} \\n\" }\n end",
"def nodes_field\n define_nodes_field\n end",
"def json_directional(name, logger)\n\t# return '{\"nodes\":[], \"links\":[], \"constraints\":[]}'\n\t\n\t\n\t\n\t\n\t# input sanitization???\n\t# I mean, the name is coming from a URL piece, so it could be anything...\n\t\n\t\n\t# logger.info @rake.methods.grep(/task/).inspect\n\t# logger.info @rake.tasks.inspect\n\t\n\tshort_path = 'public/CS_BS_all.yaml'\n\t\n\tregenerate_graph = false\n\t@rake[short_path].invoke ->(){\n\t\t# --- this callback runs when YAML file in 'short_path' is regenerated\n\t\tlogger.info \"graph generation callback\"\n\t\t\n\t\tregenerate_graph = true\n\t}\n\t\n\t# Generate graphs if\n\t# 1) no graph yet in memory\n\t# 2) source YAML file was modified\n\tif regenerate_graph or @graphs[short_path].nil?\n\t\t@graphs[short_path] = SummerResearch::DependencyGraph.new.tap do |graph|\n\t\t\traw_data = Models::Utilities.load_yaml_file(short_path)\n\t\t\t# raw_data = \n\t\t\t\t# if name.include? 'split'\n\t\t\t\t# \tModels::Utilities.load_yaml_file \"public/#{name}.yaml\"\n\t\t\t\t# else\n\t\t\t\t\t# Models::Utilities.load_yaml_file(short_path)\n\t\t\t\t# end\n\t\t\t\n\t\t\t# NOTE: just get the node and vert information first. The data will be converted to the proper output format later.\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t# --- add basic node and edge information to the graph\n\t\t\tnodes = raw_data.collect{ |k,v| [k, v] }.flatten.uniq\n\t\t\t\n\t\t\tlinks =\n\t\t\t\traw_data.collect do |course, deps|\n\t\t\t\t\tdeps.collect do |dependency|\n\t\t\t\t\t\t[course, dependency]\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tlinks = links.flatten(1) # remove extra level of nesting\n\t\t\tlinks.delete_if do |course, dependency|\n\t\t\t\tcourse == dependency # remove self-links resulting from messy data\n\t\t\tend\n\t\t\t\n\t\t\t\n\t\t\tlogger.info nodes.inspect\n\t\t\tlogger.info links.inspect\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tnodes.each do |vertex|\n\t\t\t\tgraph.add_vertex(vertex)\n\t\t\tend\n\t\t\t\n\t\t\tlinks.each do |course, dependency|\n\t\t\t\tgraph.add_edge(dependency, course)\n\t\t\tend\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t# --- debug printing to make sure that worked\n\t\t\t\n\t\t\t# NOTE: the first item in either of these lists, is the requested node.\n\t\t\t# ie) ancestors of CS 367 includes CS 367 itself, even if all self-loops were removed\n\t\t\t# NOTE: was able to fix this by returning a slightly different Enumerator from the DependencyGraph class.\n\t\t\tlogger.info \"Ancestors\"\n\t\t\tlogger.info graph.ancestors(\"CS 367\").to_a.inspect\n\t\t\tlogger.info \"Parents\"\n\t\t\tlogger.info graph.parents(\"CS 367\").to_a.inspect\n\t\t\tlogger.info \"Children\"\n\t\t\tlogger.info graph.children(\"CS 367\").to_a.inspect\n\t\t\tlogger.info \"Descendants\"\n\t\t\tlogger.info graph.descendants(\"CS 367\").to_a.inspect\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tlogger.info graph.each_vertex.to_a\n\t\t\tlogger.info graph.each_edge.to_a\n\t\tend\n\tend\n\t\n\t# pull graph from the cache\n\tgraph = @graphs[short_path]\n\t\n\traise \"Could not find DependencyGraph data. Should have been generated after #{short_path} was made, but it seems like that as not the case.\" if graph.nil?\n\t\n\t\n\t# if short_path == 'data/CS_BS_all.yaml'\n\t\t[\n\t\t\t'CS 310',\n\t\t\t'CS 330',\n\t\t\t'CS 367',\n\t\t\t# 'ENGH 302',\n\t\t\t# # 'CS 262',\n\t\t\t# # 'CS 351',\n\t\t\t# # 'MATH 351',\n\t\t\t# # 'MATH 203',\n\t\t\t# 'STAT 344',\n\t\t\t# # 'MATH 125',\n\t\t\t# 'ECE 445',\n\t\t\t# # 'CS 222',\n\t\t\t# # 'CS 112',\n\t\t\t# # 'STAT 346',\n\t\t\t# 'SYST 210',\n\t\t].each do |course|\n\t\t\t# graph.cut course\n\t\tend\n\t# end\n\t\n\t# graph.remove_vertex('MATH 112') # Discrete Math for IT\n\t# graph.remove_vertex('CS 222') # \"Computer Programming for Engineers\", basically like CS 262\n\t\n\t\n\t\n\t\n\trequirement_by_type_file = 'data/CS_BS_requirements_by_type.yaml'\n\t@rake[requirement_by_type_file].invoke\n\t\n\trequirement_by_type = Models::Utilities.load_yaml_file(requirement_by_type_file)\n\t\n\t\n\t\n\trequired_courses = requirement_by_type[:required].to_set\n\telective_courses = requirement_by_type[:elective].to_set\n\t\n\t\n\t\n\t\n\t\n\t\n\trequirements_file = 'data/CS_BS_requirements.yaml'\n\t@rake[requirements_file].invoke\n\t\n\tdegree_requirements = Models::Utilities.load_yaml_file(requirements_file)\n\tdegree_requirements\n\t\n\telective_category = \n\t\tdegree_requirements.select{ |name, sector| sector[:data].is_a? Hash }\n\t\t .collect { |name, sector|\n\t\t \t sector[:data].collect{ |category, course_id|\n\t\t \t \t[course_id, name]\n\t\t \t }\n\t\t }\n\t\t .flatten(1) # array of [course_id, name] pairs\n\t\n\t# convert [course_id, name] relation into { course_id => i }, where i is an integer corresponding to 'name' in a list of all values for 'name'\n\telective_category = elective_category.to_h\n\t\n\tname_list = elective_category.values.uniq\n\tname_to_number = name_list.each_with_index.to_h\n\t\n\tlogger.info name_list.inspect\n\t\n\telective_category = \n\t\telective_category.collect{ |course_id, name|\n\t\t\t[course_id].flatten.collect { |id|\n\t\t\t\t[ id, name_to_number[name] ]\n\t\t\t}\n\t\t}\n\t\t.flatten(1)\n\t\t.to_h\n\t\n\tlogger.info elective_category.inspect\n\t\n\t\n\treturn graph.to_json_d3v3_cola(required_courses, elective_courses, elective_category)\n\t\n\t\n\t\n\t# below is a bunch of old code, to generate the graph the old way\n\t# still keeping it around, because some of these constraints have not been implemented\n\t# in the new system.\n\t# Also, this alternative way of specifying colors is interesting.\n\t# -------------------------------------------------------------------\n\t\n\t\n\t\n\t\n\t# === Create Constraints\n\t# basic constraint: prereqs go above later courses.\n\t\t# (overall visual flow: top to bottom as skill increases)\n\t\t# defined as local property.\n\t\t# graph ends up showing global properties.\n\tc1 =\n\t\traw_data2.collect do |course, deps|\n\t\t\tdeps.collect do |d|\n\t\t\t\ti_left =\n\t\t\t\t\tnodes.find_index{ |x| x['name'] == course}\n\t\t\t\t\n\t\t\t\ti_right =\n\t\t\t\t\tnodes.find_index{ |x| x['name'] == d}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t{\n\t\t\t\t\t\"axis\" => \"y\", \n\t\t\t\t\t\"left\" => i_left, \"right\" => i_right, \"gap\" => 25\n\t\t\t\t}\n\t\t\tend\n\t\tend\n\tc1.flatten!\n\t\n\tconstraints = c1\n\t\n\t# TODO: implement constraint such that all 100-level courses are above the 200-level ones, etc etc.\n\t# (want to stratify course levels)\n\t# logger.info \"HEY\"\n\tgap = 500\n\tc2 =\n\t\tnodes.combination(2)\n\t\t.collect{ |n1, n2| # isolate the names\n\t\t\t[n1['name'], n2['name']]\n\t\t}\n\t\t.select{ |n1, n2| # filter by course number\n\t\t\tlogger.info [n1,n2].inspect\n\t\t\ta,b = [n1, n2].collect{|x| x.split.last[0].to_i }\n\t\t\t\n\t\t\ta > 3\n\t\t}.collect{ |n1, n2|\n\t\t\ti_left =\n\t\t\t\tnodes.find_index{ |x| x['name'] == n1}\n\t\t\t\n\t\t\ti_right =\n\t\t\t\tnodes.find_index{ |x| x['name'] == n2}\n\t\t\t\n\t\t\t{\n\t\t\t\t\"axis\" => \"y\", \n\t\t\t\t\"left\" => 28, \"right\" => i_left, \"gap\" => gap\n\t\t\t}\n\t\t}\n\t\n\t\t# this constraint currently has no effect on the output\n\tconstraints = constraints + c2\n\tconstraints.flatten!\n\t\n\t\n\t\n\t# all nodes want to have horizontal spacing\n\tgap = 25\n\tc3 =\n\t\tnodes.combination(2)\n\t\t.collect{ |n1, n2| # isolate the names\n\t\t\t[n1['name'], n2['name']]\n\t\t}\n\t\t.select{ |n1, n2| # filter by course number\n\t\t\tlogger.info [n1,n2].inspect\n\t\t\ta,b = [n1, n2].collect{|x| x.split.last[0].to_i }\n\t\t\t\n\t\t\ta > 3\n\t\t\ttrue\n\t\t}.collect{ |n1, n2|\n\t\t\ti_left =\n\t\t\t\tnodes.find_index{ |x| x['name'] == n1}\n\t\t\t\n\t\t\ti_right =\n\t\t\t\tnodes.find_index{ |x| x['name'] == n2}\n\t\t\t\n\t\t\t{\n\t\t\t\t\"axis\" => \"x\", \n\t\t\t\t\"left\" => i_left, \"right\" => i_right, \"gap\" => gap\n\t\t\t}\n\t\t}\n\t\n\t\t# this constraint currently has no effect on the output\n\tconstraints = constraints + c3\n\tconstraints.flatten!\n\t\n\t\n\t\n\t\n\t# TODO: implement constraint that causes all courses from a single department to clump\n\t\n\t\n\t\n\t\n\t\n\t# === additional processing on the graph\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t# === rough packaging for output\n\tout = {\n\t\t# 'name' => name,\n\t\t'nodes' => nodes,\n\t\t'links' => links,\n\t\t'constraints' => constraints\n\t}\n\t\n\t\n\t# === style the nodes\n\t\n\tcolor_key ||= {\n\t\t:gated_elective_clump => \"#10D588\", # light green\n\t\t:split_link => \"#3399FF\", # blue\n\t\t\n\t\t:required => \"#CC2300\", # red / orange\n\t\t:elective => \"#242424\", # black\n\t\t:not_required => \"#AAA\" # grey\n\t}\n\t\n\trequired =\n\t\t@data[:required].collect{ |clump| clump.keys }\n\t\t.flatten\n\t\t.to_set\n\t\n\telective = \n\t\t@data[:elective].values\n\t\t.collect{ |clump| clump.keys }\n\t\t.flatten\n\t\t.to_set\n\t\n\t\n\tout['nodes'].each do |node|\n\t\t# --- color assigment\n\t\ttype = node_type(node['name'], required, elective)\n\t\t# node['color'] = color_key[type]\n\t\tnode['class'] = type.to_s.tr('_', '-')\n\t\t\n\t\t\n\t\t# --- do other things with type\n\t\t# leaves << node['id'] if type == :not_required\n\tend\n\t\n\t\nend",
"def build_graph_generally(chart_type, categories, series, colors)\n graph = get_graph(chart_type)\n graph.add(:axis_category_text, categories)\n graph.add(:series, \"series legend label\", series)\n graph.add(:theme, \"vote\")\n graph.add(:user_data, :colors, colors.join(\",\"))\n graph.add(:user_data, :delay_count, series.size - 1)\n graph\n end",
"def flamegraph_mode; end",
"def nodelist; end",
"def nodelist; end",
"def draw_node(dx, dy, x, y, connections, type, scale)\n draw_x = dx + x*$node_size + $node_size / 2.0\n draw_y = dy + y*$node_size + $node_size / 2.0\n Node.create({:x => draw_x, :y => draw_y, :factor_x => scale, :factor_y => scale}, type)\n n, s, e, w = connections.values\n OutConnector.create(:x => draw_x, :y => draw_y,:angle => 0, :factor_x => scale, :factor_y => scale) if n == 1\n OutConnector.create(:x => draw_x, :y => draw_y,:angle => 180, :factor_x => scale, :factor_y => scale) if s == 1\n OutConnector.create(:x => draw_x, :y => draw_y,:angle => 90, :factor_x => scale, :factor_y => scale) if e == 1\n OutConnector.create(:x => draw_x, :y => draw_y,:angle => 270, :factor_x => scale, :factor_y => scale) if w == 1\n InConnector.create(:x => draw_x, :y => draw_y,:angle => 0, :factor_x => scale, :factor_y => scale) if n == 2\n InConnector.create(:x => draw_x, :y => draw_y,:angle => 180, :factor_x => scale, :factor_y => scale) if s == 2\n InConnector.create(:x => draw_x, :y => draw_y,:angle => 90, :factor_x => scale, :factor_y => scale) if e == 2\n InConnector.create(:x => draw_x, :y => draw_y,:angle => 270, :factor_x => scale, :factor_y => scale) if w == 2\n end",
"def labels; end",
"def flamegraph_mode=(_arg0); end",
"def show\n puts \"ID = #{@id}\"\n puts \"Node name = #{@name}\"\n puts \"Require's input = #{@require_input}\"\n puts \"Type = #{@type}\"\n puts \"Points at => #{@points_at.pretty_inspect}\"\n end",
"def edges\n inputs + outputs\n end",
"def graph_name\n nil\n end",
"def begingraphics(*)\n super\n end",
"def draw_graph(graph)\n type = graph.directed? ? :digraph : :graph\n g = GraphViz.new(:G, :type => type)\n graph.vertices().each do |v|\n g.add_node(v.id)\n end\n\n added_edges = Set.new\n\n graph.edges_by_vertices().each do |x, edges|\n from = g.get_node(x.id)\n edges.each do |y|\n to = g.get_node(y.id)\n\n if graph.directed?\n # draw each individual 'directed' edge\n g.add_edge(from, to)\n else\n # draw only one edge to represent 'undirected' edge\n g.add_edge(from, to) unless added_edges.include?([to, from])\n added_edges.add([from, to])\n end\n\n\n end\n end\n\n\n filename = \"graph.png\"\n g.output( :png => filename )\n system(\"open #{filename}\")\nend",
"def vertices\n end"
] | [
"0.790648",
"0.6355632",
"0.6344504",
"0.6344504",
"0.6344504",
"0.61950165",
"0.61653584",
"0.6109589",
"0.6059717",
"0.60186565",
"0.6003674",
"0.5999716",
"0.59751296",
"0.59612507",
"0.59475696",
"0.5944077",
"0.59389645",
"0.59351313",
"0.5922543",
"0.5887639",
"0.585784",
"0.5848761",
"0.57858235",
"0.5771295",
"0.5711262",
"0.5700115",
"0.56916386",
"0.5668889",
"0.565503",
"0.56339777",
"0.5631888",
"0.5624689",
"0.56158864",
"0.55930626",
"0.55930626",
"0.55930626",
"0.55930626",
"0.55930626",
"0.55930626",
"0.55930626",
"0.55930626",
"0.55930626",
"0.55930626",
"0.55930626",
"0.55930626",
"0.55930626",
"0.55930626",
"0.55930626",
"0.55930626",
"0.55930626",
"0.55930626",
"0.55930626",
"0.55930626",
"0.55930626",
"0.55930626",
"0.55930626",
"0.55930626",
"0.55930626",
"0.55930626",
"0.55930626",
"0.5579627",
"0.5577715",
"0.5568035",
"0.55551255",
"0.55548227",
"0.55488425",
"0.554656",
"0.5530758",
"0.55101776",
"0.5510078",
"0.54967266",
"0.548668",
"0.54861623",
"0.547999",
"0.5479522",
"0.547932",
"0.5477532",
"0.5470711",
"0.5470141",
"0.54637647",
"0.54631823",
"0.5455423",
"0.5455423",
"0.5453397",
"0.5450985",
"0.54471636",
"0.5444657",
"0.5443405",
"0.544204",
"0.54383767",
"0.543207",
"0.543207",
"0.5427971",
"0.5421913",
"0.54176176",
"0.5410471",
"0.5404993",
"0.5403353",
"0.53960985",
"0.53958386",
"0.5393719"
] | 0.0 | -1 |
END OFGraph generator modules UTILTIY MODULES FOR THIS CONTROLLER AND VIEW | def mark_columns(section)
h = Hash.new
section.sec_sub_maps.each do |map|
name =Subject.find(map.subject_id).name
mark_col = "sub#{map.mark_column}"
h[name] = mark_col
end
return h
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view; end",
"def view_flow; end",
"def _view; end",
"def view_renderer; end",
"def view_renderer; end",
"def overview\n\n end",
"def view_paths; end",
"def view_paths; end",
"def view_paths; end",
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def components\n\n end",
"def admin_logic\n end",
"def view\n end",
"def doctorView \n end",
"def components; end",
"def models\r\n\r\n end",
"def import_show \n end",
"def show() end",
"def show() end",
"def show() end",
"def vieworder\n end",
"def generate_graph\n end",
"def show \r\n end",
"def show\n \n end",
"def show\n \n end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def renderer; end",
"def design\r\n \r\n end",
"def actions; end",
"def dashboard; end",
"def rendered; end",
"def render; end",
"def render; end",
"def render; end",
"def render; end",
"def render; end",
"def loc_view\n \n end",
"def make_and_model; end",
"def model\n end",
"def results_view\n end",
"def operations; end",
"def operations; end",
"def after_view_setup\n end",
"def show\n #not needed for our implementation\n end",
"def rendered_views; end",
"def rendered_views=(_arg0); end",
"def view_info\n super\n end",
"def layout; end",
"def generate\n super\n end",
"def model\n end",
"def model\n end",
"def model\n end",
"def show ; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def controller\n end",
"def controller\n end",
"def index\n @sources = Source.listing\n\n respond_to do |format|\n format.html { @sources = @sources.paginate(page: params[:page], per_page: params[:per_page]) }\n format.xml { ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n yield :open_graph_tags \n \"#{yield(:title)} » \".html_safe if content_for?(:title) \n Calagator.title \n Calagator.tagline \n \"#{root_path}opensearch.xml\" \n Calagator.title \n stylesheet_link_tag 'application', :media => :all \n yield :css_insert \n javascript_include_tag *mapping_js_includes \n javascript_include_tag 'application' \n yield :javascript_insert \n auto_discovery_link_tag(:atom, events_url(:format => 'atom'), :title => 'Atom: All Events' )\n yield :discovery_insert \n image_path(\"site-icon.png\") \n \"#{controller.controller_name}_#{action_name}\" \n \"#{controller.controller_name}_controller\" \n %w[new create edit update].include?(action_name) ? \"#{controller.controller_name}_change\" : \"\" \n link_to Calagator.title, root_path, id: \"project_title\" \nlink_class[:events]\n link_to \"Events\", events_path \nlink_class[:venues]\n link_to \"Venues\", venues_path \n form_tag search_events_path, :method => :get do \n if request.env[\"HTTP_USER_AGENT\"] && request.env[\"HTTP_USER_AGENT\"].include?(\"Safari\") \n @query \n else \n text_field_tag 'query', @query, id: 'search_field', tabindex: 1 \n end \n end \n \n # Pick a subnav \n link_to 'Browse events', root_url,\n :class => subnav_class_for(\"site\", \"index\") \n link_to 'Add an event', new_event_url,\n :class => subnav_class_for(\"events\", \"new\") \n link_to 'Import events', new_source_url,\n :class => subnav_class_for(\"sources\", \"new\") \n \n link_to 'Browse venues', venues_url,\n :class => subnav_class_for(\"venues\", \"index\") \n link_to 'Add a venue', new_venue_url,\n :class => subnav_class_for(\"venues\", \"new\") \n \n \n \n render_flash \n for source in @sources \n cycle 'odd', 'even' \n link_to 'Show', source \n link_to 'Destroy', source, method: :delete, data: {confirm: 'Are you sure?' } \n source_url_link source \n end \n will_paginate @sources \n \n URI.parse(Calagator.url).host \n source_code_version \n \n \n\nend\n }\n end\nruby_code_from_view.ruby_code_from_view do |rb_from_view|\n yield :open_graph_tags \n \"#{yield(:title)} » \".html_safe if content_for?(:title) \n Calagator.title \n Calagator.tagline \n \"#{root_path}opensearch.xml\" \n Calagator.title \n stylesheet_link_tag 'application', :media => :all \n yield :css_insert \n javascript_include_tag *mapping_js_includes \n javascript_include_tag 'application' \n yield :javascript_insert \n auto_discovery_link_tag(:atom, events_url(:format => 'atom'), :title => 'Atom: All Events' )\n yield :discovery_insert \n image_path(\"site-icon.png\") \n \"#{controller.controller_name}_#{action_name}\" \n \"#{controller.controller_name}_controller\" \n %w[new create edit update].include?(action_name) ? \"#{controller.controller_name}_change\" : \"\" \n link_to Calagator.title, root_path, id: \"project_title\" \nlink_class[:events]\n link_to \"Events\", events_path \nlink_class[:venues]\n link_to \"Venues\", venues_path \n form_tag search_events_path, :method => :get do \n if request.env[\"HTTP_USER_AGENT\"] && request.env[\"HTTP_USER_AGENT\"].include?(\"Safari\") \n @query \n else \n text_field_tag 'query', @query, id: 'search_field', tabindex: 1 \n end \n end \n \n # Pick a subnav \n link_to 'Browse events', root_url,\n :class => subnav_class_for(\"site\", \"index\") \n link_to 'Add an event', new_event_url,\n :class => subnav_class_for(\"events\", \"new\") \n link_to 'Import events', new_source_url,\n :class => subnav_class_for(\"sources\", \"new\") \n \n link_to 'Browse venues', venues_url,\n :class => subnav_class_for(\"venues\", \"index\") \n link_to 'Add a venue', new_venue_url,\n :class => subnav_class_for(\"venues\", \"new\") \n \n \n \n render_flash \n for source in @sources \n cycle 'odd', 'even' \n link_to 'Show', source \n link_to 'Destroy', source, method: :delete, data: {confirm: 'Are you sure?' } \n source_url_link source \n end \n will_paginate @sources \n \n URI.parse(Calagator.url).host \n source_code_version \n \n \n\nend\n\n end",
"def render\n end",
"def render\n end",
"def render\n end",
"def show\n\t\t\n\tend",
"def show\n\t\t\n\tend",
"def show\n\t\t\n\tend",
"def render\n\n end",
"def index\n @project = parent\n @project.managed_repository{\n #@variables = Voeis::Variable.all(:order=>[:variable_name.asc], :include=>[:units])\n #@variables = @project.variables.all(:order=>[:variable_name.asc], :fields=>[\n # :id,:variable_name,:variable_code,:general_category,:sample_medium,:value_type,:data_type,:variable_units_id])\n #@variables = Voeis::Variable.all(:order=>[:variable_name.asc])\n #@variables = @project.variables.all(:order=>[:variable_name.asc])\n #@variables = @project.variables.all(:order=>[:variable_name.asc],:variable_units=>{:id.gt=>0})\n @variables = @project.variables.all(:order=>[:id.asc])\n @units = Voeis::Unit.all\n @time_units = Voeis::Unit.all(:units_type.like=>'%Time%')\n @variable_names = Voeis::VariableNameCV.all\n @sample_mediums= Voeis::SampleMediumCV.all\n @value_types= Voeis::ValueTypeCV.all\n @speciations = Voeis::SpeciationCV.all\n @data_types = Voeis::DataTypeCV.all\n @general_categories = Voeis::GeneralCategoryCV.all\n @label_array = Array[\"Variable Name\",\"Variable Code\",\"Unit Name\",\"Speciation\",\"Sample Medium\",\"Value Type\",\"Is Regular\",\"Time Support\",\"Time Unit ID\",\"Data Type\",\"General Cateogry\", \"Detection Limit\"]\n @vars = @variables.map{ |var| var.to_hash.merge!({:variable_units=>var.get_units}) }\n @current_variables = Array.new \n #@vars = @variables.map{ |var| var.to_hash.merge!({:variable_units=>@units.get(var.variable_units_id)}) }\n # @temp_array =Array[var.variable_name, var.variable_code,@units.get(var.variable_units_id).units_name, var.speciation,var.sample_medium, var.value_type, var.is_regular.to_s, var.time_support.to_s, var.time_units_id.to_s, var.data_type, var.general_category, var.detection_limit.to_s]\n # @current_variables << @temp_array\n #end \n }\n #@variables = @project.variables.all(:order=>[:variable_name.asc]).variable_units\n #@vars = @variables.map{ |var| var.to_hash.merge!({:variable_units=>@units.get(var.variable_units_id)}) }\n \n respond_to do |format|\n format.html # new.html.erb\n format.json do\n render :json => @variables.as_json, :callback => params[:jsoncallback]\n end\n end\n end",
"def show\n\n \n end",
"def backend; end",
"def init(context={})\n\n app = context[:app]\n \n # View models\n ::Model::ViewModel.new(:content, 'content', ContentManagerSystem::Content, :view_template_contents,\n [::Model::ViewModelField.new(:_id, 'id', :string),\n ::Model::ViewModelField.new(:title, 'title', :string),\n ::Model::ViewModelField.new(:path, 'path', :string),\n ::Model::ViewModelField.new(:alias, 'alias', :string),\n ::Model::ViewModelField.new(:summary, 'summary', :string),\n ::Model::ViewModelField.new(:type, 'type', :string),\n ::Model::ViewModelField.new(:creation_date, 'creation_date', :date),\n ::Model::ViewModelField.new(:creation_user, 'creation_user', :string)])\n \n ::Model::ViewModel.new(:term, 'term', ContentManagerSystem::Term, :view_template_terms,\n [::Model::ViewModelField.new(:id, 'id', :serial),\n ::Model::ViewModelField.new(:description, 'description', :string)])\n\n ::Model::ViewModel.new(:profile, 'profile', Users::Profile, :view_template_profiles,[]) \n\n # View renders \n teaser_preprocessor = Proc.new do |data, context, render_options|\n data.map { |element| CMSRenders::Factory.get_render(element, context, 'teaser').render({}, [:ignore_complements, :ignore_blocks]) }\n end\n\n slider_preprocessor = Proc.new do |data, context, render_options|\n data.map { |element| CMSRenders::Factory.get_render(element, context, 'justphoto').render({}, [:ignore_complements, :ignore_blocks]) }\n end\n\n term_hierarchy_preprocessor = Proc.new do |data, context, render_options|\n separator = render_options['separator'] || \" · \"\n data.map do |element| \n terms = []\n terms << \"<a href=\\\"#{render_options['prefix']}/#{element.id}\\\">\"\n terms << \"#{element.description}</a>\"\n while not element.parent.nil?\n element = element.parent\n terms << separator\n terms << \"<a href=\\\"#{render_options['prefix']}/#{element.id}\\\">#{element.description}</a>\"\n end\n render_result = \"<div class=\\\"term-hierarchy-container #{render_options['container_class']}\\\">\" << terms.reverse.join << \"</div>\"\n end\n \n end\n\n ::Model::ViewRender.new(:teaser, 'teaser', ::Model::ViewStyle::VIEW_STYLE_TEASER, teaser_preprocessor)\n ::Model::ViewRender.new(:thumbnail, 'thumbnail', Model::ViewStyle::VIEW_STYLE_THUMBNAIL)\n\n end",
"def solution_paiement\n\n #add_breadcrumb \"solutions menu\", :access_sols_paiement\n #render layout: 'fylo'\n render layout: 'views/index'\n end",
"def functions\n\n end",
"def controller(controller); end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end"
] | [
"0.6637574",
"0.6565097",
"0.640837",
"0.62232405",
"0.62232405",
"0.61906534",
"0.61605495",
"0.61605495",
"0.61605495",
"0.61115706",
"0.61115706",
"0.61115706",
"0.6076323",
"0.60508007",
"0.5996973",
"0.59900814",
"0.59674263",
"0.5893612",
"0.58770144",
"0.58180743",
"0.58180743",
"0.58180743",
"0.580229",
"0.5801448",
"0.58009195",
"0.57892627",
"0.57892627",
"0.57619375",
"0.57619375",
"0.57619375",
"0.57619375",
"0.57619375",
"0.57619375",
"0.57619375",
"0.57619375",
"0.57619375",
"0.57619375",
"0.57565767",
"0.5737574",
"0.57350445",
"0.57193995",
"0.56971943",
"0.5681626",
"0.5681626",
"0.5681626",
"0.5681626",
"0.5681626",
"0.5662999",
"0.56432235",
"0.5631064",
"0.5625411",
"0.56206584",
"0.56206584",
"0.5617053",
"0.5613744",
"0.5604716",
"0.5600177",
"0.55950904",
"0.55898875",
"0.5587867",
"0.55842274",
"0.55842274",
"0.55842274",
"0.5556974",
"0.5541405",
"0.5541405",
"0.5541405",
"0.5541405",
"0.5541405",
"0.5541405",
"0.5541405",
"0.5541405",
"0.5541405",
"0.5541405",
"0.5534424",
"0.5534424",
"0.5522168",
"0.5521853",
"0.5521853",
"0.5521853",
"0.5507908",
"0.5507908",
"0.5507908",
"0.5498966",
"0.54978025",
"0.54945743",
"0.5492496",
"0.5488113",
"0.5481571",
"0.5480618",
"0.54803014",
"0.54752034",
"0.5474889",
"0.5474889",
"0.5474889",
"0.5474889",
"0.5474889",
"0.5474889",
"0.5474889",
"0.5474889",
"0.5474889"
] | 0.0 | -1 |
TO DYNAMICALLY POPULATE THE TEXT FIELDS FOR THE GRAPHS INPUT | def section_dyn_vals
name_like = params[:q]
type = params[:type]
section = Section.find(params[:section_id])
if type.eql?('subjects')
@objects = Subject.by_section(section.id)
elsif type.eql?('tests')
@objects = Test.by_section(section.id)
elsif type.eql?('students')
@objects = Student.by_section(section.id).name_like("%#{params[:q]}%")
#Student.where("section_id =? and name like ?", section.id, "%#{params[:q]}%")
end
respond_to do |format|
format.html
format.json { render :json => @objects.map(&:attributes) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def input_text_montant\n \"\".in_input_text(class:'medium', name:'facture[montant_amount]', id:'facture_montant_amount')\nend",
"def fill_inputs\n update(:all,'input').with do\n if element[:name] and element[:name].match(/([a-z,_]+)\\[([a-z,_]+)\\]/)\n element[:value] = send($1).send($2)\n end\n end\n update(:all,'textarea').with do\n if element[:name] and element[:name].match(/([a-z,_]+)\\[([a-z,_]+)\\]/)\n element.inner_html = send($1).send($2)\n end\n end\n end",
"def new_text_input\n end",
"def form_dynamic_textinput_names\r\n question1_element_name = \"\"\r\n question2_element_name = \"\"\r\n question3_element_name = \"\"\r\n dynamic_names = []\r\n\r\n answer_row1_element.text_field_elements.each do |page_input_element|\r\n question1_element_name = page_input_element.attribute(\"name\")\r\n dynamic_names << question1_element_name\r\n class_eval do\r\n text_field(question1_element_name.to_sym, :name=>question1_element_name)\r\n end\r\n end\r\n answer_row2_element.text_field_elements.each do |page_input_element|\r\n question2_element_name = page_input_element.attribute(\"name\")\r\n dynamic_names << question2_element_name\r\n class_eval do\r\n text_field(question2_element_name.to_sym, :name=>question2_element_name)\r\n end\r\n end\r\n answer_row3_element.text_field_elements.each do |page_input_element|\r\n question3_element_name = page_input_element.attribute(\"name\")\r\n dynamic_names << question3_element_name\r\n class_eval do\r\n text_field(question3_element_name.to_sym, :name=>question3_element_name)\r\n end\r\n end\r\n return dynamic_names\r\n end",
"def text_input; end",
"def populate_fields(target,data)\n data.each{|key,value|target.text_field(:name=>key).set value}\nend",
"def text_field; end",
"def build_get_pallet_number_form()\n\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n\tfield_configs = Array.new\n\n field_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'pallet_number'}\n\n\n\n\tbuild_form(nil,field_configs,'submit_mixed_pallet_id','pallet_number','submit')\n\nend",
"def input_text(name)\n field = field_content(name)\n id = field_id(name)\n {\n id: id,\n name: name,\n label: label(field, name),\n placeholder: prop(field, 'placeholder'),\n }\n end",
"def startEdit\n super\n create_text_field unless @text_field\n\n set_text nil\n set_graphic @text_field\n @text_field.select_all\n end",
"def input_text_group(name, values = [])\n field = field_content(name)\n field_name = prop(field, 'name') || name\n group = {}\n unless field.nil?\n group[:legend] = prop(field, 'label')\n group[:description] = prop(field, 'description')\n group[:description_id] = \"label-description-#{name}\"\n group[:label] = label(field, name)\n group[:name] = field_name\n group[:values] = values\n end\n group\n end",
"def draw_text_field\n setpos(divider_line, 0)\n attron(color_pair(COLOR_WHITE) | A_NORMAL) {\n addstr(\"Current Room:#{@currentRoom} #{(@joinedRooms.delete(@currentRoom)).to_a}\" + \" \" * cols)\n }\n cursor_to_input_line\n clrtoeol\n end",
"def e_textfields\n execute_script textfield_js\n end",
"def set_text_input(input); end",
"def build_default_screen\n\n hauliers = PartiesRole.find_by_sql(\"SELECT party_type_name,role_name,party_name FROM parties_roles WHERE parties_roles.party_type_name = 'ORGANIZATION' and parties_roles.role_name = 'HAULIER'\").map{|g|g.party_name}.join(\",\")\n hauliers = \", ,\" + hauliers\n\n field_configs = Array.new\n field_configs[field_configs.length()] = {:type=>\"static_text\",:name=>\"load_number\",:value=>@parent.load_number.to_s}\n field_configs[field_configs.length()] = {:type=>\"static_text\",:name=>\"booking_reference\",:value=>@parent.booking_reference.to_s}\n field_configs[field_configs.length()] = {:type=>\"static_text\",:name=>\"vessel_name\",:value=>@parent.vessel_name.to_s}\n field_configs[field_configs.length()] = {:type=>\"static_text\",:name=>\"voyage_number\",:value=>@parent.voyage_number.to_s}\n field_configs[field_configs.length()] = {:type=>\"static_text\",:name=>\"shipping_agent\",:value=>@parent.shipping_agent.to_s}\n field_configs[field_configs.length()] = {:type=>\"static_text\",:name=>\"shipping_line\",:value=>@parent.shipping_line}\n field_configs[field_configs.length()] = {:type=>\"static_text\",:name=>\"discharge_port\",:value=>@parent.discharge_port}\n field_configs[field_configs.length()] = {:type=>\"static_text\",:name=>\"quay_of_discharge_port\",:value=>@parent.quay_of_discharge_port.to_s}\n field_configs[field_configs.length()] = {:type=>\"text_box\",:name=>\"scan_load_bay\",:is_required=>\"true\"}\n field_configs[field_configs.length()] = {:type=>\"text_box\",:name=>\"truck_number\",:is_required=>\"true\"}\n field_configs[field_configs.length()] = {:type=>\"text_box\",:name=>\"seal_number\",:is_required=>\"true\"}\n field_configs[field_configs.length()] = {:type=>\"text_box\",:name=>\"container_number\",:is_required=>\"true\"}\n field_configs[field_configs.length()] = {:type=>\"text_box\",:name=>\"temperature_rhine\",:is_required=>\"true\"}\n field_configs[field_configs.length()] = {:type=>\"text_box\",:name=>\"temperature_rhine2\",:is_required=>\"true\"}\n field_configs[field_configs.length()] = {:type=>\"drop_down\",:name=>\"haulier_code\",:is_required=>\"true\", :list => hauliers, :value =>'haulier_party_role_id'}\n field_configs[field_configs.length()] = {:type=>\"text_box\",:name=>\"container_size\",:is_required=>\"true\"}\n field_configs[field_configs.length()] = {:type=>\"text_box\",:name=>\"cto_consec_no\",:is_required=>\"false\"}\n\n\n screen_attributes = {:auto_submit=>\"false\",:content_header_caption=>\"load_container\"}\n buttons = {\"B3Label\"=>\"\" ,\"B2Label\"=>\"\",\"B1Submit\"=>\"load_container_submit\",\"B1Label\"=>\"submit\",\"B1Enable\"=>\"true\",\"B2Enable\"=>\"false\",\"B3Enable\"=>\"false\" }\n plugins = nil\n result_screen_def = PdtScreenDefinition.gen_screen_xml(field_configs,buttons,screen_attributes,plugins)\n\n return result_screen_def\n end",
"def render_grid_input(name, value, **opt)\n render_form_input(name, value, **opt, type: :textarea)\n end",
"def custom_field_text(field, text)\n frm.text_field(:name=>field).set(text)\n end",
"def build_input(value, index)\n options = build_field_options(value, index)\n\n # convert name from 'publication[title]' to 'publication[title_value]'\n options[:name] = options[:name].gsub(/\\[([^\\]]+)\\]/, '[\\1_value]')\n\n if options.delete(:type).to_s == 'textarea'\n @builder.text_area(attribute_name, options)\n else\n @builder.text_field(attribute_name, options)\n end\n end",
"def ing_form; end",
"def pbTextEntry(helptext,minlength,maxlength,variableNumber)\n $game_variables[variableNumber] = pbEnterText(helptext,minlength,maxlength)\n $game_map.need_refresh = true if $game_map\nend",
"def new_field\n # You can add fields of choice to your farm by specifying their type (eg. \"corn\") and their total area in hectares (eg. 100).\n print 'What type of crop? '\n crop_type = gets.chomp\n print 'How many hectares? '\n crop_hectares = gets.to_i\n #binding.pry\n print 'How much food will it produce per hectare? '\n food_per_hectare = gets.to_i\n Crop.new_field(crop_type, crop_hectares, food_per_hectare)\n end",
"def create_input object_id, model_name, text_area_cols=66\n\n coder = HTMLEntities.new # create a coder to code value fields for each question\n\n obj_id = object_id\n obj_string = get_camel_caps(model_name)\n obj = obj_string.constantize.find(obj_id)\n obj_type = obj.field_type\n subq_field_name = model_name + \"_sub[\" + obj_id.to_s + \"]\"\n editing = @study.nil?\n retVal = \"\"\n if obj_type.match(\"matrix_\")\n retVal = create_matrix_input(obj, obj_type, model_name, {:editing=>editing})\n else\n\n # if this is a text field there are no options. otherwise, get the options\n unless obj_type == \"text\"\n # gather options for this field\n question_choices = (obj_string + \"Field\").constantize.where(model_name + \"_id\" => obj_id).order(\"row_number ASC\")\n options = question_choices.collect{|opt| opt.option_text}\n\n end\n chosen_values = []\n #unless session[:study_id].nil?\n unless @study.nil?\n chosen = get_selected(obj_id, model_name, obj_string)\n chosen_values = chosen.collect{|x| x[0]}\n chosen_subqs = chosen.collect{|x| x[1]}\n end\n case obj_type\n # RADIO BUTTON INPUTS\n when \"radio\", \"yesno\"\n i=0\n options.each do |option|\n checked = \"\"\n if chosen_values.include?(option.to_s)\n checked = \"CHECKED\"\n end\n\n retVal += '<input aria-label=\"Question Answer Option\" class=\"cbox question_radio_input editable_field\" title=\"option\" type=\"radio\" section_name=\"'+model_name+'\" option_id=\"'+question_choices[i].id.to_s+'\" obj_id=\"'+obj.id.to_s+'\" name=\"'+model_name+'['+obj_id.to_s+']\" value=\"' + coder.encode(option.to_s.gsub('\"','\\\"')) + '\" ' + 'id = \"' + model_name + '_' + obj_id.to_s + '_' + question_choices[i].id.to_s + '\" ' + checked.to_s + '> <label>' + option.to_s + '</label>'\n\n if question_choices[i].has_subquestion\n #retVal += '... <span class=\"radio_group_'+obj_id.to_s+'\" id=\"option_' + question_choices[i].id.to_s + '_sq_span\">'\n retVal += \"...<span class='radio_group_#{obj_id.to_s}' id='option_#{question_choices[i].id.to_s}_sq_span'>\"\n disabled = \"\"\n\n if checked == \"CHECKED\"\n subq_val = chosen_subqs[chosen_values.index(option.to_s)]\n retVal += fill_in_subquestion(question_choices[i].subquestion, subq_val, subq_field_name, 'radio',\"false\")\n else\n retVal += fill_in_subquestion(question_choices[i].subquestion, nil, subq_field_name, 'radio',\"disabled\")\n end\n retVal += '</span>'\n end\n retVal += \"<br/>\"\n i+=1\n end\n unless editing || obj_string.match(\"^Eft\")\n retVal += \"<br/><a href='#' class='clear_selection_link' question_name='#{model_name}[#{obj_id.to_s}]'>Clear Selections</a><br/>\"\n end\n # SELECT (DROPDOWN BOX) INPUTS\n when \"select\"\n retVal += '<select class=\"question_select_input editable_field\" title=\"Make Your Selection\" section_name=\"'+model_name+'\" obj_id=\"'+obj_id.to_s+'\" name=\"'+model_name+'['+obj_id.to_s+']\" id=\"'+model_name+'_'+obj_id.to_s+'\">'\n # NO LONGER USING THE AUTO-OTHER FIELD\n #retVal += attach_listener_for_other(model_name+\"_\"+obj_id.to_s)\n\n #some variables for showing the other fields\n\n # WE ARE NO LONGER USING THE 'OTHER' FIELD SINCE USERS CAN ADD THEIR OWN\n #options << 'Other'\n text_input = \"\"\n found_it = false\n found_at_index = -1\n i=0\n retVal += \"<option value='' >-- Make Your Selection --</option>\"\n options.each do |option|\n selected = \"\"\n if chosen_values.include?(option.to_s)\n selected = \"SELECTED\"\n found_it = true\n found_at_index = i\n # NO LONGER USING THE AUTOMATIC 'OTHER' FIELD\n #elsif chosen_values.length > 0 && !found_it && option.to_s == \"Other\"\n #\tselected = \"SELECTED\"\n #\ttext_input = get_other_input_element(chosen_values[0], obj_id.to_s, model_name)\n end\n continued=\"\"\n if !question_choices[i].nil?\n if question_choices[i].has_subquestion\n continued = \"...\"\n end\n end\n\n retVal += '<option value=\"' + coder.encode(option.to_s.gsub('\"','\\\"')) + '\" ' + selected + \">\" + option.to_s + continued+\"</option>\"\n i+=1\n end\n retVal +=\"</select> <span id='select_\" + obj_id.to_s + \"_sq_span'>\"\n if found_it && found_at_index > -1\n if question_choices[found_at_index].has_subquestion\n subq_val = chosen_subqs[chosen_values.index(options[found_at_index])]\n retVal += fill_in_subquestion(question_choices[found_at_index].subquestion, subq_val, subq_field_name, 'select',\"false\")\n end\n ## TOOK OUT THE FOLLOWING LINES WHEN ADDING IN 'MAKE YOUR SELECTION' OPTION\n #elsif\tquestion_choices[0].has_subquestion\n #\tretVal += fill_in_subquestion(question_choices[0].subquestion,nil,subq_field_name,\"select\",false)\n end\n\n retVal += \"</span>\"\n retVal += text_input.to_s\n # CHECKBOX INPUTS\n when \"checkbox\"\n i=0\n options.each do |option|\n checked = \"\"\n if chosen_values.include?(option.to_s)\n checked = \"checked\"\n end\n retVal += '<input aria-label=\"Question Answer Field\" type=\"checkbox\" title=\"option\" section_name=\"'+model_name+'\" class=\"cbox question_checkbox_input editable_field\" ' + checked + ' option_id=\"'+question_choices[i].id.to_s+'\" obj_id=\"'+obj_id.to_s+'\" name=\"'+model_name+'['+obj_id.to_s+'][]\" id=\"'+model_name+'_'+obj_id.to_s+'_'+question_choices[i].id.to_s+'\" value=\"' + coder.encode(option.to_s.gsub('\"','\\\"')) + '\"> <label>' + option.to_s + '</label>'\n\n if question_choices[i].has_subquestion\n retVal += '... <span class=\"checkbox_group_'+obj_id.to_s+'\" id=\"option_' + question_choices[i].id.to_s + '_sq_span\">'\n\n field_name = model_name + \"_sub[\" + obj_id.to_s + \"][\" + question_choices[i].id.to_s + \"]\"\n\n if checked == \"checked\"\n subq_val = chosen_subqs[chosen_values.index(option.to_s)]\n retVal += fill_in_subquestion(question_choices[i].subquestion, subq_val, field_name, 'checkbox',\"\")\n else\n retVal += fill_in_subquestion(question_choices[i].subquestion, nil, field_name, 'checkbox',\"disabled\")\n end\n retVal += '</span>'\n end\n retVal += \"<br/>\"\n i+=1\n end\n else\n value=\"\"\n unless chosen_values.empty?\n value = \"value='#{chosen_values[0]}'\"\n end\n #retVal += '<input type=\"text\"\" class=\"editable_field\" id=\"'+model_name+'_'+obj_id.to_s+'\" name=\"'+model_name+'[' + obj_id.to_s+ ']\"' + value +'>'\n retVal += \"<textarea aria-label='Question Answer Field' cols=#{text_area_cols} rows=1 class='editable_field' id='#{model_name + '_' + obj_id.to_s}' name='#{model_name+'['+obj_id.to_s+']'}'>#{chosen_values.first}</textarea>\"\n end\n end\n return retVal\n end",
"def mixed_pallet_criteria\n render :inline => %{\n\t\t<% @content_header_caption = \"'please enter pallet number'\"%>\n\n\t\t<%= build_get_pallet_number_form()%>\n\n\t\t}, :layout => 'content'\n\n end",
"def get_string label, config={} # yield Field\n config[:title] ||= \"Entry\"\n config[:title_color] ||= $reversecolor\n label_config = config[:label_config] || {}\n label_config[:row] ||= 2\n label_config[:col] ||= 2\n label_config[:text] = label\n\n field_config = config[:field_config] || {}\n field_config[:row] ||= 3\n field_config[:col] ||= 2\n #field_config[:attr] = :reverse\n field_config[:color] ||= :black\n field_config[:bgcolor] ||= :cyan\n field_config[:maxlen] ||= config[:maxlen]\n field_config[:default] ||= config[:default]\n field_config[:default] = field_config[:default].chomp if field_config[:default]\n field_config[:name] = :name\n #field_config[:width] ||= 50 # i want it to extend since i don't know the actual width\n #field_config[:width] ||= 50 # i want it to extend since i don't know the actual width\n field_config[:width] ||= (field_config[:width] || 50)\n\n defwid = config[:default].nil? ? 30 : config[:default].size + 13\n w = [label.size + 8, defwid, field_config[:width]+13 ].max\n config[:width] ||= w\n ## added history 2013-03-06 - 14:25 : we could keep history based on prompt\n $get_string_history ||= []\n #$log.debug \"XXX: FIELD SIZE #{w} \"\n #$log.debug \"XXX: FIELD CONFIG #{field_config} \"\n tp = MessageBox.new config do\n button_type :ok_cancel\n default_button 0\n item Label.new nil, label_config\n fld = Field.new nil, field_config\n item fld\n ## added field history 2013-03-06 - 14:24 \n require 'canis/core/include/rhistory'\n fld.extend(FieldHistory)\n # We need to manually set history each time, since the field is recreated\n # with the messagebox. Otherwise, field can on its own handle history\n fld.history($get_string_history)\n end\n # added yield to override settings\n yield tp.form.by_name[:name] if block_given?\n index = tp.run\n if index == 0 # OK\n ## added field history 2013-03-06 - 14:24 \n t = tp.form.by_name[:name].text\n $get_string_history << t if t && !$get_string_history.include?(t)\n return t\n else # CANCEL\n # Should i use nil or blank. I am currently opting for nil, as this may imply to caller\n # that user does not wish to override whatever value is being prompted for.\n return nil\n end\nend",
"def render_proceedings(p)\n r = \"\"\n if p.editors.size > 0 then\n r += p.editors.map {|e| e.abbreviated_name}.joined_by_comma_and_and + \", editor. \"\n else\n r += text_for_field(\"Organization\", p, :postfix => \". \")\n end\n\n r += p.title.detex.titlecase\n\n if field(p,\"Volume\") then\n r += text_for_field(\"Volume\", p, :prefix => \", volume \")\n r += text_for_field(\"Series\", p, :prefix => \" of \")\n else\n if field(p,\"Number\") then\n r += text_for_field(\"Number\", p, :prefix => \", number \")\n r += text_for_field(\"Series\", p, :prefix => \" in \")\n else\n r += text_for_field(\"Series\", p, :prefix => \", \")\n end\n end\n\n if field(p,\"Address\") then\n r += text_for_field(\"Address\", p, :prefix => \", \", :postfix => \", \")\n r += month_for_field(\"Month\", p, :postfix => \" \")\n r += text_for_field(\"Year\", p, :postfix => \". \")\n r += text_for_field(\"Organization\", p, :postfix => \", \")\n r += text_for_field(\"Publisher\", p)\n else\n r += \". \"\n r += text_for_field(\"Organization\", p, :postfix => \", \")\n r += text_for_field(\"Publisher\", p)\n r += month_for_field(\"Month\", p, :postfix => \" \")\n r += text_for_field(\"Year\", p, :postfix => \". \")\n end\n \n r += text_for_field(\"Note\", p, :prefix => \". \", :postfix => \".\").detex # \n return r\nend",
"def create_inputs\n @inputs = Array.new(@max_size) do |i|\n add_text(base_x + i * delta_x, base_y + delta_y, delta_x, delta_y, NO_CHAR, 1)\n end\n end",
"def print_filled_field\n field.create_empty_field\n\n # Add an apple to the field.\n field.field_matrix[apple.vertical_location][apple.horizontal_location] = ' o '\n\n # Add a snake to the field.\n snake.snake_matrix.each do |part|\n field.field_matrix[part.first][part.last] = ' x '\n end\n\n print_field\n end",
"def settings_group_text(name, prop_name, conf_name, options = {}, html_options = {})\n opts = {:sufix => \"\"}.merge(options)\n html_opts ={\n :class => \"input\",\n :size => \"35\",\n :maxlength => \"50\"}.merge(html_options)\n settings_group_line(name, html_options[:tip]) {\n \"#{text_field_tag(prop_name, Confline.get_value(conf_name, session[:user_id]), html_opts)}#{opts[:sufix]}\"\n }\n end",
"def save_values\n self.first_name = @first_name_field.text.strip.chomp\n self.last_name = @last_name_field.text.strip.chomp\n self.email = @email_field.text.strip.chomp\n self.github = @github_field.text.strip.chomp\n self.twitter = @twitter_field.text.strip.chomp\n self.fun_fact = @fun_fact_field.text.strip.chomp\n # self.preferred_text_editor = @preferred_text_editor.text.strip.chomp\n # self.teaching_experience = @teaching_experience.text.strip.chomp\n # TODO: 2. Finish the implementation to set the other fields.\n end",
"def render_manual(p)\n r = \"\"\n if p.authors.size > 0 then\n r += p.authors.map {|a| a.abbreviated_name}.joined_by_comma_and_and + \". \"\n end\n\n r += p.title.detex.titlecase + \". \"\n r += text_for_field(\"Organization\", p, :postfix => \", \").detex\n r += text_for_field(\"Address\", p, :postfix => \", \").detex\n\n if field(p,\"Edition\") then\n r += text_for_field(\"Edition\", p).titlecase.detex + \" edition, \"\n end\n\n r += month_for_field(\"Month\", p, :postfix => \" \").detex\n r += text_for_field(\"Year\", p, :postfix => \". \").detex\n r += text_for_field(\"Note\", p, :postfix => \". \").detex\n return r\nend",
"def show_other_filled field_id, value, field_name\n coder = HTMLEntities.new # create a coder to code value fields for each question\n retVal = '<span id=\"other_'+field_id+'\" class=\"other_field\" style=\"padding:0px;\"><br/><br/>Please specify:'\n retVal += '<input id=\"' + field_id + '_input\" type=\"text\" title=\"other\" style=\"width:75%;\" name=\"' + field_name + '\" value = \"' + coder.encode(value) + '\"></span>'\n return retVal\n end",
"def build_support_field(feature)\n {\n :title => \"Total support worldwide\",\n :value => \"#{feature[\"usage_perc_y\"]}%\"\n }\nend",
"def text text\n case @current_element\n when 'firstname'\n @current_person[:firstname] = text\n when 'lastname'\n @current_person[:lastname] = text\n when 'adAccount'\n @current_person[:ad_account] = text\n when 'accountId'\n @current_person[:sam_account_name] = text\n when 'workToDate'\n @current_person[:work_to_date] = text\n when 'emailAddress'\n @current_person[:email] = text\n end\n # Reset the current element som we don't pick up empty text.\n @current_element = nil\n end",
"def start\n fill_field\n output\n end",
"def input(wrapper_options)\n @builder.text_field(attribute_name, input_html_options) + \\\n @builder.hidden_field(attribute_name, value: input_html_options[:value], class: attribute_name.to_s + \"-alt\")\n end",
"def text_fill_in(locator, options = {})\n id = find_field(locator).native[:id]\n evaluate_script \"document.getElementById('#{id}').type = 'text'\"\n fill_in locator, options\nend",
"def e_textfields\n xpaths 'textfield'\n end",
"def generate_controls(text)\n contents_text = \"\"\n loop do\n c = text.slice!(/./m)\n case c\n when nil\n break\n #--------------------------\n # DEFAULT FEATURES\n #-----------------------\n when \"\\x01\"\n text.sub!(/\\[([0-9]+)\\]/, \"\")\n @last_color = $1.to_i\n contents.font.color = text_color($1.to_i)\n \n #--------------------------\n # * NMS FEATURES!!\n #-----------------------\n when \"\\x83\"\n text.sub!(/\\[([0-9]+)\\]/, \"\")\n\n new_line if (@contents_x + 24 > contents.width)\n\n # Draw ICON\n ucIcon = UCIcon.new(self, Rect.new(@contents_x, @contents_y, 24, 24), $1.to_i)\n @cControlsList.push(ucIcon)\n @contents_x += 24\n when \"\\x84\"\n text.sub!(/\\[(.*?)\\]/, \"\")\n contents.font.name = $1.to_s\n when \"\\x85\"\n text.sub!(/\\[([0-9]+)\\]/, \"\")\n contents.font.size = $1.to_i\n when \"\\x86\"\n contents.font.name = Font.default_name \n when \"\\x87\"\n contents.font.size = Font.default_size\n when \"\\x88\"\n contents.font.bold = contents.font.bold == true ? false : true\n when \"\\x89\"\n contents.font.italic = contents.font.italic == true ? false : true\n when \"\\x93\"\n contents.font.shadow = contents.font.shadow == true ? false : true\n when \"\\x11\"\n text.sub!(/\\[(.*?)\\]/, \"\")\n a = $1.to_s.split(',')\n bitmap = Cache.picture(a[0])\n\n new_line if (@contents_x + bitmap.width > contents.width)\n \n # Size\n if !a[1].nil? && !a[1].empty?\n width = a[1].to_i\n else\n width = bitmap.width\n end\n if !a[2].nil? && !a[2].empty?\n height = a[2].to_i\n else\n height = bitmap.height\n end\n \n # Border\n if !a[3].nil? && !a[3].empty?\n border = a[3].to_i \n else\n border = 0\n end\n if !a[4].nil? && !a[4].empty?\n border_color = text_color(a[4].to_i)\n else\n border_color = nil\n end\n\n # Draw Image\n ucImageBorder = UCImageBorder.new(self, Rect.new(@contents_x, @contents_y, width, height),\n bitmap, Rect.new(0,0, width-border*2, height-border*2),\n 0, 255, 0, border, border_color)\n @cControlsList.push(ucImageBorder)\n \n @contents_x += width\n @biggest_text_height = height if height > @biggest_text_height\n #bitmap.dispose\n when \"\\x12\"\n text.sub!(/\\[([0-9]+)\\]/, \"\")\n\n new_line if (@contents_x + 96 > contents.width)\n\n # Draw Face\n actor = Game_Actor.new($1.to_i)\n ucCharFace = UCCharacterFace.new(self, Rect.new(@contents_x, @contents_y, 96, 96), actor)\n @cControlsList.push(ucCharFace)\n \n @biggest_text_height = 96 if 96 > @biggest_text_height\n else\n # Draw Text\n next_char = text.slice(/./m)\n contents_text += c\n if next_char == nil || next_char.match(/[\\x01-\\x12\\x80-\\xff]/) != nil\n text_height = contents.get_text_height(contents_text)\n if text_height < WLH\n text_height = WLH\n end\n @biggest_text_height = text_height if text_height > @biggest_text_height\n\n rect = Rect.new(@contents_x, @contents_y, contents.width, @biggest_text_height)\n cLabel = CLabel.new(self, rect, contents_text, 0, contents.font.clone, \n true, false, 3)\n @cControlsList.push(cLabel)\n \n lines = contents.split_multiline(rect, contents_text, 3)\n if lines.size > 1\n text_height = contents.get_text_height(contents_text)\n if text_height < WLH\n text_height = WLH\n end\n text_height = @biggest_text_height + text_height * (lines.size-2)\n @biggest_text_height = text_height if text_height > @biggest_text_height\n new_line\n end\n\n contents_text = \"\"\n @contents_x += contents.get_text_width(lines[lines.size-1])\n end\n \n end\n end\n\n end",
"def get_charges\n #fill in the remaining claim info\n # box 28\n text_box sprintf(\"%.2f\", @charges_for_service.to_s), :at => [370, 82]\n # box 29\n text_box sprintf(\"%.2f\", @copay_amount.to_s), :at => [450, 82]\n # box 30\n text_box sprintf(\"%.2f\", @balance_owed.to_s), :at => [520, 82]\n end",
"def type_value_fields(f)\n controls = []\n\n options_values = INGEST_MAP[f.object.group.to_sym].keys\n options = options_values.collect do |val|\n [OregonDigital::Metadata::FieldTypeLabel.for(val.to_s), val]\n end\n\n controls << f.input(\n :type,\n :collection => options,\n :input_html => {:class => \"input-medium type-selector\"},\n :label_html => {:class => \"sr-only\"},\n :wrapper_html => {:class => \"ingest-control type\"}\n )\n\n input_args = {\n :input_html => {:class => \"input-xxlarge value-field\"},\n :label_html => {:class => \"sr-only\"},\n :wrapper_html => {:class => \"ingest-control value\"}\n }\n\n # SUPER HACK! If we're looking at sets, we don't want free-text, we want a\n # drop-down. Ideally we'd have a nicer way to make any given type do this,\n # but the grouping dropdown makes it really tough without some painful new\n # configurable ingest map format combined with JavaScript that swaps a\n # dropdown over the text input magically\n if f.object.group.to_sym == :collection\n set_pids = ActiveFedora::SolrService.query(\n \"has_model_ssim:#{RSolr.escape(\"info:fedora/afmodel:GenericCollection\")}\",\n :rows => 100000\n )\n prefix = \"http://oregondigital.org/resource\"\n set_options = set_pids.map do |pid|\n set = GenericCollection.load_instance_from_solr(pid[\"id\"], pid)\n [\"#{set.title} (#{set.pid})\", \"#{prefix}/#{set.pid}\"]\n end\n\n input_args[:collection] = set_options.sort\n selected = f.object.value\n if selected.nil? || !selected.start_with?(prefix)\n selected = f.object.internal\n end\n input_args[:selected] = selected\n input_args[:include_blank] = true\n end\n\n controls << f.input(:value, input_args)\n\n if f.object.cloneable?\n controls << f.input(\n :clone,\n :as => :boolean,\n :input_html => {:class => \"input-xxlarge clone-field\"},\n :label_html => {:class => \"sr-only\"},\n :wrapper_html => {:class => \"ingest-control clone\"},\n :label => \"Clone this #{f.object.group}\"\n )\n end\n\n # Super hack, continued: don't put an internal field on the form for sets\n if f.object.group.to_sym != :collection\n controls << f.hidden_field(:internal, :class => \"internal-field\")\n end\n\n return controls.reduce { |list, next_control| list << next_control }\n end",
"def set_text field_label, field_value\n #field_id = self.full_content_element.html.match(/for=\".+\">#{field_label}/).to_s.sub('for=\"','').sub(\">#{field_label}\",'').chop\n field_id = self.html.match(/for=\".+\">#{field_label}/).to_s.sub('for=\"','').sub(\">#{field_label}\",'').chop\n self.execute_script(\"document.getElementById('\" + field_id + \"').value = '\" + field_value + \"';\")\n end",
"def assignment_instructions\n frm.div(:class=>\"textPanel\").text\n end",
"def assignment_instructions\n frm.div(:class=>\"textPanel\").text\n end",
"def generate_attribute_input(attr_label)\r\n input_html = ''.html_safe\r\n\r\n # Get the attribute hash corresponding to the given attribute\r\n attr = @metadata.select{ |attr_hash| attr_hash[\"attribute\"].to_s.eql?(attr_label) }.first\r\n\r\n if attr[\"enforce\"].include?(\"integer\")\r\n number_field :submission, attr[\"attribute\"].to_s.to_sym, value: @submission.send(attr[\"attribute\"])\r\n\r\n elsif attr[\"enforce\"].include?(\"date_time\")\r\n if @submission.send(attr[\"attribute\"]).nil?\r\n date_value = nil\r\n else\r\n date_value = DateTime.parse(@submission.send(attr[\"attribute\"])).to_date.to_s\r\n end\r\n text_field(:submission, attr[\"attribute\"].to_s.to_sym, :class => \"datepicker\", value: \"#{date_value}\")\r\n\r\n elsif attr[\"enforce\"].include?(\"textarea\")\r\n text_area(:submission, attr[\"attribute\"].to_s.to_sym, rows: 3, value: @submission.send(attr[\"attribute\"]))\r\n\r\n # Create select dropdown when there are enforcedValues for the attr. But also let the user enter its own value if Other selected\r\n elsif !attr[\"enforcedValues\"].nil?\r\n metadata_values = @submission.send(attr[\"attribute\"])\r\n select_values = attr[\"enforcedValues\"].collect{ |k, v| [v,k]}\r\n # Add in the select ontologies that are not in the portal but are in the values\r\n if metadata_values.kind_of?(Array)\r\n metadata_values.map do |metadata|\r\n if !select_values.flatten.include?(metadata)\r\n select_values << metadata\r\n end\r\n end\r\n else\r\n if (!select_values.flatten.include?(metadata_values) && !metadata_values.to_s.empty?)\r\n select_values << metadata_values\r\n end\r\n end\r\n\r\n if attr[\"enforce\"].include?(\"list\")\r\n input_html << select_tag(\"submission[#{attr_label}][]\", options_for_select(select_values, metadata_values), :multiple => 'true',\r\n \"data-placeholder\".to_sym => \"Select ontologies\", :style => \"margin-bottom: 15px; width: 100%;\", :id => \"select_#{attr[\"attribute\"]}\", :class => \"selectOntology\")\r\n\r\n input_html << text_field_tag(\"add_#{attr[\"attribute\"].to_s}\", nil, :style => \"margin-left: 1em; margin-right: 1em;width: 16em;\", :placeholder => \"Or provide the value\",\r\n :onkeydown => \"if (event.keyCode == 13) { addOntoToSelect('#{attr[\"attribute\"]}'); return false;}\")\r\n\r\n input_html << button_tag(\"Add new value\", :id => \"btnAdd#{attr[\"attribute\"]}\", :style => \"margin-bottom: 2em;vertical-align: baseline;\",\r\n :type => \"button\", :class => \"btn btn-info btn-sm\", :onclick => \"addOntoToSelect('#{attr[\"attribute\"]}')\")\r\n\r\n else\r\n\r\n select_values << [\"None\", \"\"]\r\n select_values << [\"Other\", \"other\"]\r\n\r\n if metadata_values.nil?\r\n metadata_values = \"\"\r\n end\r\n\r\n input_html << select(\"submission\", attr[\"attribute\"], select_values, { :selected => metadata_values}, {:class => \"form-control\", :id => \"select_#{attr[\"attribute\"]}\", :style=> \"margin-bottom: 1em;\"})\r\n\r\n # Button and field to add new value (that are not in the select). Show when other is selected\r\n input_html << text_field_tag(\"add_#{attr[\"attribute\"].to_s}\", nil, :style => \"margin-left: 1em; margin-right: 1em;width: 16em;display: none;\", :placeholder => \"Or provide the value\",\r\n :onkeydown => \"if (event.keyCode == 13) { addValueToSelect('#{attr[\"attribute\"]}'); return false;}\")\r\n\r\n input_html << button_tag(\"Add new value\", :id => \"btnAdd#{attr[\"attribute\"]}\", :style => \"margin-bottom: 2em;display: none;vertical-align: baseline;\",\r\n :type => \"button\", :class => \"btn btn-info btn-sm\", :onclick => \"addValueToSelect('#{attr[\"attribute\"]}')\")\r\n\r\n # To show/hide textbox when other option is selected or not\r\n input_html << javascript_tag(\"$(function() {\r\n $('#select_#{attr[\"attribute\"]}').change(function() {\r\n if ($('#select_#{attr[\"attribute\"]}').val() == 'other') {\r\n $('#add_#{attr[\"attribute\"].to_s}').val(\"\");\r\n $('#btnAdd#{attr[\"attribute\"]}').show();\r\n $('#add_#{attr[\"attribute\"].to_s}').show();\r\n } else {\r\n $('#btnAdd#{attr[\"attribute\"]}').hide();\r\n $('#add_#{attr[\"attribute\"].to_s}').hide();\r\n }\r\n });\r\n })\")\r\n\r\n end\r\n\r\n\r\n return input_html\r\n\r\n\r\n elsif attr[\"enforce\"].include?(\"isOntology\")\r\n metadata_values = @submission.send(attr[\"attribute\"])\r\n select_values = @ontologies_for_select.dup\r\n # Add in the select ontologies that are not in the portal but are in the values\r\n if metadata_values.kind_of?(Array)\r\n metadata_values.map do |metadata|\r\n if !select_values.flatten.include?(metadata)\r\n select_values << metadata\r\n end\r\n end\r\n else\r\n\r\n if !select_values.flatten.include?(metadata_values)\r\n select_values << metadata_values\r\n end\r\n end\r\n\r\n if attr[\"enforce\"].include?(\"list\")\r\n input_html << select_tag(\"submission[#{attr_label}][]\", options_for_select(select_values, metadata_values), :multiple => 'true',\r\n \"data-placeholder\".to_sym => \"Select ontologies\", :style => \"margin-bottom: 15px; width: 100%;\", :id => \"select_#{attr[\"attribute\"]}\", :class => \"selectOntology\")\r\n\r\n else\r\n input_html << select_tag(\"submission[#{attr_label}]\", options_for_select(select_values, metadata_values), \"data-placeholder\".to_sym => \"Select ontology\",\r\n :style => \"margin-bottom: 15px; width: 100%;\", :id => \"select_#{attr[\"attribute\"]}\", :class => \"selectOntology\", :include_blank => true)\r\n end\r\n # Button and field to add new value (not in the select)\r\n input_html << tag(:br)\r\n\r\n input_html << text_field_tag(\"add_#{attr[\"attribute\"]}\", nil, :style => \"margin-left: 1em; margin-right: 1em;vertical-align: super;width: 16em;\",\r\n :placeholder => \"Ontology outside of the Portal\", :onkeydown => \"if (event.keyCode == 13) { addOntoToSelect('#{attr[\"attribute\"]}'); return false;}\")\r\n\r\n input_html << button_tag(\"Add new ontology\", :id => \"btnAdd#{attr[\"attribute\"]}\", :style => \"margin-bottom: 2em;margin-top: 1em;\",\r\n :type => \"button\", :class => \"btn btn-info btn-sm\", :onclick => \"addOntoToSelect('#{attr[\"attribute\"]}')\")\r\n\r\n return input_html\r\n\r\n elsif attr[\"enforce\"].include?(\"uri\")\r\n if @submission.send(attr[\"attribute\"]).nil?\r\n uri_value = \"\"\r\n else\r\n uri_value = @submission.send(attr[\"attribute\"])\r\n end\r\n\r\n if attr[\"enforce\"].include?(\"list\")\r\n input_html << button_tag(\"Add new value\", :id => \"add#{attr[\"attribute\"]}\", :style => \"margin-bottom: 0.5em;margin-top: 0.5em;margin-left: 0.5em;\",\r\n :type => \"button\", :class => \"btn btn-info btn-sm\", :onclick => \"addInput('#{attr[\"attribute\"]}', 'url')\")\r\n input_html << url_field_tag(\"submission[#{attr[\"attribute\"].to_s}][]\", uri_value[0], :id => attr[\"attribute\"].to_s, class: \"metadataInput\")\r\n # Add field if list of URI\r\n if [email protected](attr[\"attribute\"]).nil? && @submission.send(attr[\"attribute\"]).any?\r\n @submission.send(attr[\"attribute\"]).each_with_index do |metadata_val, index|\r\n if index != 0\r\n input_html << url_field_tag(\"submission[#{attr[\"attribute\"].to_s}][]\", metadata_val, :id => \"submission_#{attr[\"attribute\"].to_s}\", class: \"metadataInput\")\r\n end\r\n end\r\n end\r\n input_html << content_tag(:div, \"\", id: \"#{attr[\"attribute\"]}Div\")\r\n\r\n else\r\n # if single value\r\n input_html << text_field(:submission, attr[\"attribute\"].to_s.to_sym, value: uri_value, class: \"metadataInput\")\r\n end\r\n return input_html\r\n\r\n elsif attr[\"enforce\"].include?(\"boolean\")\r\n select(\"submission\", attr[\"attribute\"].to_s, [\"none\", \"true\", \"false\"], { :selected => @submission.send(attr[\"attribute\"])},\r\n {:class => \"form-control\", :style => \"margin-top: 0.5em; margin-bottom: 0.5em;\"})\r\n\r\n else\r\n # If input a simple text\r\n\r\n if attr[\"enforce\"].include?(\"list\")\r\n input_html << button_tag(\"Add new value\", :id => \"add#{attr[\"attribute\"]}\", :style => \"margin-bottom: 0.5em;margin-top: 0.5em;\",\r\n :type => \"button\", :class => \"btn btn-info btn-sm\", :onclick => \"addInput('#{attr[\"attribute\"]}', 'text')\")\r\n firstVal = \"\"\r\n if [email protected](attr[\"attribute\"]).nil? && @submission.send(attr[\"attribute\"]).any?\r\n firstVal = @submission.send(attr[\"attribute\"])[0]\r\n end\r\n input_html << text_field_tag(\"submission[#{attr[\"attribute\"].to_s}][]\", firstVal, :id => attr[\"attribute\"].to_s, class: \"metadataInput\")\r\n\r\n # Add field if list of metadata\r\n if [email protected](attr[\"attribute\"]).nil? && @submission.send(attr[\"attribute\"]).any?\r\n @submission.send(attr[\"attribute\"]).each_with_index do |metadata_val, index|\r\n if index != 0\r\n input_html << text_field_tag(\"submission[#{attr[\"attribute\"].to_s}][]\", metadata_val, :id => \"submission_#{attr[\"attribute\"].to_s}\", class: \"metadataInput\")\r\n end\r\n end\r\n end\r\n\r\n input_html << content_tag(:div, \"\", id: \"#{attr[\"attribute\"]}Div\")\r\n\r\n else\r\n # if single value text\r\n # TODO: For some reason @submission.send(\"URI\") FAILS... I don't know why... so I need to call it manually\r\n if attr[\"attribute\"].to_s.eql?(\"URI\")\r\n input_html << text_field(:submission, attr[\"attribute\"].to_s.to_sym, value: @submission.URI,class: \"metadataInput\")\r\n else\r\n input_html << text_field(:submission, attr[\"attribute\"].to_s.to_sym, value: @submission.send(attr[\"attribute\"]), class: \"metadataInput\")\r\n end\r\n end\r\n return input_html\r\n end\r\n end",
"def build_field(raw_value, index = nil)\n value, language = parse_value(raw_value)\n\n <<-HTML\n <div class=\"row\">\n <div class=\"col-sm-10\">\n #{build_input(value, index)}\n </div>\n <div class=\"col-sm-2\">\n #{build_language_autocomplete(language)}\n </div>\n </div>\n HTML\n end",
"def form(text='some text', height=0, width=0, formheight=0, items=[])\n # item = [label, y, x, item, y, x, flen, ilen]\n item_string = items.collect{|i| %(\"#{i[0]}\" #{i[1]} #{i[2]} \"#{i[3]}\" #{i[4]} #{i[5]} #{i[6]} #{i[7]})}.join(' ')\n puts item_string\n command = %(--form \"#{text.to_s}\" #{height.to_i} #{width.to_i} #{formheight.to_i} #{item_string})\n call_and_capture command do |return_value|\n fields = []\n return_value.each_line do |line|\n puts line\n end\n end\n end",
"def address_line_1_form_column(record,input_name)\n text_field :record, :address_line_1, :maxlength => '10', :class=>\"address_line_1-input text-input\"\n end",
"def save_values\n self.first_name = @first_name_field.text.strip.chomp\n self.last_name = @last_name_field.text.strip.chomp\n self.email = @email_field.text.strip.chomp\n self.github = @github_field.text.strip.chomp\n self.twitter = @twitter_field.text.strip.chomp\n self.fun_fact = @fun_fact_field.text.strip.chomp\n\n # TODO: 2. Finish the implementation to set the other fields. DONE\n end",
"def get_feature_edit_html()\n super() << \"<div class=\\\"field\\\">\n min=<input name=\\\"min_rating\\\" type='text' value=\\\"#{min_rating}\\\" size=\\\"2\\\" />\n max=<input name=\\\"max_rating\\\" type='text' value=\\\"#{max_rating}\\\" size=\\\"2\\\" />\n </div>\"\n end",
"def h_asstag1; catdet.form(:name, 'rpcControlSensorSettingForm').text_field(:id, 'hmdAssetTag1'); end",
"def extract_text(data_name, options = {})\n if data_element(data_name).nil?\n# unless VALID_DATA_ELEMENTS.has_key?(data_name.to_sym)\n# @log.warn \"Invalid data extract for data field name [#{data_name.to_s}]\"\n puts \"Invalid data extract for data field name [#{data_name.to_s}]\"\n return nil\n end\n row = options[:row] || @current_row\n row = row + options[:add_rows] unless options[:add_rows].nil?\n @current_row = row\n #can not extract data because row not given probably because prompt not found\n if row.nil?\n return nil\n end \n row = row - 1\n \n column = options[:column] || @current_column\n column = column + options[:add_columns] unless options[:add_columns].nil?\n column = column - 1 # external is 1 based\n length = options[:length] || data_element(data_name).length\n\n# length = options[:length] || VALID_DATA_ELEMENTS[data_name.to_sym].length\n ends_with = options[:ends_with]\n line = @document.lines[row]\n field_value = if ends_with\n ends_with = Regexp.escape(ends_with) unless ends_with.class == Regexp\n regexp = Regexp.new(/(.{1,#{200}}?)/.to_s + ends_with.to_s)\n line[(column)..-1] =~ regexp\n $1\n else\n line[(column)..(column + length - 1)] \n end \n # puts \" field #{data_name} = [#{field_value}]\"\n# @log.debug3(\"field #{data_name} = [#{field_value}]\")\n return nil if field_value.nil? # nothing extracted\n value = process_extract_options(data_name, field_value, options)\n return nil if value.nil?\n\n @data[data_name] = value \n\n# @data[data_name]\n end",
"def d_asstag1; catdet.form(:name, 'rpcControlSensorSettingForm').text_field(:id, 'drAssetTag1'); end",
"def textfield_include text\n js = %Q(\n var t = au.getElementsByXpath('textfield[contains(@text, \"#{text}\")]').value;\n var s = au.getElementsByXpath('secure[contains(@text, \"#{text}\")]').value;\n t.concat(s)[0];\n )\n\n execute_script js\n end",
"def text_field_elements(identifier)\n platform.text_fields_for(identifier.clone)\n end",
"def h_asstag2; catdet.form(:name, 'rpcControlSensorSettingForm').text_field(:id, 'hmdAssetTag2'); end",
"def input\n text_field << date_select << javascript\n end",
"def draw_questions\n shoes.flow do\n shoes.caption \"First name\"\n @first_name_field = shoes.edit_line\n end\n\n shoes.flow do\n shoes.caption \"Last name\"\n @last_name_field = shoes.edit_line\n end\n \n shoes.flow do\n shoes.caption \"Email\"\n @email_field = shoes.edit_line\n end\n\n shoes.flow do\n shoes.caption \"Github\"\n @github_field = shoes.edit_line\n end\n\n shoes.flow do\n shoes.caption \"Twitter\"\n @twitter_field = shoes.edit_line\n end\n\n shoes.flow do\n shoes.caption \"Fun fact\"\n @fun_fact_field = shoes.edit_line\n end\n\n # TODO 4. Add fields for the user to fill in, but only if they are\n # relevant to the given user type.\n end",
"def save_values\n self.first_name = @first_name_field.text.strip.chomp\n self.last_name = @last_name_field.text.strip.chomp\n self.age = @age.text.strip.chomp\n self.email = @email.text.strip.chomp\n self.github = @github.text.strip.chomp\n self.twitter = @twitter.text.strip.chomp\n self.fun_fact = @fun_fact.text.strip.chomp\n puts self.first_name\n puts self.last_name\n puts self.age\n\n # TODO: 2. Finish the implementation to set the other fields.\n end",
"def fill_in_subquestion(subq_text, subq_val, subq_field_name, input_type, status)\n coder = HTMLEntities.new()\n retVal = \"\"\n subq_text = \" \" if subq_text.nil?\n subq_val = subq_val.nil? ? \"\" : 'value=\"' + coder.encode(subq_val) + '\"'\n disabled = status == \"disabled\" ? \"disabled = 'disabled' class='disabled_text'\" : \"\"\n retVal += subq_text + \" <input aria-label='Subquestion' class='editable_field' name='#{subq_field_name}' #{subq_val} #{disabled} /></span>\"\n end",
"def h_usrlbl; catdet.form(:name, 'rpcControlSensorSettingForm').text_field(:id, 'hmdLabel'); end",
"def additional_text_fields\n [\n [:institution_type],\n [:completed_cs_courses_and_activities],\n [:how_heard, HOW_HEARD_FACILITATOR, :how_heard_facilitator],\n [:how_heard, HOW_HEARD_CODE_ORG_STAFF, :how_heard_code_org_staff],\n [:how_heard, HOW_HEARD_REGIONAL_PARTNER, :how_heard_regional_partner],\n [:how_heard],\n [:plan_on_teaching],\n [:led_cs_extracurriculars, OTHER_PLEASE_LIST],\n [:grades_taught],\n [:grades_currently_teaching],\n [:subjects_taught],\n [:experience_leading]\n ]\n end",
"def t_asstag2; catdet.form(:name, 'rpcControlSensorSettingForm').text_field(:id, 'tmpAssetTag2'); end",
"def input_data(field, value)\n if field.eql?('username')\n query(\"* id:'login_etUserName'\", setText: \"#{value}\")\n sleep(STEP_PAUSE)\n elsif field.eql?('password')\n sleep(STEP_PAUSE)\n query(\"* id:'login_etPass'\", setText: \"#{value}\")\n elsif field.eql?('order_code')\n sleep(STEP_PAUSE)\n query(\"* id:'dialog_add_order_etNo'\", setText: \"#{value}\")\n elsif field.eql?('amount')\n sleep(STEP_PAUSE)\n query(\"* id:'dialog_add_order_etAmount'\", setText: \"#{value}\")\n end\nend",
"def draw\n\t\tfield.each do |arr|\n\t\t\tarr.each { |i| print \" #{i} \".black.bg_cyan }\n\t\t\tputs\n\t\tend\n\tend",
"def set_text\n @text_field.text = @str\n @formats.each do |start, n, style|\n case style\n when FoxTextFormatter::STYLE_BOLD\n @text_field.changeStyle(start, n, 2)\n when FoxTextFormatter::STYLE_H1\n @text_field.changeStyle(start, n, 3)\n when FoxTextFormatter::STYLE_H2\n @text_field.changeStyle(start, n, 4)\n when FoxTextFormatter::STYLE_H3\n @text_field.changeStyle(start, n, 5)\n when FoxTextFormatter::STYLE_TELETYPE\n @text_field.changeStyle(start, n, 6)\n when FoxTextFormatter::STYLE_CODE\n @text_field.changeStyle(start, n, 7)\n when FoxTextFormatter::STYLE_EMPHASIS\n @text_field.changeStyle(start, n, 8)\n when FoxTextFormatter::STYLE_CLASS\n @text_field.changeStyle(start, n, 9)\n else\n @text_field.changeStyle(start, n, 1)\n end\n\n end\n end",
"def get_value_edit_html(product)\n \"<div class=\\\"field\\\">\n <span>rating (min=#{min_rating}, max=#{max_rating})</span>\n <input type='text' name='feature_#{idurl}' value='#{get_value(product)}' />\n </div>\"\n end",
"def custom_fields\n if debug?\n channel_fields = ChannelFieldForm.new\n channel_fields.create_field(\n group_id: 1,\n type: 'Checkboxes',\n label: 'Checkboxes',\n fields: {\n field_list_items: \"Yes\\nNo\\nMaybe\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Radio Buttons',\n label: 'Radio Buttons',\n fields: {\n field_list_items: \"Left\\nCenter\\nRight\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Multi Select',\n label: 'Multi Select',\n fields: {\n field_list_items: \"Red\\nGreen\\nBlue\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Select Dropdown',\n label: 'Select Dropdown',\n fields: {\n field_list_items: \"Mac\\nWindows\\nLinux\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Select Dropdown',\n label: 'Prepopulated',\n fields: {\n field_pre_populate: 'y'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Rich Text Editor',\n label: 'Rich Text Editor',\n fields: {\n field_ta_rows: 20,\n field_text_direction: 'Right to left'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Toggle',\n label: 'Toggle'\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Text Input',\n label: 'Text Input',\n fields: {\n field_maxl: 100,\n field_fmt: 'None',\n field_show_fmt: 'y',\n field_text_direction: 'Right to left',\n field_content_type: 'Decimal',\n field_show_smileys: 'y',\n field_show_file_selector: 'y'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Textarea',\n label: 'Textarea',\n fields: {\n field_ta_rows: 20,\n field_fmt: 'None',\n field_show_fmt: 'y',\n field_text_direction: 'Right to left',\n field_show_formatting_btns: 'y',\n field_show_smileys: 'y',\n field_show_file_selector: 'y'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'URL',\n label: 'URL Field',\n fields: {\n url_scheme_placeholder: '// (Protocol Relative URL)'\n }\n ) do |page|\n page.all('input[name=\"allowed_url_schemes[]\"]').each do |element|\n element.click unless element.checked?\n end\n end\n\n @page.load\n else\n $db.query(IO.read('channel_sets/custom-fields.sql'))\n clear_db_result\n end\n end",
"def get_patient_info(patient)\n # box 2 maps to patient name\n text_box patient.patient_name, :at => [5, 633]\n # box 3 maps to patient dob and gender\n text_box patient.dob.strftime(\"%m\"), :at => [215, 632]\n text_box patient.dob.strftime(\"%d\"), :at => [235, 632]\n text_box patient.dob.strftime(\"%y\"), :at => [255, 632]\n if patient.gender == Patient::GENDER[0] #male\n text_box \"X\", :at => [296, 631]\n else\n text_box \"X\", :at => [332, 631]\n end\n\n # box 5 maps to patient\n if patient.address2\n text_box patient.address1 + \", \" + patient.address2, :at => [5, 608]\n else\n text_box patient.address1, :at => [5, 608]\n end\n text_box patient.city, :at => [5, 585]\n text_box patient.state, :at => [183, 585]\n text_box patient.zip, :at => [5, 561]\n text_box patient.home_phone, :at => [100, 561]\n\n\n # box 8 maps to patient, patient status and relationship status\n case patient.relationship_status\n when Patient::RELATIONSHIP[0]\n text_box \"X\", :at => [245, 583]\n when Patient::RELATIONSHIP[1]\n text_box \"X\", :at => [288, 583]\n else # other\n text_box \"X\", :at => [330, 583]\n end\n\n case patient.patient_status\n when Patient::PATIENT_STATUS[0]\n text_box \"X\", :at => [245, 559]\n when Patient::PATIENT_STATUS[1]\n text_box \"X\", :at => [288, 559]\n else #part time student\n text_box \"X\", :at => [330, 559]\n end\n end",
"def d_asstag2; catdet.form(:name, 'rpcControlSensorSettingForm').text_field(:id, 'drAssetTag2'); end",
"def tags_and_categories=(text)\n active_content_div.text_field(:id=>/as-input-\\d+/).set text +\"\\n\"\n wait_for_ajax\n end",
"def t_asstag1; catdet.form(:name, 'rpcControlSensorSettingForm').text_field(:id, 'tmpAssetTag1'); end",
"def addInputs(forms)\n forms.push( {\"description\"=>\"Config\",\n \"label\"=>\"Config\",\"name\"=>\"config\",\n \"property_inputs\"=>[{\"description\"=>\"Stack\",\"label\"=>\"Stack\",\"reference\"=>\".diego_cell\"+deploymentName+\".stack\"},\n {\"description\"=>\"Virtual IP\",\"label\"=>\"Virtual IP\",\"reference\"=>\".ha_proxy\"+deploymentName+\".keepalived_vip\"},\n {\"description\"=>\"Same Keepalived group share same virtual router ID \",\"label\"=>\"Virtual Router ID\",\"reference\"=>\".ha_proxy\"+deploymentName+\".keepalived_virtual_router_id\"}] });\nend",
"def build_cell(cell)\n cell.selectionStyle = self.row.selection_style || UITableViewCellSelectionStyleBlue\n field = UITextField.alloc.initWithFrame(CGRectZero)\n field.tag = TEXT_FIELD_TAG\n\n observe(self.row, \"value\") do |old_value, new_value|\n break_with_semaphore do\n update_text_field(new_value)\n end\n end\n\n field.clearButtonMode = UITextFieldViewModeWhileEditing\n field.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter\n field.textAlignment = row.text_alignment || NSTextAlignmentRight\n\n field.keyboardType = keyboardType\n\n field.secureTextEntry = true if row.secure?\n field.returnKeyType = row.return_key || UIReturnKeyNext\n field.autocapitalizationType = row.auto_capitalization if row.auto_capitalization\n field.autocorrectionType = row.auto_correction if row.auto_correction\n field.clearButtonMode = row.clear_button || UITextFieldViewModeWhileEditing\n field.enabled = row.editable?\n field.inputAccessoryView = input_accessory_view(row.input_accessory) if row.input_accessory\n\n add_callbacks(field)\n\n cell.swizzle(:layoutSubviews) do\n def layoutSubviews\n old_layoutSubviews\n\n # viewWithTag is terrible, but I think it's ok to use here...\n formotion_field = self.viewWithTag(TEXT_FIELD_TAG)\n formotion_field.sizeToFit\n\n field_frame = formotion_field.frame\n field_frame.origin.x = self.textLabel.frame.origin.x + self.textLabel.frame.size.width + Formotion::RowType::Base.field_buffer\n field_frame.origin.y = ((self.frame.size.height - field_frame.size.height) / 2.0).round\n field_frame.size.width = self.frame.size.width - field_frame.origin.x - Formotion::RowType::Base.field_buffer\n formotion_field.frame = field_frame\n end\n end\n\n if UIDevice.currentDevice.systemVersion >= \"6.0\"\n field.swizzle(:setText) do\n def setText(text)\n r = old_setText(text)\n self.sendActionsForControlEvents(UIControlEventEditingChanged)\n r\n end\n end\n end\n\n field.font = BW::Font.new(row.font) if row.font\n field.placeholder = row.placeholder\n field.text = row_value\n cell.addSubview(field)\n field\n\n end",
"def draw_questions\n\n shoes.app.flow do\n shoes.app.caption \"First name\"\n @first_name_field = shoes.app.edit_line\n end\n\n shoes.app.flow do\n shoes.app.caption \"Last name\"\n @last_name_field = shoes.app.edit_line\n end\n\n shoes.app.flow do\n shoes.app.caption \"E-Mail\"\n @email_field = shoes.app.edit_line\n end\n\n shoes.app.flow do\n shoes.app.caption \"github\"\n @github_field = shoes.app.edit_line\n end\n\n shoes.app.flow do\n shoes.app.caption \"twitter\"\n @twitter_field = shoes.app.edit_line\n end\n\n shoes.app.flow do\n shoes.app.caption \"Fun Fact\"\n @fun_fact_field = shoes.app.edit_line\n end\n\n # TODO 4. Add fields for the user to fill in, but only if they are\n # relevant to the given user type.\n end",
"def configure_field\n end",
"def textfields\n find_2_eles_attr :textfield, :secure, :text\n end",
"def tags_input\n adding_field do |f|\n f.text_field :tags, :value => question.tags.join(\", \"), :class => \"text_field autocomplete_for_tags\"\n end\n end",
"def backend_fields(cols)\n o = ''\n cols.each do |c|\n identifier = \"#{id}-#{self.class}-#{c}\"\n o << \"<label for='#{identifier}'>#{c.to_s.capitalize}</label><br />\\n\"\n o << \"<textarea id='#{identifier}' name='model[#{c}]'>#{self[c]}</textarea><br />\\n\"\n end\n o\n end",
"def input_html_options\n data = {}\n data[:min] = options[:min] if options[:min].present?\n data[:max] = options[:max] if options[:max].present?\n data[:before] = options[:before] if options[:before].present?\n data[:after] = options[:after] if options[:after].present?\n\n super.deep_merge(\n value: format_value(@builder.object.send(attribute_name)),\n type: 'text',\n data: data\n )\n end",
"def get_input;\t@input \t\tend",
"def layout_fields\n # Everything has a tag - or it BETTER!\n # Probably should refactor this or something.\n value = @stored_values[:tag] || @object.tag\n label = Label.new(\"Tag\")\n tagInput = InputField.new(value,30)\n @attr_to_field[:tag] = tagInput\n layout_field_button(label,tagInput,\"Auto\") do\n attemptName = nil\n if @attr_to_field[:name]\n attemptName = @attr_to_field[:name].text\n end\n tagInput.text = @rl.repository.generate_tag_for(@object,attemptName)\n end\n @fieldY = tagInput.rect.bottom + @spacing \n @object.class.attrs.sort.each do | attr |\n next if attr == :tag # We did tags ourselves\n display = true\n value = @stored_values[attr] || @object.send(attr)\n label = Label.new(attr.to_s)\n rows,cols = [0,0]\n size= @object.class.size_for(attr)\n input = nil\n if size\n rows,cols = size\n if rows > 1\n input = MultiLineInput.new(value)\n input.set_size(rows,cols)\n elsif rows == 0 || cols == 0\n display = false\n else\n input = InputField.new(value, cols)\n end\n else\n input = InputField.new(value,20)\n end \n \n if display\n if rows > 1\n scroller = Scroller.new(input)\n scroller.translate_to(*input.rect.topleft)\n layout_field(label,scroller)\n else\n layout_field(label,input)\n end\n @attr_to_field[attr] = input\n end\n check_max_button(attr,input) if input\n end\n \n # Booleans\n @object.class.booleans.each do | attr |\n value = @stored_values[attr] || @object.send(attr)\n checkbox = CheckBox.new(attr.to_s,value)\n checkbox.rect.topleft = [ @fieldX, @fieldY ] \n \n @fieldY = checkbox.rect.bottom + @spacing\n \n self << checkbox\n @bool_to_field[attr] = checkbox\n end\n \n # And now for the enums!\n @object.class.enumerations.each do | attr, valid |\n value = @stored_values[attr] || @object.send(attr)\n label = Label.new(attr.to_s)\n \n size = @object.class.size_for(attr)\n label.rect.topleft = [@fieldX, @fieldY]\n rows = size || valid.size\n \n input = ListBox.new\n input.rect.w = @mainRect.w / 2 - label.rect.w - @spacing * 3\n input.rect.h = input.height(rows)\n input.items = valid\n input.chosen = value\n \n input.translate_to(label.rect.right + @spacing, @fieldY)\n \n @fieldY = input.rect.bottom + @spacing\n self << label\n self << input\n @enum_to_field[attr] = input\n \n end\n end",
"def getvalue\n @text1\n end",
"def fast_input_form(options = {}, value = nil) # 20-9 is value deprecated?\n\t\tdisabled = options[:disabled] ? true : false\n\t\tshow_all = options[:show_all].nil? || options[:show_all] #show_all = options[:show_all].nil? ? false : true\n\t\tfast = options[:fast] ? true : false\n\t\tedit = options[:edit] ? true : false\n\t\tvalue = options[:value] || nil\n\t\tno = options[:number].to_s || self.question.number.to_s \n\t\tc_id = cell_id(no)\n\n\t\tnewform = []\n\t\tquestion_no = \"Q\" + no # self.question_no.number.to_s\n\t\trequired = self.required? ? \"required\" : \"\"\n\n\t\tlabel = []\n\t\tswitch_src = \"\"\n\t\tshow_value = false\n\t\tself.question_items.each_with_index do |item, i|\n\t\t\tswitch_src = (i > 0 && !fast) ? switch_source(options) : \"\" # set switch on positive answers; 0 is 'no'\n\t\t\tvalues << item.value\n\t\t\tshow_value = true if(item.text.to_i == 0 and not ((item.text == \"0\") || (item.text == \"1\")))\n\t\t\tlabel << (show_value || (item.text.to_i == 0 and not ((item.text == \"0\") || (item.text == \"1\"))) ? (\"<span>#{item.value} = #{item.text}</span>\") : item.text) unless item.text.empty?\n\t\tend\n\t\t# if items.to_i has duplicates, they are probably 0's, meaning that they have text in them, not just numbers as values. When more than one text becomes 0, there's more than one not-integer text\n\t\t# shows text values, except where all item texts are numbers\n\t\tshow_label = self.question_items.map { |item| item.text.to_i }.select {|i| i == 0}.size > 1\n\t\tnewform = div_item((show_label ? label.map {|l| span_item(l, fast_inner_span)}.join : \"\"), \"radiolabel\") <<\n\t\tspan_item(\" <input id='#{c_id}' \" <<\n\t\t\"name='#{question_no}[#{c_id}]' class='rating #{required} #{switch_src} #{c_id}' type='text' #{(self.value.nil? ? \"\" : \"value='\" + self.value.to_s + \"'\")} size='2' >\", \"radio\") << # removed />\n\t\t\"\\n\" << self.add_validation(options)\n\t\treturn div_item(newform, \"#{class_name} #{fast_inner_span}\")\n\tend",
"def dynamic_form_fields(builder)\n # Allow dynamic fields in our Project to be processed by form_for\n create_virtual_attributes!\n\n @object.fields.each do |field|\n h.haml_concat process_field(builder, field)\n end\n end",
"def input\n if object.respond_to? :reflections\n hid_name = object.reflections[attribute_name].foreign_key || :\"#{attribute_name}_id\"\n relation = attribute_name\n else\n hid_name = attribute_name\n relation = attribute_name.to_s.gsub(/\\A(.+)(_id)\\z/,'\\1')\n end\n\n case\n when options['data-source'].present?\n input_html_options['data-source'] = options.delete('data-source')\n when input_html_options[:data].present? && input_html_options[:data][:source].present?\n input_html_options['data-source'] = input_html_options[:data].delete(:source)\n end\n\n raise 'input_html_options data-source required' unless input_html_options['data-source'].present?\n input_html_options[:placeholder] = input_html_options[:placeholder] || I18n.t('bonsai.autocomplete_placeholder')\n input_html_options[:size] ||= SimpleForm.default_input_size\n input_html_options['data-value'] = object.send(relation).to_s\n input_html_options[:class] = 'select2-autocomplete'\n\n @builder.text_field hid_name, input_html_options\n end",
"def c_asstag1; catdet.form(:name, 'rpcControlSensorSettingForm').text_field(:id, 'cntctAssetTag1'); end",
"def drawField\n @field_win.werase\n\n # Draw the value in the field.\n temp = @current.to_s\n Draw.writeCharAttrib(@field_win,\n @field_width - temp.size - 1, 0, temp, @field_attr,\n CDK::HORIZONTAL, 0, temp.size)\n\n self.moveToEditPosition(@field_edit)\n @field_win.wrefresh\n end",
"def update_input\n timeout(320) { show_items }\n return if searchable && DOM::Document.active_element == @input\n @input.value = Array(label).join(', ')\n end",
"def text(text_input_handle)\n end",
"def t_usrlbl; catdet.form(:name, 'rpcControlSensorSettingForm').text_field(:id, 'tmpLabel'); end",
"def settings_string(name, prop_name, conf_name, owner_id = 0, html_options = {})\n settings_group_line(name, html_options[:tip]) {\n text_field_tag(prop_name.to_s, Confline.get_value(conf_name.to_s, owner_id).to_s,\n {\"class\" => \"input\", :size => \"35\", :maxlength => \"50\"}.merge(html_options))\n }\n end",
"def build_field_options(value, index)\n options = input_html_options.dup\n\n\n #options[:value] = value if options[:value].nil?\n if !value.blank?\n options[:value] = value\n elsif value.blank? and !options[:value].blank?\n options[:value] = options[:value]\n else\n options[:value] = value\n end\n\n\n if @rendered_first_element\n options[:id] = nil\n options[:required] = nil\n else\n options[:id] ||= input_dom_id\n end\n options[:class] ||= []\n options[:class] += [\"#{input_dom_id} form-control multi-text-field\"]\n options[:'aria-labelledby'] = label_id\n @rendered_first_element = true\n\n options\n end",
"def comment_in_first_box=(comment)\n frm.text_field(:name=>\"editTotalResults:totalScoreTable:0:_id345\").value=comment\n end",
"def formation; end",
"def of_update_project_textfields_from_organization\n organization = params[:org]\n if organization != '0'\n @organization = Organization.find(organization)\n @suppliers = @organization.blank? ? suppliers_dropdown : @organization.suppliers.order(:supplier_code)\n @offer_requests = @organization.blank? ? offer_requests_dropdown : @organization.offer_requests.not_approved(@organization.id)\n @projects = @organization.blank? ? projects_dropdown : @organization.projects.order(:project_code)\n @work_orders = @organization.blank? ? work_orders_dropdown : @organization.work_orders.order(:order_no)\n @charge_accounts = @organization.blank? ? charge_accounts_dropdown : @organization.charge_accounts.expenditures\n @stores = @organization.blank? ? stores_dropdown : @organization.stores.order(:name)\n @payment_methods = @organization.blank? ? payment_methods_dropdown : payment_payment_methods(@organization.id)\n @products = @organization.blank? ? products_dropdown : @organization.products.order(:product_code)\n else\n @suppliers = suppliers_dropdown\n @offer_requests = offer_requests_dropdown\n @projects = projects_dropdown\n @work_orders = work_orders_dropdown\n @charge_accounts = charge_accounts_dropdown\n @stores = stores_dropdown\n @payment_methods = payment_methods_dropdown\n @products = products_dropdown\n end\n # Work orders array\n @orders_dropdown = orders_array(@work_orders)\n # Offer requests array\n @requests_dropdown = offer_requests_array(@offer_requests)\n # Products array\n @products_dropdown = products_array(@products)\n # Setup JSON\n @json_data = { \"supplier\" => @suppliers, \"offer_request\" => @requests_dropdown,\n \"project\" => @projects, \"work_order\" => @orders_dropdown,\n \"charge_account\" => @charge_accounts, \"store\" => @stores,\n \"payment_method\" => @payment_methods, \"product\" => @products_dropdown }\n render json: @json_data\n end",
"def c_asstag2; catdet.form(:name, 'rpcControlSensorSettingForm').text_field(:id, 'cntctAssetTag2'); end",
"def text_area; end",
"def text_field(row, text, width, ispwd=false)\n tbut = TkLabel.new(@frame, 'text' => text) {\n grid('row' => row, 'column' => 0, 'sticky' => 'nse','padx'=>'0')\n }\n tvar = TkVariable.new('')\n lab = TkEntry.new(@frame) {\n textvariable tvar\n width width\n\n grid('row' => row, 'column' => 1, 'sticky' => 'nsw','pady'=>'3')\n }\n lab.configure('show' => '*') if ispwd\n\n return tvar\n end",
"def render_conference(p)\n r = \"\"\n if p.authors.size > 0 then\n r += p.authors.map {|a| a.abbreviated_name}.joined_by_comma_and_and + \". \"\n end\n\n r += p.title.detex.titlecase + \". \"\n \n r += \"In \"\n if p.editors.size > 0 then\n r += p.editors.map {|e| e.abbreviated_name}.joined_by_comma_and_and + \", editors, \"\n end\n\n r += p.booktitle.detex.titlecase + \". \"\n r += text_for_field(\"Booktitle\", p, :postfix => \"\").detex.titlecase\n\n\n if field(p,\"Volume\") then\n r += text_for_field(\"Volume\", p, :prefix => \", volume \")\n r += text_for_field(\"Series\", p, :prefix => \" of \")\n elsif field(p,\"Number\") then\n r += text_for_field(\"Number\", p, :prefix => \". Number \")\n r += text_for_field(\"Series\", p, :prefix => \" in \")\n elsif field(p,\"Series\") then\n r += text_for_field(\"Series\", p, :prefix => \". \")\n end\n r += \". \"\n\n if field(p,\"Pages\") then\n r += text_for_field(\"Pages\", p, :prefix => \", pages \", :postfix => \". \").detex\n end\n\n if field(p,\"Address\") then\n r += text_for_field(\"Address\", p, :prefix => \", \")\n r += month_for_field(\"Month\", p, :prefix => \", \", :postfix => \" \")\n r += text_for_field(\"Year\", p)\n r += text_for_field(\"Organization\", p, :prefix => \". \")\n r += text_for_field(\"Publisher\", p, :prefix => \", \")\n else\n r += text_for_field(\"Organization\", p, :prefix => \", \")\n r += text_for_field(\"Publisher\", p, :prefix => \", \")\n r += month_for_field(\"Month\", p, :prefix => \", \", :postfix => \" \")\n r += text_for_field(\"Year\", p)\n end\n\n r += text_for_field(\"Note\", p, :postfix => \". \")\n return r\n\nend",
"def process_field(builder, field)\n builder.send(field.field_type.to_sym,\n field.field_name.to_sym,\n\n # Homespree Project Type Optional params\n {\n label: field.label,\n data: field.field_data,\n default: field.default,\n required: field.required,\n position: field.position,\n size: field.size,\n toggleable: field.toggleable\n }\n )\n end",
"def set_text(grids, data, fill = false, top_padding = false, pad = 7)\n grid(grids[0], grids[1]).bounding_box() do\n font data[:font]\n font_size data[:font_size]\n if top_padding\n move_down pad\n end\n if fill\n stroke_bounds\n text \"#{Prawn::Text::NBSP * 1}#{data[:text]}\", inline_format: true, align: data[:align]\n if data[:text]==\"\"\n stroke do\n fill_color 'DDDDDD'\n fill_and_stroke_rectangle [0,bounds.height], bounds.width, bounds.height\n fill_color '000000'\n end\n end\n else\n text data[:text], inline_format: true, align: data[:align]\n end\n end\n end"
] | [
"0.61153096",
"0.6042582",
"0.6022022",
"0.59466285",
"0.58972037",
"0.58564156",
"0.58267283",
"0.5804377",
"0.5782444",
"0.5739756",
"0.5733525",
"0.57216436",
"0.5709029",
"0.56517506",
"0.56136197",
"0.5546746",
"0.5519948",
"0.5455289",
"0.54532045",
"0.54307896",
"0.5426855",
"0.5403744",
"0.5394392",
"0.53878653",
"0.53715783",
"0.53094524",
"0.5308056",
"0.5290136",
"0.5285856",
"0.5280192",
"0.527656",
"0.52633893",
"0.5262039",
"0.5238652",
"0.52317977",
"0.5227429",
"0.5207362",
"0.5200789",
"0.51974636",
"0.5197423",
"0.51949966",
"0.5192454",
"0.5192454",
"0.51897097",
"0.5187786",
"0.5178036",
"0.5169977",
"0.5168357",
"0.51608974",
"0.5146665",
"0.512817",
"0.5126958",
"0.5119981",
"0.5119803",
"0.51164114",
"0.5115325",
"0.51135075",
"0.5105508",
"0.5093487",
"0.50900245",
"0.5083812",
"0.5083655",
"0.5078212",
"0.5077092",
"0.50764006",
"0.5074385",
"0.50734967",
"0.50699675",
"0.5064582",
"0.50582236",
"0.50530475",
"0.5049551",
"0.50350666",
"0.5031767",
"0.5031153",
"0.502532",
"0.5024805",
"0.5016346",
"0.50157243",
"0.5015485",
"0.5014877",
"0.5010054",
"0.5002446",
"0.49977118",
"0.49930754",
"0.49906996",
"0.49811393",
"0.49787262",
"0.4975433",
"0.4975077",
"0.49703306",
"0.49694827",
"0.49625462",
"0.4960972",
"0.49608874",
"0.49558866",
"0.4954096",
"0.49536636",
"0.49518478",
"0.4951703",
"0.49516004"
] | 0.0 | -1 |
Get a single rental cancelation policy item | def rental_cancelation_policy_item(rental_cancelation_policy_item, options = {})
get("rental_cancelation_policy_items/#{rental_cancelation_policy_item}", options).pop
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel_reason\n @subscription_purchase.cancel_reason\n end",
"def find_for_cancel(reputable, action, receiver, points, tier=nil)\n conditions = unless tier\n [\"reputations.status = ? AND reputations.reputable_id = ? AND reputations.reputable_type = ? AND reputations.action = ? AND reputations.receiver_id = ? AND reputations.points = ?\", \n 'active', reputable.id, reputable.class.base_class.name, action.to_s, receiver.id, points]\n else\n tier = tier.parent ? tier.parent : tier\n [\"reputations.status = ? AND reputations.reputable_id = ? AND reputations.reputable_type = ? AND reputations.action = ? AND reputations.receiver_id = ? AND reputations.points = ? AND reputations.tier_id = ?\", \n 'active', reputable.id, reputable.class.base_class.name, action.to_s, receiver.id, points, tier.id]\n end\n result = find(:all, \n :conditions => conditions,\n :order => \"activated_at DESC, created_at DESC\",\n :limit => 1)\n result.first unless result.empty?\n end",
"def cancel_item(message)\n request(:cancel_item, Boolean, message)\n end",
"def cancel(reputable, action, receiver, options={})\n result = nil\n options.symbolize_keys!\n sender = options.delete(:sender)\n tier = options.delete(:tier)\n # adds receiver's reputation\n if receiver_points = find_reputation_points(reputable, :receiver, action, tier)\n reputation = find_for_cancel(reputable, action, receiver, receiver_points, tier)\n reputation.cancel! if reputation\n result = reputation\n end\n if sender && (sender_points = find_reputation_points(reputable, :sender, action, tier))\n reputation = find_for_cancel(reputable, action, sender, sender_points, tier)\n reputation.cancel! if reputation\n result = reputation\n end\n result\n end",
"def rental(rental, options = {})\n get(\"rentals/#{rental}\", options).pop\n end",
"def cancel_renewal(subscription_id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'subscriptionId', subscription_id)\n\t\t\tclient.queue_service_action_call('entitlement', 'cancelRenewal', '', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def cancellor\n @cancellor ||= Cancellor.new(self)\nend",
"def cancellation_reason\n read_integer('cancellation_reason')\n end",
"def cancel_request_for(requested_item)\n url = @server.vxws_uri(\"CancelService\")\n request = Net::HTTP::Post.new(url.path)\n request.body = cancel_request_post_data(requested_item)\n response = Net::HTTP.new(url.host, url.port).start {|http| http.request(request) }\n response.body\n end",
"def cancel\n @calculator.retrieve_pending_amount\n end",
"def cancela\n @manifest = Manifest.find(params[:id])\n @company = @manifest.company\n end",
"def cancel_refund\n price - price * cancel_factor\n end",
"def cancel_notification\n return if @cancelled_info && @cancelled_info[\"silent\"]\n @engine.send_notification({\n reason: @cancelled_reason,\n by: @cancelled_by,\n id: @intention_id,\n intention_type: self.class.to_s,\n info: @cancelled_info,\n },\n type: Demiurge::Notifications::IntentionCancelled,\n zone: @item.zone_name,\n location: @item.location_name,\n actor: @item.name,\n include_context: true)\n nil\n end",
"def cancelorder(uuid)\n res = sget(\"/cancel\", {uuid: uuid})\n ::BittrexRb::Response::Market.new(res)\n end",
"def cancel(asset_id, transaction_type)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'assetId', asset_id)\n\t\t\tclient.add_param(kparams, 'transactionType', transaction_type)\n\t\t\tclient.queue_service_action_call('entitlement', 'cancel', 'bool', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def create_but_cancel_adr_policy_on_popup(policy)\n adr_policy_name_select.select(policy)\n cancel_adr_policy_btn.click\n end",
"def cancel(unique_id)\n request('payment/cancel', :cancel => {:unique_id => unique_id} )\n end",
"def cancel_now\n as_stripe_subscription.cancel({\n prorate: proration_behavior == 'create_prorations',\n })\n\n mark_as_cancelled\n\n self\n end",
"def cancel_notification\n return if @cancelled_info && @cancelled_info[\"silent\"]\n @engine.send_notification({\n reason: @cancelled_reason,\n by: @cancelled_by,\n id: @intention_id,\n intention_type: self.class.to_s,\n info: @cancelled_info,\n queue_number: @action_queue_number,\n action_name: @action_name,\n action_args: @action_args,\n },\n type: Demiurge::Notifications::IntentionCancelled,\n zone: @item.zone_name,\n location: @item.location_name,\n actor: @item.name,\n include_context: true)\n nil\n end",
"def cancel\n\t\tclient = GocardlessPro.new(self.customer.client.organisation)\n\t\tclient.cancel_payment(self.gc_id)\n\tend",
"def cancel\n\n unschedule_timeout(nil)\n\n cancel_participant\n\n trigger_on_cancel # if any\n\n @applied_workitem\n end",
"def cancel\n payment = Spree::Payment.find_by(id: params[:payment_id])\n redirect_to redirect_path(payment.try(:order))\n end",
"def cancel\n \n unless status == :cancelled\n transaction do \n if total_paid > 0\n update(:status => :cancelled, :payment_status => :refunded, :total_paid => 0, :total_pending => total_cost)\n else \n update(:status => :cancelled)\n end\n # Create newsfeed\n ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',\n action: 'cancel_booking',\n identifier: self.id.to_s,\n description: BookingDataSystem.r18n.t.canceled_booking)\n charges.each do |charge|\n charge.refund\n end\n end\n end\n\n self\n end",
"def cancel!\n if charged && !canceled\n refund!\n recharge!\n end\n end",
"def cancel_participant\n\n return unless @applied_workitem\n #\n # if there is an applied workitem, it means there\n # is a participant to cancel...\n\n participant = get_participant_map.lookup_participant(@participant_name)\n\n cancelitem = CancelItem.new(@applied_workitem)\n\n get_participant_map.dispatch(participant, @participant_name, cancelitem)\n end",
"def cancel (cancelitem)\n\n Workitem.destroy_all([ 'fei = ?', cancelitem.fei.to_s ])\n # note that delete_all was not removing workitem fields\n # probably my fault (bad :has_many setting)\n end",
"def cancel status=:canceled\n result = true\n\n # Refund all transactions associated with order\n self.select_order_transactions.payments.each do |t|\n result = self.braintree_refund_transaction t\n end\n\n # Mark the order as canceled if all braintree refunds succeeded\n if result\n self.edit_mode = false\n self.status = status\n self.save\n end\n\n # Return result\n result\n end",
"def next_discretionary_item\n @items.select { |item| item.rule.max.positive? }.sample(1).first\n end",
"def cancel!\n self.update_attributes(status: CANCELLED)\n #self.line_items.update_attributes(status: LineItem::CANCELLED)\n end",
"def last_active_recurring_product_subscription_term_cancel_on\n if end_date = self.last_active_recurring_product_subscription_term_period_end_on\n end_date - 3.days\n end\n end",
"def set_cancellor\n @cancellor = Cancellor.find(params[:id])\n end",
"def get_policy\n @privacypolicy = Privacypolicy.find_by_id(params[:id])\n return if check_nil_object(@privacypolicy)\n end",
"def cancel_by_user\n @booking = Booking.find_by_id(params[:id])\n\n if @booking.user_id == current_user.id\n @booking.update_approval_status(\"cancel_by_user\")\n end\n\n redirect_to(:back)\n end",
"def cancel_recurring_subscription(subscriber_id, merchant_account)\n fetch_route = find_route(__method__.to_s)\n requested_path = fetch_route[:path]\n\n client.post(\n requested_path,\n fetch_route[:api],\n {\n 'contract' => 'RECURRING',\n 'shopperReference' => subscriber_id,\n 'merchantAccount' => merchant_account\n }\n )\n end",
"def create_cancel_transaction\n\t\tcancel_input = Input.new\n\t\tcancel_input.amount = self.amount * -1\n\t\tcancel_input.cancel_id = self.id\n\t\tcancel_input.status = \"cancel_input\"\n\n\t\tself.status = \"cancelled\"\n\t\tif self.article\t\n\t\t\tself.article.status = \"\"\t\t# El articulo ya no esta ni vendido ni alquilado\n\t\tend\n\t\tself.comission_cash = '-' + self.comission_cash\n\t\tself.save\n\t\treturn cancel_input\n\tend",
"def uncancel\r\n @plan = check_security(params[:id])\r\n @plan.uncancel(current_user)\r\n\r\n #MES- Every user is notified of an uncancel- it's like an\r\n # invitation.\r\n @plan.planners.each do | plnr |\r\n user = plnr.owner\r\n if user != current_user &&\r\n UserAttribute::FALSE_USER_ATT_VALUE != user.get_att_value(UserAttribute::ATT_REMIND_BY_EMAIL).to_i &&\r\n UserAttribute::INVITE_NOTIFICATION_ALWAYS == user.get_att_value(UserAttribute::ATT_INVITE_NOTIFICATION_OPTION).to_i\r\n UserNotify.deliver_uncancel_plan(current_user, plnr.owner, @plan)\r\n end\r\n end\r\n flash[:notice] = \"This plan is reinstated.<br/>All attendees have been re-invited.\"\r\n redirect_back\r\n end",
"def cancellation_request(tid)\n cancellation_request = Cielo::CancellationRequest.new\n resul = send_request(cancellation_request.serialize(tid,@affiliation, @affiliation_key))\n end",
"def cancel\n begin\n payment = Payment.find_by_token!(params[:token])\n payment.cancel!\n flash[:notice] = \"Sie haben die Bezahlung per Paypal abgebrochen.\"\n\n redirect_to edit_order_url(payment.order)\n rescue Exception => e\n redirect_to store_url, flash: { error: e.message }\n end\n end",
"def cancellation_reason_string\n CANCELATION_REASONS[cancellation_reason]\n end",
"def cancel_active_sender_reward\n self.kase.rewards.active.find(:all, :conditions => {:sender_id => self.sender.id}).each do |reward|\n reward.cancel!\n end\n end",
"def cancel_trip\n label = request_label(:cancel, trip_id)\n \n @http_request_bundler.add(\n label, \n @url + \"/cancel_trip\", \n :delete,\n head: headers,\n query: { trip_id: trip_id, customer_id: customer_id, customer_token: customer_token }\n ).response!(label)\n end",
"def cancel_notification\n # \"Silent\" notifications are things like an agent's action queue\n # being empty so it cancels its intention. These are normal\n # operation and nobody is likely to need notification every\n # tick that they didn't ask to do anything so they didn't.\n return if @cancelled_info && @cancelled_info[\"silent\"]\n item = @engine.item_by_name(@name)\n @engine.send_notification({ reason: @cancelled_reason, by: @cancelled_by, id: @intention_id, intention_type: self.class.to_s },\n type: Demiurge::Notifications::IntentionCancelled, zone: item.zone_name, location: item.location_name, actor: item.name,\n include_context: true)\n end",
"def cancel!\r\n return if [:cancel].include? m.status\r\n raise \"Invalid state: message must be new, retry, or fail to cancel!\" unless [:new, :retry, :fail].include? m.status\r\n self.status = :cancel\r\n self.save!\r\n end",
"def cancel\n @order.cancel\n render_update @order\n end",
"def item_requester\n participants.reject { |p| p.id == item_owner.id }.first\n end",
"def rateable_id\n if self.object.rateable\n self.object.rateable.id\n end\n end",
"def force_cancel(asset_id, transaction_type)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'assetId', asset_id)\n\t\t\tclient.add_param(kparams, 'transactionType', transaction_type)\n\t\t\tclient.queue_service_action_call('entitlement', 'forceCancel', 'bool', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def cancel!\n update(request_cancelled: true)\n end",
"def cancel(c, ci, de, cr, cv)\n if state(COMMITMENT, c, ci, de, cr) and active(c, ci, cv)\n apply([[CANCELLED, c, ci, cv]], [])\n end\nend",
"def cancel\n success = current_subscriber.cancel_subscription\n render json: { success: success }\n end",
"def cancel \n unless self.status == 'canceled'\n ev = Event.create(\n :event_type => :subscription,\n :event_subtype => :cancel,\n :user => self.user,\n :detail_i1 => self.id\n ) \n \n Rails::logger.debug \"Calling chargify to cancel subscription ID #{self.chargify_id}\" \n Sherlock::Chargify.new.cancel(self.chargify_id) \n \n Rails::logger.debug \"Adjusting my own status to 'canceled'\" \n \n self.status = 'canceled'\n self.save\n \n ev.finish\n \n InfusionsoftUtils.update_contact(self)\n end\n \n end",
"def on_item_cancel2; item_cancel(@item_window2, @category_window2); end",
"def on_item_cancel; item_cancel(@item_window, @category_window); end",
"def cancel\n @order.cancel!\n return redirect_to order_path(@order), :notice => t(:update_success)\n end",
"def destroy\n @company_policy_item = CompanyPolicyItem.find(params[:id])\n company_policy = @company_policy_item.company_policy\n @company_policy_item.destroy\n\n respond_to do |format|\n format.html { redirect_to client_company_policy_company_policy_items_path(client_id: company_policy.client_id, company_policy_id: company_policy_id) }\n format.json { head :no_content }\n end\n end",
"def last_active_recurring_product_subscription\n if order = self.last_active_recurring_order\n order.line_item_products.select(&:subscription?).first\n end\n end",
"def cancel_preauth(tx, reason)\n payment = {}\n Result::Success.new(payment)\n rescue => e\n Result::Error.new(e.message)\n end",
"def cancel\n canceller = OrderCanceller.new(order).all!\n if canceller.success?\n flash[:success] = 'Order was cancelled successfully.'\n redirect_to(:back)\n else\n flash[:error] = \"#{canceller.error}\"\n redirect_to(:back)\n end\n end",
"def cancel(original_reference:, reference:, merchantAccount: @merchant_account)\n postJSON(\"/Payment/v12/cancel\",\n reference: reference,\n merchantAccount: merchant_account,\n originalReference: original_reference\n )\n end",
"def cancel\n case\n when @browser.div(:id=>\"accountpreferences_preferContainer\").visible?\n @browser.div(:id=>\"accountpreferences_preferContainer\").button(:class=>\"s3d-link-button s3d-bold accountpreferences_cancel\").click\n when @browser.div(:id=>\"accountpreferences_changePrivacyContainer\").visible?\n @browser.div(:id=>\"accountpreferences_changePrivacyContainer\").button(:class=>\"s3d-link-button s3d-bold accountpreferences_cancel\").click\n when @browser.div(:id=>\"accountpreferences_changePassContainer\").visible?\n @browser.div(:id=>\"accountpreferences_changePassContainer\").button(:class=>\"s3d-link-button s3d-bold accountpreferences_cancel\").click\n else\n puts \"\\nCouldn't find the cancel button!\\n\"\n end\n end",
"def set_cancel_condition\n @cancel_condition = CancelCondition.find(params[:id])\n end",
"def donor_can_cancel?\n !received?\n end",
"def show\n @policy = Policy.find(params[:id])\n @policy_due = PolicyDue.new\n end",
"def item\n @capacities_list_window.item\n end",
"def subscription_coupon\n @current_coupon ||=\n @current_business\n .coupons\n .find_by_identifier!(params.dig(:subscription, :coupon))\n rescue ActiveRecord::RecordNotFound\n invalid_coupon\n end",
"def cancel_recurring(sbp_recurring_request, opts = {})\n data, status_code, headers = cancel_recurring_with_http_info(sbp_recurring_request, opts)\n return data\n end",
"def paymentterm\n paymentterms.first\n end",
"def test_purchase_cancel\n response = @gateway.setup_purchase(200, @options)\n\n assert_success response\n # now try to authorize the payment, issuer simulator has cancelled the payment\n response = @gateway.capture(response.transaction['transactionID'])\n\n assert_failure response\n assert_equal 'Cancelled', response.transaction['status'], 'Transaction should cancel'\n end",
"def cost_item(time_entry)\n if User.current.logged? && (User.current.allowed_to?(:view_rate, time_entry.project) || User.current.admin?)\n return time_entry.cost\n else\n return nil\n end\n end",
"def scoped_resource\n resource_class.where({ status: :awaiting_review })\n end",
"def sale_cancelled\n @shop = Shop.find(params[:shop_id])\n @item = @shop.items.find(params[:item_id])\n end",
"def originator\n self.class.with_item_keys(self.class.name, id).last.try :whodunnit\n end",
"def cancel\n subscription = as_stripe_subscription\n\n subscription.cancel_at_period_end = true\n\n subscription = subscription.save\n\n self.stripe_status = subscription.status\n\n # If the user was on trial, we will set the grace period to end when the trial\n # would have ended. Otherwise, we'll retrieve the end of the billing period\n # period and make that the end of the grace period for this current user.\n self.ends_at = on_trial ? trial_ends_at : Time.zone.at(subscription.current_period_end)\n\n save\n\n self\n end",
"def get_policy()\n\t\t if @policy.kind_of? String\n return @policy\n elsif @policy.kind_of? REXML::Element\n return @policy.to_s\n\t\t end\n\n return nil\n\t end",
"def paypal_cancel\r\n user_id = params[:user_id]\r\n @user = User.find(user_id)\r\n session[:user_id] = @user[:id]\r\n session[:user_email] = @user[:email]\r\n \r\n cancel_purchase(params[:id])\r\n flash[:notice] = I18n.t 'event.purchase.pur_can'\r\n redirect_to(:controller => 'home', :action=>'index') \r\n end",
"def tutor_cancel\n timeslot = Timeslot.where.not(student_id: nil).first\n student = timeslot.student\n TimeslotMailer.tutor_cancel(timeslot, student)\n end",
"def cancel(id)\n http.post(\"/nfse/#{id}/cancel\") do |response|\n respond_with_entity(response, Entities::NfseStatus)\n end\n end",
"def pricing_policy\n car.pricing_policy\n end",
"def cancel(params)\n request(Resources::RESOURCE_CANCEL, HTTP_METHOD_POST, params)\n end",
"def cancel(reason, info = {})\n @cancelled = true\n @cancelled_by = caller(1, 1)\n @cancelled_reason = reason\n @cancelled_info = info\n cancel_notification\n nil\n end",
"def cancel_order\n if self.status.downcase == \"pending\"\n self.status = \"Canceled\"\n self.save\n self\n else \n \"Error in Order Model\"\n end\n end",
"def cancel_intention_if_present(reason, extra_info = {})\n @current_intention.cancel(reason, extra_info) if @current_intention\n end",
"def submit_cancel\n get_subscription\n is_cancelled = @my_subscription.cancel_or_pause_subscription(\"canceled\") #unless @my_subscription.is_under_process?\n flash[:sub_cancelled] = \"Subscription has been canceled Successfully.\" if is_cancelled\n redirect_to main_app.profile_users_path and return\n end",
"def rand_one(item_type)\n\t\t\tnum = rand(1..MAX_RATE)\n\n\t\t\tconst(item_type.to_i).each do |key, val|\n\t\t\t\tif num.in?(key)\n\t\t\t\t\treturn val\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def cancel\r\n @plan = check_security(params[:id])\r\n\r\n #MES- Which users should we notify? We want to figure this out\r\n #BEFORE cancelling the plan, since we only want to notify people who\r\n # who are interested in the plan, and after cancelling, we lose\r\n # that info\r\n users_to_notify = []\r\n @plan.planners.each do | plnr |\r\n #MES- Is this planner interested in the plan?\r\n if Plan::STATUSES_ACCEPTED_OR_INVITED.include?(plnr.cal_pln_status.to_i)\r\n #MES- Does the user want to get email notifications?, and is it NOT the\r\n # current user?\r\n user = plnr.owner\r\n if user != current_user &&\r\n UserAttribute::FALSE_USER_ATT_VALUE != user.get_att_value(UserAttribute::ATT_REMIND_BY_EMAIL).to_i &&\r\n UserAttribute::PLAN_MODIFIED_ALWAYS == user.get_att_value(UserAttribute::ATT_PLAN_MODIFIED_NOTIFICATION_OPTION).to_i\r\n users_to_notify << user\r\n end\r\n end\r\n end\r\n\r\n @plan.cancel\r\n\r\n #MES- Send the notifications\r\n users_to_notify.each do | user |\r\n UserNotify.deliver_cancel_plan(current_user, user, @plan)\r\n end\r\n\r\n flash[:notice] = \"This plan is canceled.<br/>Attendees have been notified of the cancellation via email.\"\r\n redirect_back\r\n end",
"def cancel!\n if AccountTransaction.transfer(self.num * self.price, self.startup.account, self.startup.account, :escrow, :balance).new_record?\n self.errors.add(:num, 'could not be refunded to your startup\\'s balance') \n return false\n end\n if self.responses.count > 0\n self.num = 0\n self.save\n else\n self.destroy\n end\n end",
"def cancel!\n player = self.player\n allow_from = Cfg.market_offer_cancellation_cooldown.ago\n raise GameLogicError,\n \"Cannot cannot cancel #{self}: you can only cancel your next offer from #{\n allow_from}\" if player.last_market_offer_cancel > allow_from\n player.last_market_offer_cancel = Time.now\n\n seller_source, attr = self.class.resolve_kind(self.planet, from_kind)\n seller_source.send(:\"#{attr}=\", seller_source.send(attr) + from_amount)\n self.class.save_obj_with_event(seller_source)\n destroy!\n player.save!\n end",
"def cancel\n if @reservation.can_cancel?\n @reservation.cancel!\n redirect_to reservations_path, notice: \"Shipment cancelled.\"\n else\n redirect_to reservations_path, alert: \"That gift is marked as #{@reservation.state} and cannot have its shipment cancelled.\"\n end\n end",
"def cancel!(transaction_uuid)\n post(nil, \"#{collection_path}/transaction-uuid-#{transaction_uuid}/cancel\")\n end",
"def get_next\n while next_item = @queue.peek\n if next_item.cancelled?\n @queue.shift\n else\n return next_item\n end\n end\n\n return nil\n end",
"def cancel()\n require_relative 'message'\n Message.new(@api, @api.do_request(\"POST\", get_base_api_path() + \"/cancel\"))\n end",
"def cancel()\n require_relative 'message'\n Message.new(@api, @api.do_request(\"POST\", get_base_api_path() + \"/cancel\"))\n end",
"def cancel_request\n if params.key?(:tutor_id) && params.key?(:student_id) && params.key?(:tutor_subject_id)\n pending_request = PendingTutorRequest.where('tutor_id = ? AND student_id = ? AND tutor_subject_id = ?',\n params[:tutor_id],\n params[:student_id],\n params[:tutor_subject_id]).first\n course = Course.find(TutorSubject.find(params[:tutor_subject_id]).course_id)\n else\n pending_request = PendingTutorRequest.find(params[:request_id])\n # Look into see if there is another way to do this.\n course = Course.find(TutorSubject.find(pending_request.tutor_subject_id).course_id)\n end\n\n pending_request.destroy\n course_code = course.course_prefix + course.course_code\n notifcation_params = { 'user_id' => params[:tutor_id],\n 'title' => 'Request Cencelled',\n 'body' => 'A request for ' + course_code + ' has been cancelled.',\n 'icon' => 'request_cancelled',\n 'color' => 'lightgrey',\n 'type' => 'cancel' }\n Notifications.send_notification(notifcation_params)\n\n head :ok\n end",
"def unpaid_payment\n self.payments.where(status: nil).or(self.payments.where(status: :failed)).last\n end",
"def link_to_cancel_new_deal (comment)\n link_to t('.cancel_new_deal'),\n util_cancel_new_deal_path(:comment_id => comment.id, :giftid => comment.gift.id),\n link_to_comment_options(comment, 'cancel')\n end",
"def cancel (flavour)\n\n return reply_to_parent(h.applied_workitem) if h.children.empty?\n #\n # there are no children, nothing to cancel, let's just reply to\n # the parent expression\n\n do_persist || return\n #\n # before firing the cancel message to the children\n #\n # if the do_persist returns false, it means it failed, implying this\n # expression is stale, let's return, thus discarding this cancel message\n\n children.each do |cfei|\n #\n # let's send a cancel message to each of the children\n #\n # maybe some of them are gone or have not yet been applied, anyway,\n # the message are sent\n\n @context.storage.put_msg(\n 'cancel',\n 'fei' => cfei,\n 'parent_id' => h.fei, # indicating that this is a \"cancel child\"\n 'flavour' => flavour)\n end\n\n #if ! children.find { |i| Ruote::Exp::FlowExpression.fetch(@context, i) }\n # #\n # # since none of the children could be found in the storage right now,\n # # it could mean that all children are already done or it could mean\n # # that they are not yet applied...\n # #\n # # just to be sure let's send a new cancel message to this expression\n # #\n # # it's very important, since if there is no child to cancel the parent\n # # the flow might get stuck here\n # @context.storage.put_msg(\n # 'cancel',\n # 'fei' => h.fei,\n # 'flavour' => flavour)\n #end\n end",
"def cancel!\n state_guard { modify_call 'Status' => 'cancelled' }\n end",
"def get(req)\n if dealership(req).subscription.ending?\n customer = Stripe::Customer.retrieve(dealership(req).customer_id)\n subscription = current_subscription(customer)\n @active_until = Time.at(subscription.current_period_end)\n render 'admin/account/canceled.erb'\n else\n render 'admin/account/cancel.erb'\n end\n end",
"def resourceType\n 'ExplanationOfBenefit'\n end",
"def get_recurring_amount\n recurring_amount || amount\n end"
] | [
"0.6087988",
"0.56167716",
"0.5515436",
"0.54824257",
"0.5461445",
"0.54609674",
"0.53933686",
"0.5379989",
"0.5319571",
"0.52780855",
"0.5275536",
"0.5263097",
"0.5244359",
"0.5210058",
"0.51593626",
"0.51530594",
"0.51471907",
"0.5135119",
"0.5119553",
"0.5102946",
"0.5088833",
"0.5059184",
"0.49802285",
"0.49797422",
"0.49697945",
"0.49599332",
"0.49299023",
"0.4914838",
"0.4903472",
"0.48901156",
"0.4871424",
"0.486423",
"0.48622337",
"0.48494735",
"0.48489305",
"0.4823636",
"0.48228148",
"0.47900328",
"0.4784158",
"0.47803485",
"0.4778917",
"0.47789162",
"0.47778428",
"0.47715798",
"0.47710556",
"0.47632614",
"0.4751423",
"0.4739371",
"0.47364277",
"0.47203675",
"0.47191408",
"0.47182304",
"0.47175443",
"0.47154444",
"0.4712708",
"0.47109595",
"0.4701407",
"0.46980825",
"0.46885732",
"0.46876833",
"0.4678168",
"0.4675272",
"0.46715012",
"0.4671398",
"0.46672225",
"0.4665405",
"0.4664627",
"0.4664275",
"0.46612412",
"0.4658183",
"0.46580496",
"0.46296054",
"0.46174774",
"0.4616316",
"0.46151054",
"0.46142894",
"0.4613393",
"0.46099988",
"0.46064118",
"0.46056318",
"0.46009642",
"0.45989913",
"0.4594867",
"0.45837477",
"0.45829463",
"0.45818478",
"0.45807034",
"0.45790505",
"0.45737132",
"0.45722368",
"0.45714027",
"0.45714027",
"0.45667922",
"0.4550943",
"0.45489398",
"0.45478064",
"0.45453387",
"0.45453143",
"0.45407742",
"0.4540346"
] | 0.76150334 | 0 |
The following 4 methods are for the DEVISE render pages | def resource_name
:user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render; end",
"def render; end",
"def render; end",
"def render; end",
"def render; end",
"def render_calls; end",
"def view_renderer; end",
"def view_renderer; end",
"def first_mandate\n # renders static page\n end",
"def rendered; end",
"def render\n end",
"def render\n\n end",
"def render\n end",
"def render\n end",
"def render\n end",
"def rendered_templates; end",
"def webpage\n render(:webpage, layout:false) and return\n end",
"def show\n smartrender\n end",
"def show\n smartrender\n end",
"def render_page(page)\n page.render\n end",
"def render\n end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def show\n \n if Page.count==0\n ensure_homepage\n else\n @page = @page || Page.find_by_alias(app_path)\n # TODO: add the ability for the user to choose whether to render the page or use it as a redirect\n #path = @page.path == '/' ? 'index' : @page.path\n #redirect_to @page.url unless path==app_path\n end\n\n if @page.nil?\n if admin?\n flash[:notice]=\"The page you requested does not exist. Would you like to create it?\"\n @page = Page.new(:path=>app_path)\n @page_template = \"admin\"\n render :action=>'new'\n else\n render :file => \"#{RAILS_ROOT}/public/404.html\", :layout => false, :status => 404\n end\n else\n @[email protected]\n @title = @page.title\n @page_description = @page.description\n\n # Even though the printable pages are rendered in a different layout\n # they also need a different template, since this template should only\n # have a single column\n \n if params[:print] && params[:print] == \"true\"\n @page_template = \"print\"\n elsif @page.url =~ /moving_from_caregivers_menu/\n @page_template = \"template_caregivers\"\n elsif @page.url =~ /moving_from_providers_menu/\n @page_template = \"template_providers\"\n else\n @page_template = @page.template.name\n end\n \n # This isn't really necessary, but it makes the print view very clean\n @pages = [@page]\n\n if params[:popup] && params[:popup] == \"true\"\n render :action => \"show\", :layout => false\n end \n\n if params[:save] && params[:save] == \"true\"\n render_for_save\n end \n \n #Setting the body_id to caregivers to access Noah's customized css. \n #Setting the body_id to caregivers to access Noah's customized css. \n if @page.template.name == 'template_caregivers'\n @body_id = \"Caregivers\" \n @other_perspective, @other_persepective_title = 'moving_from_providers_menu' + $1, 'Health Care Provider Perspective' if @page.url =~ /moving_from_caregivers_menu(.*)/\n elsif @page.template.name == 'template_providers'\n @body_id = \"Providers\" \n @other_perspective, @other_persepective_title = 'moving_from_caregivers_menu' + $1, 'Family Caregiver Perspective' if @page.url =~ /moving_from_providers_menu(.*)/\n elsif @page.template.name == 'template_caregivers_no_menu'\n @body_id = \"Caregivers\" \n elsif @page.template.name == 'template_providers_no_menu'\n @body_id = \"Providers\" \n elsif @page.template.name == 'template_index'\n @body_id = \"Home\" \n end\n \n @left_top_menu = Page.find_by_path 'left_top_menu' \n @left_bottom_menu = Page.find_by_path 'left_bottom_menu' \n \n \n @page_template, @page_type = 'template_pdf', 1 if @page.path == 'CaregiverTool'\n @page_template, @page_type = 'template_pdf', 2 if @page.path == 'ProviderTool'\n \n end\n end",
"def no_studio_no_privilege\n render_show\n # respond_to do |format|\n # format.html do |html|\n # html.mobile { render_show }\n # html.desktop { render_show }\n # end\n # end\n end",
"def render\n relative_permalinks_are_deprecated\n\n payload = site_payload\n\n Jekyll::Hooks.trigger :site, :pre_render, self, payload\n\n render_docs(payload)\n render_pages(payload)\n\n Jekyll::Hooks.trigger :site, :post_render, self, payload\n nil\n end",
"def page()\n session[:edit_mode] ||= 0\n# Initialize parts\n @parts = nil\n @js, @css = '', ''\n# find domain name in sites\n @site = dc_get_site\n# site is not defined. render 404 error\n return dc_render_404('Site!') if @site.nil?\n dc_set_options(@site.settings)\n# HOMEPAGE. When no parameters is set\n params[:path] = @site.homepage_link if params[:id].nil? and params[:path].nil?\n# Search for page \n pageclass = @site.page_table.classify.constantize\n if params[:id]\n @page = pageclass.find_by(subject_link: params[:id])\n elsif params[:path]\n# path may point direct to page's subject_link\n @page = pageclass.find_by(subject_link: params[:path])\n end\n# if @page is not found render 404 error\n return dc_render_404('Page!') unless @page\n dc_set_options @page.params\n# find design if defined. Otherwise design MUST be declared in site\n if @page.dc_design_id\n @design = DcDesign.find(@page.dc_design_id)\n return dc_render_404('Design!') unless @design\n end\n# Add to edit menu\n if session[:edit_mode] > 0\n session[:site_id] = @site.id\n session[:site_page_table] = @site.page_table\n session[:page_id] = @page.id\n end\n# perform check every hour. Perhaps if user has rights changes\n session[:last_check] ||= Time.now\n if (session[:last_check] - Time.now) > 3600\n # perform checks\n # TO BE DONE\n \n # update time\n session[:last_check] = Time.now\n end \n @page_title = @page.subject.empty? ? @site.page_title : @page.subject\n get_design_and_render @design\nend",
"def render_document; end",
"def rendered_views; end",
"def pages; end",
"def template_page(site); end",
"def show\n render(page_path)\n end",
"def render_page\n respond_to do |format|\n format.html do\n render action: :show, layout: !request.xhr?\n end\n end\n end",
"def render(options = nil, extra_options = {}, &block) #:doc:\n @flash=flash\nputs \"RENGINE RENDER #1\"\n options=interpret_rengine_options(options)\nputs \"RENGINE RENDER #2\"\n #no layout\n super(options,extra_options,&block)\nputs \"RENGINE RENDER #3\"\n unless self.no_wrap\nputs \"RENGINE RENDER #4a\"\n \n \n txx=render_weblab(setUserJavascript+ self.response_body.join(\"\\n\"))\n puts \"RENGINE RENDER #4b\"\n\n # puts \"===========================\\n\"+txx.join(\"\\n\")+\"\\n!================================!\"\n\n if $render_translation_link\n txx << \"\\n<div style=\\\"background-color:#aaa;color:#0ff;\\\">\\n\"\n txx << translation_tool(@displayed_blurb_names)\n txx << \"\\n</div>\\n\"\n end\nputs \"RENGINE RENDER #5\"\n\n self.response_body=txx\n \n end\n end",
"def rendered_views=(_arg0); end",
"def get_design_and_render(design_doc)\n layout = @site.site_layout.blank? ? 'content' : @site.site_layout\n site_top = '<%= dc_page_top %>'\n site_bottom = '<%= dc_page_bottom %>'\n# design defined in design doc \n if design_doc\n if !design_doc.rails_view.blank? \n if design_doc.rails_view.downcase != 'site'\n return render design_doc.rails_view, layout: layout\n end\n elsif !design_doc.body.blank?\n design = site_top + design_doc.body + site_bottom\n return render(inline: design, layout: layout)\n end\n end\n# design defined in site\n if @site.rails_view.blank? \n design = site_top + @site.design + site_bottom\n return render(inline: design, layout: layout)\n end\n render @site.rails_view, layout: layout\nend",
"def make_render_in_view exp\n make_render exp, true\n end",
"def render\n App.out.render\nend",
"def index\n # seeker_result Site, \"div.site_list\" # , clear_tags: true\n response_service.title = 'Sites'\n smartrender \n end",
"def pages\n end",
"def index\n @page = display_page('Admin')\n \n respond_to do |format|\n format.html\n end\n end",
"def get_page\n render_page_sections_json\n end",
"def show\n page_name, page_ext = get_page_path\n page = ComatosePage.find_by_path( page_name )\n status = nil\n if page.nil?\n page = ComatosePage.find_by_path( '404' )\n status = 404\n end\n # if it's still nil, well, send a 404 status\n if page.nil?\n render :nothing=>true, :status=>status\n #raise ActiveRecord::RecordNotFound.new(\"Comatose page not found \")\n else\n # Make the page access 'safe' \n @page = Comatose::PageWrapper.new(page)\n # For accurate uri creation, tell the page class which is the active mount point...\n ComatosePage.active_mount_info = get_active_mount_point(params[:index])\n render :text=>page.to_html({'params'=>params.stringify_keys}), :layout=>get_page_layout, :status=>status\n end\n end",
"def render_pages(static_path)\n puts \" Rendering pages\"\n Page.all.each do |p|\n if p.published? && (body = p.render)\n dir, filename = p.url, \"index.html\"\n dir, filename = p.parent.url, p.slug if p.slug =~ /\\.[^.]+$/i # File with extension (e.g. styles.css)\n FileUtils.mkdir_p(File.join(static_path, dir))\n File.open(File.join(static_path, dir, filename), 'w') { |io| io.print(body) }\n else\n puts \" ! Not rendering #{p.id} - #{p.status.name} - #{p.url}\"\n end\n end\nend",
"def render\n # To be implemented.\n end",
"def show\n #render template: \"hello_world/show\"\n render template: \"layouts/_commoncorelogo\"\n end",
"def page_load; end",
"def renderer; end",
"def prepare_for_action\n # #don't save stuff between requests\n NotRelational::RepositoryFactory.instance.clear_session_cache\n @@page_blurbs =Set.new\n @renderer_params={}\n $current_weblab=nil\n @current_user=nil\n @displayed_blurb_names=Set.new\n # if BannedIp.is_banned?(request.remote_ip)\n # head(401)\n # return\n # end\n\n prepare_language_for_action\n prepare_powerbar_for_action\n prepare_rendermode_for_action\n prepare_weblab_for_action\n\n\n self.page_title=\"Rengine\"\n self.no_wrap=false\n return true\n end",
"def about_us\n render(:about_us, layout:false) and return\n end",
"def show\n page = params[:page]\n puts \"the page is#{page}\"\n render \"statics#{page}\"\n end",
"def render_show_page\n render_buffer current_theme.questions_show_html.read\n end",
"def rendered=(_arg0); end",
"def app_landing\n end",
"def page\n\n end",
"def liquid_renderer; end",
"def process_default_render exp\n process_layout\n process_template template_name, nil\n end",
"def render\n return nil\n end",
"def render!; raise NotImplementedError end",
"def render(*args); end",
"def render(*args); end",
"def prepare_render\n @content = '## Página no encontrada'\n event = Event.find(params[:event_id])\n if (event)\n pages = event.pages.select{ |page| page.path == params[:page_path]}\n unless(pages.empty?)\n @content = MarkdownEventParser.add_event_details(event, pages[0].content)\n end\n end\n @content = MARKDOWN.render(@content)\n render\n end",
"def render(context, options); end",
"def version\n render layout: \"layouts/full_page\"\n end",
"def version\n render layout: \"layouts/full_page\"\n end",
"def rendering_options\n end",
"def site_pages \n Rails.application.reload_routes!\n page_routes = Rails.application.routes.routes.select do |route|\n route.verb == \"GET\" && !route.name.blank? && !route.name.match(/^edit/) && !route.name.match(\"translat\") && !route.name.match(\"external_author\")\n end\n\n @paths = []\n @errors = []\n @errors << \"Skipping translation and external author pages because these areas are in-progress.\"\n\n page_routes.each do |r|\n path = r.path.split('(').first\n while (path.match(/:([^\\/]+)_id\\//)) do\n id = get_id(path, current_user, $1.singularize)\n if id\n path.gsub!(\":#{$1}_id\", \"#{id}\") if id\n @last_id = id\n else\n @errors << \"Couldn't find object for #{path}, #{$1}\"\n break\n end\n end\n\n if (path.match(/\\/([^\\/]+)\\/:id/))\n id = get_id(path, current_user, $1.singularize)\n if id\n path.gsub!(\":id\", \"#{id}\")\n @last_id = id\n else\n @errors << \"Couldn't find object for #{path}, id\"\n end\n end\n\n @paths << [path, r.name]\n end\n \n render :action => \"site_pages\", :layout => \"application\"\n end",
"def get\n respond_to_html { render \"page/#{@request.id}.html\" }\n end",
"def renderer\r\n if @renderer.blank?\r\n if self.controller.present?\r\n @renderer = PageTag::PageRenderer::RailsRenderer.new(self.ehtml, self.ecss, self.ejs, self.context,self.controller)\r\n else\r\n @renderer = PageTag::PageRenderer::ErubisRenderer.new(self.ehtml, self.ecss, self.ejs, self.context)\r\n end\r\n end\r\n @renderer\r\n end",
"def renderOutput( request, response, session, properties, xmlFileToRender, theme, baseDocRoot,\n baseDocRootInclude, onlyModules)\n @mySession = session\n @myRequest = request\n @myResponse = response\n @myPropertyLoader = properties\n @baseDocRoot = baseDocRoot\n @baseDocRootInclude = baseDocRootInclude\n @myTheme = theme\n\n cWorkArea = GlobalSettings.getCurrentWorkArea(session)\n #docDataDir = GlobalSettings.getDocumentDataDirectory\n @FS = File::SEPARATOR\n tmp = properties.getProperties(\"redirect\")\n myPage = FileCMS.new(session, \"#{cWorkArea}#{@FS}#{xmlFileToRender}\")\n\n #puts \"Theme is: #{theme}\"\n themeTmp = request[\"template\"]\n templateDir = \"#{cWorkArea}#{@FS}system#{@FS}templates#{@FS}#{theme}\"\n\n #puts \"TemplateDir exists? #{templateDir} -- #{File.exist?(templateDir)}\"\n if(!File.exist?(templateDir) && request[\"template\"] == nil)\n theme = \"default\"\n templateDir = \"#{cWorkArea}#{@FS}system#{@FS}templates#{@FS}#{theme}\"\n end\n\n version = -1\n if(request[\"version\"] != nil)\n version = request[\"version\"].to_i\n end\n page = Page.new(myPage, version, session, myPage.getFileURL)\n\n\n # TO-DO: Implement Template system then this....\n myTemplate = Template.new(templateDir, page)\n myTemplate.setRenderer(self)\n #puts \"AdditionalParams :: #{@extraParams}\"\n myTemplate.setAdditionalParameters(@extraParams)\n #myTemplate.setHTMLRenderer(self)\n if(!onlyModules)\n pageContent = myTemplate.getParsedTemplate\n #puts \"PageContent : #{pageContent}\"\n else\n pageContent = \"\"\n end\n\n if myTemplate.hasModuleTemplates\n\n #//TODO: process page, each module, one at a time.... Need to supply each with the correct module ID.\n pageModuleContent = \"\"\n mods = page.getAllPageModules\n #puts \"Mod count : #{mods.size}\"\n mods.each{ |mod|\n\n modType = mod.getModuleType\n if myTemplate.containsModuleTemplate(modType)\n #TO-DO: process needs to be implemented to support templates in modules....\n modTemplate = myTemplate.getModuleTemplate(modType)\n modTemplate.setModuleToRender(mod)\n pageModuleContent.concat(modTemplate.parseTemplate)\n else\n pageModuleContent.concat(\"<br>Module not supported:#{modType}<br>\")\n end\n\n }\n end\n #puts \"About to process #{@extraParams}\"\n\n\n #processExtraParameters(pageModuleContent)\n if(!onlyModules)\n pageContent = Parser.replaceAll(pageContent, \"*CONTENT*\", pageModuleContent)\n else\n pageContent = pageModuleContent\n end\n\n return pageContent\n end",
"def show\n @title = @page.title\n @pages = @page.find_related_tags\n @case_studies = CaseStudy.tagged_with(@page.tag_list, :any => true)\n @locked = REDIS.exists(\"locks:pages:#{@page.id}\")\n if params[:mercury_frame] == 'true' && !@locked\n REDIS.setex(\"locks:pages:#{@page.id}\", 300, @page.canonical_title)\n elsif params[:mercury_frame] == 'true'\n render(text: \"<html><body><script type='text/javascript' charset='utf-8'>window.parent.document.location.href = '#{page_path(@page)}';</script></body></html>\", content_type: :html) and return\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def accessibility_statement\n # renders static page\n end",
"def set_page\n end",
"def show\n @preview_mode = true\n @root_page = Page.language_root_for(session[:language_id])\n # Setting the locale to pages language. so the page content has its correct translation\n ::I18n.locale = @page.language_code\n render :layout => layout_for_page\n rescue Exception => e\n exception_logger(e)\n render :file => Rails.root.join('public', '500.html'), :status => 500, :layout => false\n end",
"def symposium\n #@sections = @page.sections.published.sorted\n @legacy_url = \"/legacy/basymposium_ua/\"\n render \"layouts/legacy\"\n end",
"def renderOutput(request, response, session, propertyLoader, xmlFileToRender, theme)\n @mySession = session\n @myPropertyLoader = propertyLoader\n @myTheme = theme\n rendererConfig = YAML.load_file( \"#{GlobalSettings.getGlobal(\"Server-ConfigPath\")}OutputRenderers/JSON_XMLRenderer.yaml\")\n cWorkArea = GlobalSettings.getCurrentWorkArea(session)\n docDataDir = GlobalSettings.getDocumentDataDirectory\n @FS = File::SEPARATOR\n xmlFileToRender = xmlFileToRender[0..xmlFileToRender.rindex(\".\")]+\"xml\" if xmlFileToRender.end_with? \".admin\"\n #puts \"\\n\\n----------------------------FileToRender: #{xmlFileToRender}--------------------\\n\\n\"\n file = \"#{cWorkArea}#{xmlFileToRender}\"\n file = GlobalSettings.changeFilePathToMatchSystem(file)\n fcms = nil\n myPage = nil\n if File.exists? file\n fcms = FileCMS.new(session, file, false)\n myPage = Page.new(fcms, -1, session, file)\n #puts \"\\n\\n-------------\\n\\nLoaded Page: #{myPage.title}\\n\\n---------------------------------------\"\n else\n fcms = FileCMS.new(session, file, true)\n end\n #puts \"Theme is: #{theme}\"\n themeTmp = request[\"template\"]\n templateDir = \"#{cWorkArea}#{@FS}system#{@FS}templates#{@FS}#{theme}\"\n\n puts \"TemplateDir exists? #{templateDir} -- #{File.exist?(templateDir)}\"\n if(!File.exist?(templateDir) && request[\"template\"] == nil)\n theme = \"default\"\n templateDir = \"#{cWorkArea}#{@FS}system#{@FS}templates#{@FS}#{theme}\"\n end\n\n version = -1\n if(request[\"version\"] != nil)\n version = request[\"version\"].to_i\n end\n\n # TO-DO: Implement Template system then this....\n\n myTemplate = JSONTemplate.new(templateDir, request[\"file_contents\"], myPage)\n myTemplate.setRenderer(self)\n #myTemplate.setHTMLRenderer(self)\n pageContent = myTemplate.getParsedTemplate\n pageModuleContent = \"\"\n if myTemplate.hasModuleTemplates\n\n\n file_contents = request[\"file_contents\"][:blocks]\n #puts \"HELLOOOOOO :::::: #{file_contents}\"\n file_contents.each{ |key|\n #puts \"Request :::::: #{key}\"\n if key.is_a? Array\n #modType = key[:type]\n at = 0\n modId = nil\n key.each{ |nkey|\n\n if at == 0\n modId = nkey\n at = at.next\n #puts \"Module ID::::: #{modId}\"\n elsif nkey.is_a? Hash\n\n modType = nkey[\"type\"]\n #puts \"\\n\\nNext module type: #{modType}\\n\\n\"\n if myTemplate.containsModuleTemplate(modType)\n\n #TO-DO: process needs to be implemented to support templates in modules....\n modTemplate = myTemplate.getModuleTemplate(modType)\n puts \"#{modType} :::: Data:::: #{nkey[\"data\"]}\"\n modParameters = nkey[\"data\"]\n modParameters[\"id\"] = \"#{modId}\"\n modParameters[\"visible\"] = \"true\"\n modParameters[\"descriptive_name\"] = \"#{modType.capitalize} module\"\n puts \"\\n\\nModule Parameters: #{modParameters}\\n\\n\"\n modTemplate.setModuleData(modParameters)\n #puts \"------------------>Processing module template: #{modType} :: #{modTemplate}\"\n #modTemplate.setModuleToRender(mod)\n pageModuleContent.concat(\"<module>\")\n pageModuleContent.concat(modTemplate.parseTemplate)\n pageModuleContent.concat(\"</module>\")\n #puts \"\\n\\n\\n#{pageModuleContent}\\n\\n\\n\"\n else\n pageModuleContent.concat(\"\\\"unsupported\\\": \\\"Module not supported:#{modType}\\\"\")\n end\n end\n }\n end\n }\n end\n #puts \"Test....\"\n pageContent = Parser.replaceAll(pageContent, \"*CONTENT*\", pageModuleContent)\n pageContent = Hub.applyFilters(request, response, session, pageContent)\n\n myFile = fcms.getFileForWrite# { |file|\n myFile.write( pageContent )\n myFile.close\n return \"{\\\"success\\\": \\\"Writing to #{fcms.getFileURL} success\\\"}\"\n\n end",
"def featured\n render '/home/app'\n end",
"def render\n raise NotImplementedError\n end",
"def render(action = nil, options = {}, &blk)\n present(@page) unless admin? or @meta.present?\n super\n end",
"def home\n render \"home\"\n end",
"def prepare_rendermode_for_action\n \n $render_translation_link=false\n \n if cookies[\"is_translating\"] == 'true'\n login_from_cookie\n if logged_in? && current_user.can_translate?\n $render_translation_link=true\n \n end\n \n end\n Rengine::Blurb.use_cache=!$render_translation_link\n\n if $render_translation_link\n $render_mode=:force_render\n end\n\n if params[:render_mode]\n render_base.render_mode_override =params[:render_mode].to_sym\n else\n render_base.render_mode_override=nil\n end\n\n @render_preruntime=(\"true\"==params[:render_preruntime])\n \n \n\n\n end",
"def render(*args)\n end",
"def render(options = nil, extra_options = {}, &block)\n # your code goes here\n prep_pagination_info(@results_h[:pagination_info]) if @results_h && @results_h[:pagination_info]\n \n # call the ActionController::Base render to show the page\n super\n end",
"def redirect_to_teaser\n #if Rails.env.production?\n # logger.info \"User is not authorized. Redirecting user to WOSoMP Teaser\"\n # render :file=>File.join(Rails.root,\"public/teaser.html\"), :layout=>nil\n # return\n # end\n end",
"def render!\n Rails.logger.debug \"render\".red\n if @payment = page.payment\n @payment.succeeded? ? (pxpay_success and return) : pxpay_failure\n end\n if request.post?\n if request.params[:next_button] && next?\n Rails.logger.debug valid?.to_s\n if valid?\n unless self.next.next?\n @payment = create_payment\n if @payment.save and redirectable?\n controller.redirect_to @payment.redirect_url and return\n else\n Rails.logger.debug @payment.errors.to_s.blue\n @payment.errors.each { |attrib, err| errors.add attrib, err }\n end\n else\n data[:_step] = self.next.name\n save_data_to controller.session\n controller.redirect_to form.permalink and return false\n end\n end\n elsif request.params[:back_button] && previous?\n data[:_step] = self.previous.name\n save_data_to controller.session\n controller.redirect_to form.permalink and return false\n end\n end\n\n # Skip ApplyOnline::ApplicationPage render!\n request.format = 'html' # circumvents problem where DPS FPRN doesn't set mime-type\n Breeze::Content::PageView.instance_method(:render!).bind(self).call\n end",
"def home\n render 'home'\n end",
"def _view; end",
"def render(page=1, arguments=\"\")\n \n view_data = get_view_data(page, arguments)\n \n view_url = '' #/'\n \n if view.url.to_s.strip.length > 0\n view_url << view.url\n else\n view_url << '/'\n view_url << view.view_name\n end \n\n template_path = find_view_holder\n template = Tilt.new(template_path)\n \n result = template.render(context, {:view => @view, \n :view_url => view_url, \n :view_data => view_data, \n :view_body => render_view_body(view_data), \n :view_arguments => arguments})\n \n if String.method_defined?(:force_encoding)\n result.force_encoding('utf-8')\n end\n\n return result\n \n end",
"def about; render; end",
"def before_rendering( state=nil )\n\t\t# Nothing to do\n\t\treturn nil\n\tend",
"def render\n request('render').auth_required!\n end"
] | [
"0.69691765",
"0.69691765",
"0.69691765",
"0.69691765",
"0.69691765",
"0.6953017",
"0.6926832",
"0.6926832",
"0.6797047",
"0.6771072",
"0.67380965",
"0.6723867",
"0.6723027",
"0.6723027",
"0.6723027",
"0.66710174",
"0.6641377",
"0.6556785",
"0.6556785",
"0.6536011",
"0.65300906",
"0.64814734",
"0.64814734",
"0.64814734",
"0.64814734",
"0.64814734",
"0.64814734",
"0.64814734",
"0.64814734",
"0.64814734",
"0.64814734",
"0.64814734",
"0.64814734",
"0.64478594",
"0.64410096",
"0.6436722",
"0.6428085",
"0.64269257",
"0.64219236",
"0.6421849",
"0.63892937",
"0.6373858",
"0.63689464",
"0.6361965",
"0.63421285",
"0.63226163",
"0.6302589",
"0.63020694",
"0.6271575",
"0.62398857",
"0.6231555",
"0.6231522",
"0.6195694",
"0.61907685",
"0.6176787",
"0.6174421",
"0.61675316",
"0.6162034",
"0.6147708",
"0.6146512",
"0.61388993",
"0.61368436",
"0.61240643",
"0.61235064",
"0.6123028",
"0.6107813",
"0.61070687",
"0.6094202",
"0.6074704",
"0.6065695",
"0.6065695",
"0.60601515",
"0.60577244",
"0.6043685",
"0.6043685",
"0.6033127",
"0.603248",
"0.60295784",
"0.60287815",
"0.6025176",
"0.6024783",
"0.60198605",
"0.6018589",
"0.60134935",
"0.60110563",
"0.6002906",
"0.59991705",
"0.5990916",
"0.5974629",
"0.5973684",
"0.59660566",
"0.59640354",
"0.5962986",
"0.5960191",
"0.59530795",
"0.5951276",
"0.59471256",
"0.5940511",
"0.5940156",
"0.59341353",
"0.5928431"
] | 0.0 | -1 |
Create a new Collection of Resource objects ==== Arguments _session_ Session object _resource_ class of the Resource for this collection _owner_ a Resource object which owns the collection, applies scope to calls ==== Usage Normally you do not call the constructor directly, instead you go via the Session or Deal instance, like this: | def initialize(session, resource, owner = nil)
@session = session
@resource = resource
@owner = owner
@prefix = owner ? owner.element_path : ''
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_collection\n @resource.make_collection\n end",
"def resource_collection\n @resource_collection ||= @run_context.resource_collection\n end",
"def set_collection_instance\n instance_variable_set(\"@#{resource_plural_name}\", resource_proxy)\n end",
"def decorated_collection\n @collection.map do |element|\n Resource.new(element, @controller)\n end\n end",
"def scope_collection(collection, action = :index)\n collection\n end",
"def collection(resource_name, model = nil)\n @collections[resource_name] = {:parent => self, :target => (model ? model : resource_name)} # workaround for weird bug with passing a class to Collection\n class_eval(<<-EOS)\n def #{resource_name}\n @#{resource_name} ||= []\n end\n\n def #{resource_name}=(array)\n @#{resource_name} = SurveyGizmo::Collection.new(#{self}, :#{resource_name}, array)\n end\n EOS\n end",
"def load_collection\n current_ability.scope_for(authorization_action, resource_class) do\n resource_base.accessible_by(current_ability, authorization_action)\n end\n end",
"def collection(&block)\n unless resource_scope?\n raise ArgumentError, \"can't use collection outside resource(s) scope\"\n end\n\n with_scope_level(:collection) do\n path_scope(parent_resource.collection_scope, &block)\n end\n end",
"def initialize\n @coll = self.class.collection\n end",
"def initialize(collection)\n @collection = collection\n end",
"def calligraphy_resource(*resources, &block)\n options = resources.extract_options!.dup\n\n if apply_common_behavior_for :calligraphy_resource, resources, options, &block\n return self\n end\n\n with_scope_level(:resource) do\n options = apply_action_options options\n\n resource_scope(SingletonResource.new(resources.pop, api_only?, @scope[:shallow], options)) do\n yield if block_given?\n\n concerns(options[:concerns]) if options[:concerns]\n\n set_mappings_for_web_dav_resources\n end\n end\n end",
"def new_collection(query, resources = nil, &block)\n Collection.new(query, resources, &block)\n end",
"def initialize(collection)\n @collection = collection\n end",
"def enclosing_collection_resources\n @enclosing_collection_resources ||= []\n end",
"def initialize(attrs, collection_name, klass, client, method_name, method_options)\n @attrs = attrs\n @client = client\n @method_name = method_name\n @method_options = method_options\n @collection = Array(attrs[collection_name.to_sym]).map do |item|\n if klass\n klass.fetch_or_new(item)\n else\n item\n end\n end\n singleton_class.class_eval do\n alias_method(collection_name.to_sym, :collection)\n end\n end",
"def initialize\n @coll=self.class.collection\n end",
"def has_many(resource_name, options = {}, block = nil)\n meta_def resource_name do |*params|\n path = (path_with_slash + (options[:path] || resource_name.to_s))\n filter = params.first || {}\n collection = @client.resource(:path => path, :parent => self, :block => block, :filter => filter, :extend => options[:extend])\n collection.extend(CollectionMethods) # unless?\n collection.extend(options[:extend]::CollectionMethods) if options[:extend] # unless?\n collection\n end\n end",
"def initialize(klass, resource_path)\n url = \"#{ApiClient.config.path}#{resource_path}\"\n @collection = ApiClient::Parser.response(ApiClient::Dispatcher.get(url), url)\n @collection.map! do |attributes|\n klass.new(attributes)\n end\n end",
"def new_resource\n base_collection.new\n end",
"def collection_scope; end",
"def resources(opts={})\n Tripod::ResourceCollection.new(\n self.resource_class._resources_from_sparql(self.as_query(opts)),\n # pass in the criteria that was used to generate this collection, as well as whether the user specified return graph\n :return_graph => (opts.has_key?(:return_graph) ? opts[:return_graph] : true),\n :criteria => self\n )\n end",
"def scoped_collection(_parent_records)\n raise NotImplementedError.new 'override #scoped_collection in a subclass'\n end",
"def initialize(collection={}, model = Occi::Model.new)\n collection = Hashie::Mash.new(collection) unless collection.kind_of? Occi::Collection\n\n @kinds = Occi::Core::Kinds.new\n @mixins = Occi::Core::Mixins.new\n @actions = Occi::Core::Actions.new\n @resources = Occi::Core::Resources.new\n @links = Occi::Core::Links.new\n\n @kinds.merge collection.kinds.to_a.collect { |kind| Occi::Core::Kind.new(kind.scheme, kind.term, kind.title, kind.attributes, kind.related, kind.actions, kind.location) }\n @mixins.merge collection.mixins.to_a.collect { |mixin| Occi::Core::Mixin.new(mixin.scheme, mixin.term, mixin.title, mixin.attributes, mixin.depends, mixin.actions, mixin.location, mixin.applies) }\n @actions.merge collection.actions.to_a.collect { |action| Occi::Core::Action.new(action.scheme, action.term, action.title, action.attributes) }\n @resources.merge collection.resources.to_a.collect { |resource| Occi::Core::Resource.new(resource.kind, resource.mixins, resource.attributes, resource.actions, resource.links, resource.location) }\n @links.merge collection.links.to_a.collect { |link| Occi::Core::Link.new(link.kind, link.mixins, link.attributes, link.actions, link.rel, link.target, link.source, link.location) }\n @action = Occi::Core::ActionInstance.new(collection.action.action, collection.action.attributes) if collection.action\n\n self.model = model if model\n end",
"def new_collection(query, resources = nil, &block)\n self.class.new(query, resources, &block)\n end",
"def initialize(opts = {})\n super\n @resource_class = OMF::SliceService::Resource::SliceMember\n\n # Define handlers\n opts[:slice_member_handler] = self\n @coll_handlers = {\n slice: lambda do |path, sopts|\n slice_member = get_context_resource(:slice_memberships, sopts)\n path.insert(0, slice_member.slice.uuid.to_s)\n sh = (opts[:slice_handler] ||= SliceHandler.new(opts))\n sh.find_handler(path, sopts)\n end,\n user: lambda do |path, sopts|\n slice_member = get_context_resource(:slice_memberships, sopts)\n path.insert(0, slice_member.user.uuid.to_s)\n uh = (opts[:user_handler] ||= UserHandler.new(opts))\n uh.find_handler(path, sopts)\n end,\n slice_credential: lambda do |path, opts|\n OMF::SFA::AM::Rest::ContentFoundException.new(opts[:resource], :json) do |r|\n r.slice_credential\n end\n end\n }\n end",
"def new\n @collection = Collection.new\n \n 2.times { @collection.collectionizes.build.build_resource }\n\n p @collection\n p @collection.collectionizes\n p @collection.resources\n p @collection.collectionizes.first.resource\n p @collection.collectionizes.last.resource\n\n end",
"def resource\n @resource ||= resource_klass.new object\n end",
"def instantiate_collection(collection)\n collection.collect! { |record| instantiate_record(record) }\n end",
"def resource_scope\n resource_class.all\n end",
"def initialize(params={})\n name = init_collection_name params[:define_collection_name]\n @@_collection[self.class.name] ||= Schema.instance.get_collection(name)\n @id = params[:id] if params[:id]\n @__ref_value__ = '\"*\"'\n\n # @event_types = params[:event_types] ? params[:event_types] : []\n # @relation_kinds = params[:graphs] ? params[:graphs] : []\n\n @@_cache[self.class.name] ||= SimpleCacheRequest.new(ocollection)\n @@cache_store ||= SimpleCacheStore.instance\n end",
"def collection(objectName)\n Hirsute::Collection.new(objectName)\nend",
"def add(resource)\n if !exists?(resource) && filtered?(resource)\n @collection[resource.to_s] = ResourceWrapper.new(resource)\n end\n end",
"def build(attrs, collection)\n collection.new(attrs)\n end",
"def all(params = {})\n query = params.map { |key, value| \"#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}\" }.join(\"&\")\n query = \"?\" + query unless query.empty?\n code, data = @session.get(collection_path + '.json' + query)\n data.collect { |data|\n key = @resource.name.to_s.split('::').last.downcase\n @resource.new(data[key].merge(:session => @session, :prefix => @prefix))\n }\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def initialize(resource)\n @resource = resource\n end",
"def add(resource)\n if !exists?(resource) && !filtered?(resource)\n @collection[resource.to_s] = ResourceWrapper.new(resource)\n end\n end",
"def base_collection\n @base_collection ||= resource_model.all\n end",
"def set_collection_instance\n instance_variable_set(:\"@#{model_type.to_s.gsub('/', '__').pluralize}\", @resources)\n end",
"def set_collection_instance\n instance_variable_set(:\"@#{model_type.to_s.gsub('/', '__').pluralize}\", @resources)\n end",
"def api_list_resource(collection: nil, search_fields: nil, paginate: true,\n filtering_params: nil)\n ApiListResource.new(\n collection: collection,\n params: params,\n search_fields: search_fields,\n filtering_params: filtering_params,\n paginate: paginate\n )\n end",
"def new_collection\n Models::Collection.new\n end",
"def instantiate_collection_with_collection(collection, prefix_options = {})\n if collection.is_a?(Hash) && collection[\"type\"] == \"collection\"\n collectables = collection.values.find{|c| c.is_a?(Hash) || c.is_a?(Array) }\n collectables = [collectables].compact unless collectables.kind_of?(Array)\n instantiated_collection = WillPaginate::Collection.create(collection[\"current_page\"], collection[\"per_page\"], collection[\"total_entries\"]) do |pager|\n pager.replace instantiate_collection_without_collection(collectables, prefix_options)\n end \n else\n instantiate_collection_without_collection(collection, prefix_options)\n end \n end",
"def initialize\n @collection = []\n end",
"def get_resource\n\t\t\tlogger.debug {\"ALLOCATING NEW RESOURCE --> #{ ActiveOrient.db_pool.size }\" }\n login = [ActiveOrient.default_server[:user] , ActiveOrient.default_server[:password]]\n server_adress = \"http://#{ActiveOrient.default_server[:server]}:#{ActiveOrient.default_server[:port]}\"\n\t\t\t RestClient::Resource.new(server_adress, *login)\n end",
"def initialize\n @collection={}\n end",
"def create\n @collection = Collection.new(collection_params)\n @collection.owner = User.find_by username: session[:user]\n respond_to do |format|\n if @collection.save\n format.html { redirect_to @collection, success: 'Collection was successfully created.' }\n format.json { render :show, status: :created, location: @collection }\n else\n format.html { redirect_to @collection, alert: 'Collection was not created.' }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(inventory_collection: nil)\n @inventory_collection = inventory_collection\n end",
"def build_resource(hash = {})\n self.resource = resource_class.new_with_session(hash, session)\n end",
"def build_resource(hash = {})\n self.resource = resource_class.new_with_session(hash, session)\n end",
"def new\n @collection = Collection.new\n end",
"def resource( rsrcobj, options={} )\n\t\t\tself.log.debug \"Adding REST resource for %p\" % [ rsrcobj ]\n\t\t\toptions = self.service_options.merge( options )\n\t\t\tself.log.warn \"Options = %p\" % [ options ]\n\n\t\t\t# Add a parameter for the primary key\n\t\t\tpkey = rsrcobj.primary_key\n\t\t\tpkey_schema = rsrcobj.db_schema[ pkey.to_sym ] or\n\t\t\t\traise ArgumentError,\n\t\t\t\t\t\"cannot generate services for %p: resource has no schema\" % [ rsrcobj ]\n\t\t\tself.param( pkey, pkey_schema[:type] ) unless\n\t\t\t\tself.paramvalidator.param_names.include?( pkey.to_s )\n\n\t\t\t# Figure out what the resource name is, and make the route from it\n\t\t\tname = options[:name] || rsrcobj.implicit_table_name\n\t\t\troute = [ options[:prefix], name ].compact.join( '/' )\n\t\t\tself.log.warn \"Route is: %p\" % [[ options[:prefix], name ]]\n\n\t\t\t# Make and install handler methods\n\t\t\tself.log.debug \" adding readers\"\n\t\t\tself.add_options_handler( route, rsrcobj, options )\n\t\t\tself.add_read_handler( route, rsrcobj, options )\n\t\t\tself.add_collection_read_handler( route, rsrcobj, options )\n\n\t\t\t# Add handler methods for the mutator parts of the API unless\n\t\t\t# the resource is read-only\n\t\t\tif options[:readonly]\n\t\t\t\tself.log.debug \" skipping mutators (read-only set)\"\n\t\t\telse\n\t\t\t\tself.add_collection_create_handler( route, rsrcobj, options )\n\t\t\t\tself.add_update_handler( route, rsrcobj, options )\n\t\t\t\tself.add_collection_replace_handler( route, rsrcobj, options )\n\t\t\t\tself.add_replace_handler( route, rsrcobj, options )\n\t\t\t\tself.add_collection_deletion_handler( route, rsrcobj, options )\n\t\t\t\tself.add_delete_handler( route, rsrcobj, options )\n\t\t\tend\n\n\t\t\t# Add any composite resources based on the +rsrcobj+'s associations\n\t\t\tself.add_composite_resource_handlers( route, rsrcobj, options ) if options[:composite]\n\t\tend",
"def initialize_custom_attributes_collections(relation, sections)\n sections.each do |section|\n query = CustomAttribute.where(:resource_type => relation.model.name,\n :resource_id => relation,\n :section => section.to_s)\n @inv_collections[[:custom_attributes_for, relation.model.name, section.to_s]] =\n ::ManagerRefresh::InventoryCollection.new(\n :model_class => CustomAttribute,\n :arel => query,\n :manager_ref => [:resource, :section, :name],\n )\n end\n end",
"def initialize_container_conditions_collection(relation)\n query = ContainerCondition.where(\n :container_entity_type => relation.model.name,\n :container_entity_id => relation, # nested SELECT. TODO: compare to a JOIN.\n )\n @inv_collections[[:container_conditions_for, relation.model.name]] =\n ::ManagerRefresh::InventoryCollection.new(\n :model_class => ContainerCondition,\n :arel => query,\n :manager_ref => [:container_entity, :name],\n )\n end",
"def build_collection_scope_base(some_instance)\n some_instance.send(@collection_name).scoped\n end",
"def collection_for(source, other_query = nil)\n query = query_for(source, other_query)\n\n collection = collection_class.new(query)\n collection.relationship = self\n collection.source = source\n\n # make the collection empty if the source is not saved\n collection.replace([]) unless source.saved?\n\n collection\n end",
"def collection_for(source, other_query = nil)\n query = query_for(source, other_query)\n\n collection = collection_class.new(query)\n collection.relationship = self\n collection.source = source\n\n # make the collection empty if the source is not saved\n collection.replace([]) unless source.saved?\n\n collection\n end",
"def collection_action(action)\n define_method(action) do\n if params[:ids].present?\n self.resources ||= resource_scope.where(id: params[:ids])\n end\n\n if effective_resource.scope?(action)\n self.resources ||= resource_scope.public_send(action)\n end\n\n self.resources ||= resource_scope.all\n\n EffectiveResources.authorize!(self, action, resource_klass)\n\n @page_title ||= \"#{action.to_s.titleize} #{resource_plural_name.titleize}\"\n\n collection_post_action(action) unless request.get?\n end\n end",
"def initialize(resource)\n @resource = resource\n end",
"def initialize(attrs, collection_name, klass, client, id, method_name, method_options)\n @attrs = attrs\n @client = client\n\t\t\t@id = id\n @method_name = method_name\n @method_options = method_options\n @collection = Array(attrs[:data]).map do |item|\n if klass\n klass.fetch_or_new(item)\n else\n item\n end\n end\n class_eval do\n alias_method(:data, :collection)\n end\n end",
"def initialize(attributes = {}, record_collection = nil)\n @attributes, @record_collection = attributes, record_collection\n @collection_proxies = {}\n end",
"def initialize(resource)\n @resource = resource\n end",
"def resource\n @resource ||= begin\n resource_constant.new(attributes)\n end\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 subresources\n if any?\n { collection_rel => self }\n else\n {}\n end\n end",
"def present_collection(collection = resource); nil; end",
"def resource_collection\n run_context && run_context.resource_collection\n end",
"def collection\n conditions = conditions_from_params\n @collection ||= end_of_association_chain.find(:all, :conditions => conditions)\n end",
"def resources=(collection)\n instance_variable_set(\"@#{resources_name}\", collection)\n end",
"def initialize(collection, options = {})\n @collection = collection\n @options = options\n end",
"def initialize(collection, options = {})\n @collection = collection\n @options = options\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def collection\n @collection ||= load_collection\n end",
"def collection\n get_collection_ivar || begin\n c = end_of_association_chain\n set_collection_ivar(c.respond_to?(:scoped) ? c.scoped : c.all)\n end\n end",
"def collection\n Rails.logger.info \"XXXXX COLLECTION NAME #{collection_hash['collection name']}\"\n\n @collection ||= CollectionCreator.find_or_create_collection(\n collection_hash['collection name'],\n collection_hash['unit name'],\n collection_hash['collection description'],\n submitter_user_key\n )\n end",
"def resources\n collection = Miasma::Models::Orchestration::Stack::Resources.new(self)\n collection.define_singleton_method(:perform_population) do\n valid = stack.sparkleish_template.fetch(:resources, {}).keys\n stack.custom[:resources].find_all { |r| valid.include?(r[:name]) }.map do |attrs|\n Miasma::Models::Orchestration::Stack::Resource.new(stack, attrs).valid_state\n end\n end\n collection\n end",
"def build_resource(hash = nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def initialize(owner, capacity)\n @capacity = capacity\n @players = []\n @owner = owner\n @id = SecureRandom.base64 # TODO: possible id collisions\n @game = nil\n end",
"def find_or_create_resource_for_collection(name)\r\n find_or_create_resource_for(name.to_s.singularize)\r\n end",
"def create_resource(source_class:, related_records_with_context:)\n ::Pundit.authorize(user, source_class, 'create?')\n related_records_with_context.each do |data|\n relation_name = data[:relation_name]\n records = data[:records]\n relationship_method = \"create_with_#{relation_name}?\"\n policy = ::Pundit.policy(user, source_class)\n if policy.respond_to?(relationship_method)\n unless policy.public_send(relationship_method, records)\n raise ::Pundit::NotAuthorizedError,\n query: relationship_method,\n record: source_class,\n policy: policy\n end\n else\n Array(records).each do |record|\n ::Pundit.authorize(user, record, 'update?')\n end\n end\n end\n end",
"def all(params={})\n scoped_attributes = self.class.scopes.inject({}){|r,k| r.merge(k.to_s => send(k))}\n scoped_attributes.merge!(params)\n body = connection.send(collection_method, scoped_attributes).body\n\n collection = self.load(body[collection_root])\n collection.merge_attributes(Cistern::Hash.slice(body, \"count\", \"next_page\", \"previous_page\"))\n collection\n end",
"def resource\n @resource ||= begin\n resource_query\n .new(relation: resource_scope)\n .find_for_show(find_by_conditions: find_by_conditions)\n end\n end",
"def collection_representer_klass\n resource_module::Representer::Collection\n end",
"def current_collection() instance_variable_get(\"@#{resource_plural}\") end",
"def initialize(collection = nil)\n @collection = collection || default_collection\n end",
"def initialize(collection, operations, options)\n @collection = collection\n @operations = operations\n @options = options\n end",
"def inherited(resource)\r\n resource.class_eval do\r\n self.versions ||= {}\r\n self.helper_object = Object.new\r\n\r\n begin\r\n plural = name.demodulize.tableize\r\n self.path = lambda { |format|\r\n begin\r\n new.polymorphic_path [:resources, plural], :format => format\r\n rescue => e\r\n nil\r\n end\r\n }\r\n self.query_template = DEFAULT_COLLECTION_QUERY_TEMPLATE.dup\r\n self.model = name.sub(/^Restful\\b/, '').constantize\r\n finder :find, :all, :first, :last\r\n helper ApplicationHelper\r\n rescue ArgumentError, NameError => e\r\n nil\r\n end\r\n\r\n Restful::Resource.classes << self\r\n end\r\n end",
"def collection_for(source, other_query=nil)\n Collection.new(source, target_model)\n end",
"def collection\n resource_class.all\n end",
"def resource_scope # Thing\n @_effective_resource_relation ||= (\n relation = case @_effective_resource_scope # If this was initialized by the resource_scope before_filter\n when ActiveRecord::Relation\n @_effective_resource_scope\n when Hash\n effective_resource.klass.where(@_effective_resource_scope)\n when Symbol\n effective_resource.klass.send(@_effective_resource_scope)\n when nil\n effective_resource.klass.all\n else\n raise \"expected resource_scope method to return an ActiveRecord::Relation or Hash\"\n end\n\n unless relation.kind_of?(ActiveRecord::Relation)\n raise(\"unable to build resource_scope for #{effective_resource.klass || 'unknown klass'}.\")\n end\n\n relation\n )\n end"
] | [
"0.596501",
"0.5841833",
"0.58228415",
"0.5755029",
"0.57275736",
"0.5724049",
"0.5662729",
"0.56497705",
"0.5593336",
"0.55649126",
"0.55254984",
"0.55117667",
"0.5508281",
"0.55026305",
"0.5479653",
"0.54759616",
"0.54603493",
"0.5450446",
"0.54471195",
"0.5437607",
"0.5427483",
"0.5425139",
"0.53698546",
"0.533316",
"0.53263104",
"0.5325141",
"0.5319267",
"0.52880543",
"0.52432156",
"0.5227992",
"0.52216524",
"0.5210557",
"0.51959765",
"0.51890075",
"0.5186574",
"0.5178224",
"0.5171733",
"0.51653975",
"0.51622266",
"0.51622266",
"0.5153961",
"0.5150954",
"0.51364255",
"0.5116563",
"0.51095635",
"0.5104287",
"0.507896",
"0.50773674",
"0.50708926",
"0.50708926",
"0.50662017",
"0.5063837",
"0.5056077",
"0.5033023",
"0.50309575",
"0.50293344",
"0.50293344",
"0.5023676",
"0.50223446",
"0.5017127",
"0.5008197",
"0.49980888",
"0.49958304",
"0.49895948",
"0.49860328",
"0.4983748",
"0.4978682",
"0.49749795",
"0.49628276",
"0.49626708",
"0.49626708",
"0.49615806",
"0.49615806",
"0.49615806",
"0.49615806",
"0.49615806",
"0.49615806",
"0.49615806",
"0.49615806",
"0.49615806",
"0.49615806",
"0.49606106",
"0.49552995",
"0.4952926",
"0.49457312",
"0.49428335",
"0.4936485",
"0.49362278",
"0.49355865",
"0.49307418",
"0.49280795",
"0.4924907",
"0.4921662",
"0.49112493",
"0.49089512",
"0.49089438",
"0.48971778",
"0.48902726",
"0.48891383",
"0.48785493"
] | 0.5614945 | 8 |
Returns a path to the collection of Resource objects | def collection_path
@prefix + '/' + @resource.collection_path.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paths\n Array(@ruhoh.cascade.paths.map{|h| h[\"path\"]}).map { |path|\n collection_path = File.join(path, resource_name)\n next unless File.directory?(collection_path)\n\n collection_path\n }.compact\n end",
"def collections_path; end",
"def collection\n resource_class.all\n end",
"def resource_list\n self.resources\n end",
"def resources_path_names; end",
"def collection_path\n self.class.collection_path\n end",
"def path\n @path ||= polymorphic_path @resources\n end",
"def collection_url\n super_url(with_chain(resource_class))\n end",
"def path\n name = @resource.value(:name)\n if (attrs = self.class.all[name])\n attrs[:path]\n end\n end",
"def resources\n @resources\n end",
"def collection_path\n send route_prefix_to_method_name(\"#{class_name.model_name.route_key}_path\")\n end",
"def resources\n @resources ||= []\n end",
"def resources\n @resources.values\n end",
"def resources\n return @resources\n end",
"def resources\n return @resources\n end",
"def resources\n return @resources\n end",
"def resource_collection\n client.run_status.run_context.resource_collection\n end",
"def resource_path\n @resource_path ||= model_name.collection.sub(%r{^pdc\\/}, '').tr('_', '-')\n end",
"def collection_path\n self.class.collection_path\n end",
"def pathlist\n @path\n end",
"def method_for_association_chain #:nodoc:\n resource_collection_name\n end",
"def resources\n @data.keys\n end",
"def resources\n self.collection.find({}, :sort => [:_id, :asc]).map do |hash|\n self.normalize hash\n end\n end",
"def resource_collection\n @resource_collection ||= @run_context.resource_collection\n end",
"def resources\n typed_set(entities, Occi::Core::Resource)\n end",
"def ar_resources_path\n meth= \"#{controller.ardata.resources_method(@parent_resource, '')}_path\"\n @parent_resource ? send(meth, @parent_resource) : send(meth)\n end",
"def subresources\n if any?\n { collection_rel => self }\n else\n {}\n end\n end",
"def path\n name = @resource.value(:name)\n # rubocop:disable Style/GuardClause\n if (attrs = self.class.all[name])\n # rubocop:enable Style/GuardClause\n attrs[:path]\n end\n end",
"def to_a\n resources\n end",
"def enclosing_collection_resources\n @enclosing_collection_resources ||= []\n end",
"def collection_api_path(path=nil)\n @collection_api_path = path if path\n @collection_api_path || \"#{self.path}s\"\n end",
"def get_nested_resource_objects\n end",
"def resources()\n end",
"def list_resources\n resources = []\n addr = create_address(:sliceID => @@sliceID, :domain => @@domain)\n resource_prefix = \"#{addr.generate_address}/\"\n nodes = list_nodes(@@domain)\n nodes.each{|node|\n next if !node.include?(resource_prefix)\n node.slice!(resource_prefix)\n resources << node if !node.empty?\n }\n resources\n end",
"def path\n\t\t\t@path_elements.join(\"/\")\n\t\tend",
"def resources\n @resources ||= {}\n end",
"def resource_collection\n run_context && run_context.resource_collection\n end",
"def path\n @path || []\n end",
"def resources\n Loader.resources.keys\n end",
"def resource_path(*args)\n segments = []\n segments.append(shift_segment!(args)) until args.empty?\n segments.flatten.compact.join '/'\n end",
"def collection_path(path = nil)\n if path.nil?\n @collection_path ||= root_element.to_s.pluralize\n else\n @collection_path = path\n @element_path = \"#{path}/:id\"\n end\n end",
"def path\n [name]\n end",
"def resources\n instance_variable_get(\"@#{mapping.plural}\")\n end",
"def make_collection\n @resource.make_collection\n end",
"def resources\n @task[:resources]\n end",
"def resources_name\n self.class.resources_name\n end",
"def resources_path_names=(_arg0); end",
"def path(*args)\n return call_ancestry_method(:path) if use_ancestry?\n\n Relationship.resources(path_rels(*args)) # TODO: Prevent preload of self which is in the list\n end",
"def element_path(id)\n @prefix + '/' + @resource.collection_path.to_s + '/' + id.to_s\n end",
"def collection_uri\n super + uuid + '/'\n end",
"def get_collection_object_references\n # get ids of collection object links\n link_ids = CollectionobjectLink.where(\"resource_id = ?\", self.id).pluck(:id)\n resource_ids = MediaFile.where(\"sourceable_id IN (?)\", link_ids).pluck(:resource_id)\n\n #\n rel_resource_ids = RelatedResource.where(\"to_resource_id = ?\", self.id).pluck(:resource_id)\n\n all_resource_ids = rel_resource_ids + resource_ids\n\n begin\n Resource.find(all_resource_ids)\n rescue\n return []\n end\n end",
"def resources\n nodeset = query_root_node(\"gdacs:resources/gdacs:resource\", @@NAMESPACES)\n @items = []\n if !nodeset.nil?\n nodeset.each do |item|\n item_obj = SemanticCrawler::Gdacs::Resource.new(item)\n @items << item_obj\n end\n end\n @items\n end",
"def list\n puts local_resources.map { |name, resource| name }.join(\" \")\n end",
"def resources; end",
"def resources; end",
"def related_resources(resource)\n if resource.respond_to?(:related_resources_recursive)\n return resource.related_resources_recursive\n else\n return []\n end\n end",
"def linked_resources\n return @linked_resources\n end",
"def serialize_collection(collection)\n url_for(collection)\n end",
"def resources\n @resources ||= Marshal.load(Marshal.dump(@@resources))\n end",
"def collection_id\n super.map { |url| URI(url).path.sub('/', '') }\n end",
"def paths; end",
"def paths; end",
"def paths; end",
"def paths; end",
"def paths; end",
"def all\n setup_request \"#{@@resource_url}s\"\n end",
"def filepaths\n object.object_files.map(&:relative_path)\n end",
"def resources\n @resources ||= @response[@resource_field].to_a\n end",
"def collection_path(query_options = nil)\n self.element_name\n end",
"def parent_resources\n @parent_resources ||= []\n end",
"def resource_collection_name #:nodoc:\n self.resources_configuration[:self][:collection_name]\n end",
"def collection_path\n url_for(\n :controller => controller_path, \n :action => 'index',\n :only_path => true,\n :use_route => controller_path.tr('/', '_')\n )\n end",
"def paths\n @paths ||= []\n @paths\n end",
"def paths\n @paths ||= []\n @paths\n end",
"def base_collection\n @base_collection ||= resource_model.all\n end",
"def paths\n\t\tresponse = self.server.run_with_json_template( :paths )\n\t\treturn response.each_with_object({}) do |entry, hash|\n\t\t\thash[ entry[:name].to_sym ] = URI( entry[:url] )\n\t\tend\n\tend",
"def resource_type\n :collection if collection?\n end",
"def resource_type\n :collection if collection?\n end",
"def resources\n @resources ||= begin\n resources = request_path.strip.\n split('/').\n compact.\n map(&:strip).\n each_with_index.\n select { |_, index| index % 2 == 1 }.\n map { |a, _| a.to_sym }\n\n *rest, tail = *resources\n if RAILS_METHODS.index(tail)\n rest\n else\n resources\n end\n end\n end",
"def resources options={}\n @resources ||= find_resources options\n end",
"def resources\n instance_variable_get(\"@#{resources_name}\")\n end",
"def resources(*args)\n run_context.resource_collection.find(*args)\n end",
"def decorated_collection\n @collection.map do |element|\n Resource.new(element, @controller)\n end\n end",
"def children\n @resource.children\n end",
"def collection_path(prefix_options = {}, query_options = nil)\n prefix_options, query_options = split_options(prefix_options) if query_options.nil?\n @singleton ?\n \"#{prefix(prefix_options)}#{collection_name.singularize}#{query_string(query_options)}\" :\n \"#{prefix(prefix_options)}#{collection_name}#{query_string(query_options)}\"\n end",
"def path\n \"/{databaseId}/items/list/\"\n end",
"def paths\n root.paths\n end",
"def path_ids\n @objects.map{|e| e.path_id}\n end",
"def generate_resources_list\n resources = YARD::Registry.all(:resource).uniq.sort_by {|resource| resource.name.to_s}\n generate_full_list(resources, 'Resource', 'resources')\nend",
"def path(document)\n Mongoid::Atomic::Paths::Embedded::Many.new(document)\n end",
"def resource_scope\n resource_class.all\n end",
"def all_resources\n @run_context && @run_context.resource_collection.all_resources\n end",
"def collection_path(prefix_options = {}, query_options = nil)\r\n prefix_options, query_options = split_options(prefix_options) if query_options.nil?\r\n \"#{prefix(prefix_options)}#{collection_name}#{query_string(query_options)}\"\r\n end",
"def build_path(prop)\n path = []\n while prop\n path << prop if !path.last || (path.last.name != prop.name)\n prop = prop.__parent\n end\n [path.last.__resource.name] + path.map(&:name).reverse\n end",
"def get_resource_tree\n {\n method: \"Page.getResourceTree\"\n }\n end",
"def paths\n @attributes[:paths]\n end",
"def paths\n @attributes[:paths]\n end",
"def resource_path(*args)\n resource.path(*args)\n end",
"def resources\n body && [*body]\n end",
"def collection_url\n send route_prefix_to_method_name(\"#{class_name.model_name.route_key}_url\")\n end"
] | [
"0.73934555",
"0.727486",
"0.70928824",
"0.7016644",
"0.6987179",
"0.6910292",
"0.689361",
"0.6880156",
"0.6845663",
"0.6828263",
"0.6805364",
"0.6777731",
"0.67725796",
"0.67388463",
"0.67388463",
"0.67388463",
"0.6731893",
"0.6729437",
"0.67072886",
"0.6653743",
"0.6612539",
"0.66042227",
"0.6580253",
"0.65558124",
"0.64907545",
"0.6461291",
"0.64277637",
"0.63739985",
"0.63718593",
"0.63682693",
"0.6353166",
"0.6343344",
"0.633186",
"0.6329848",
"0.6313761",
"0.6312479",
"0.63061076",
"0.6300129",
"0.6297107",
"0.6293156",
"0.6289901",
"0.62728894",
"0.62618613",
"0.62412",
"0.62353796",
"0.6227309",
"0.61911964",
"0.61788815",
"0.61393493",
"0.6138587",
"0.61318916",
"0.61200625",
"0.60997415",
"0.6099529",
"0.6099529",
"0.6082136",
"0.6077315",
"0.60624206",
"0.605055",
"0.604853",
"0.6045562",
"0.6045562",
"0.6045562",
"0.6045562",
"0.6045562",
"0.6043577",
"0.6043426",
"0.6037575",
"0.60367817",
"0.6036138",
"0.6035559",
"0.60223097",
"0.5989307",
"0.5989307",
"0.59799194",
"0.5963144",
"0.59608525",
"0.59608525",
"0.5948219",
"0.59477794",
"0.59458333",
"0.5938653",
"0.59302133",
"0.59151053",
"0.59150136",
"0.5914007",
"0.5908548",
"0.5904155",
"0.5903647",
"0.589466",
"0.5884822",
"0.5883734",
"0.58757526",
"0.5866349",
"0.5860231",
"0.5850221",
"0.5850221",
"0.5846939",
"0.58424664",
"0.58421093"
] | 0.74083126 | 0 |
Returns a path to a single Resource | def element_path(id)
@prefix + '/' + @resource.collection_path.to_s + '/' + id.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path\n name = @resource.value(:name)\n if (attrs = self.class.all[name])\n attrs[:path]\n end\n end",
"def resource_path(*args)\n resource.path(*args)\n end",
"def path\n name = @resource.value(:name)\n # rubocop:disable Style/GuardClause\n if (attrs = self.class.all[name])\n # rubocop:enable Style/GuardClause\n attrs[:path]\n end\n end",
"def find_resource\n get params[:resource_path]\n end",
"def resource_path\n @resource_path ||= model_name.collection.sub(%r{^pdc\\/}, '').tr('_', '-')\n end",
"def resource_path\n '.' + Dir[File.dirname(__FILE__)][/\\/resource\\/.*/]\n end",
"def ar_resources_path\n meth= \"#{controller.ardata.resources_method(@parent_resource, '')}_path\"\n @parent_resource ? send(meth, @parent_resource) : send(meth)\n end",
"def resource_path\n @resource_path ||= resource.split('_').first.pluralize.tap do |path|\n raise Uatu::Error.new('InvalidMethod') unless Uatu::RESOURCES.map(&:pluralize).include?(path)\n end\n end",
"def path\n @path ||= polymorphic_path @resources\n end",
"def resource_path\n return super unless resource.is_a?(Decidim::Component)\n\n @resource_path ||= main_component_path(resource)\n end",
"def resource_path(*args)\n options = args.extract_options!\n super_path(with_chain(args.first || resource), options)\n end",
"def resource_api_path(path=nil)\n @resource_api_path = path if path\n @resource_api_path || \"1.0/#{self.path}\"\n end",
"def path(name)\n RubyAem::Resources::Path.new(@client, name)\n end",
"def resource_path(resource = self.resource, **options)\n controller_path(action: :show, id: resource, **options)\n end",
"def path\n CGI::unescape @resource\n end",
"def resource_name\n @resource_name ||= self.class.to_s.underscore.gsub(%r{.*/([^/]+)\\z}, '\\1')\n end",
"def path_string\n type == :simple_resource_id ? \"\\#{#{resource_names[0]}}\" : pattern.gsub(\"{\", \"\\#{\")\n end",
"def path(path = nil)\n if resource\n resource.path = path if path\n resource.path\n else\n @path = path if path\n @path || resource_name\n end\n end",
"def path_for(resource = nil)\n [\"/networks/#{id}\", resource].compact.join('/')\n end",
"def resource\n @resource\n end",
"def resource\n @resource\n end",
"def path\n @uri.path\n end",
"def get_resource_path\r\n res_path = File.dirname(__FILE__) + \"/../../res\"\r\n return File.expand_path(res_path)\r\n end",
"def resource_url options={}\n r=request.path\n id=params[:id]\n options = case params[:action]\n when 'create','update','delete','destroy'; \"\"\n else resource_options(options)\n end\n return \"%s%s\" % [r,options] if r.match \"#{resource.class.to_s.tableize}\\/#{id}$\"\n \"%s%s\" % [ r.split(\"/#{params[:action]}\")[0], options]\n rescue Exception => e\n scoop_from_error e\n end",
"def resource\n self.class.resource\n end",
"def ar_resource_path action, resource= @resource\n # resource_method is a helper of auto_rest that determines the url helper method\n # name based on the presence of the parent.\n meth= \"#{controller.ardata.resource_method(@parent_resource, action)}_path\"\n \n case \n when @parent_resource && resource\n send meth, @parent_resource, resource\n when resource\n send meth, resource\n when @parent_resource\n send meth, @parent_resource\n else\n send meth\n end\n end",
"def resource path\n File.expand_path \"resources/#{path}\", __dir__\n end",
"def resource\n\t\tself.split('__')[0]\n\tend",
"def get_resource\n execute(resource_path, method: :get)\n end",
"def resource(path)\n Resource.new(self, path)\n end",
"def resource\n klass, param = resource_class\n klass&.find(params[param.to_sym])\n end",
"def path\n @path\n end",
"def path\n @path\n end",
"def path\n @path\n end",
"def path\n @path\n end",
"def detail_url(resource_id)\n \"#{@path}#{resource_id}/\"\n end",
"def path\n return get_path self\n end",
"def resource_id\n send self.class.resource_id\n end",
"def resource\n @resource\n end",
"def read_resource(resource)\n resource\n end",
"def read_resource(resource)\n resource\n end",
"def resource_uri\r\n\t\tpath = random_uri\r\n\t\tpath << random_uri\r\n\t\treturn path\r\n\tend",
"def ar_resource_url resource= @resource\n meth= \"#{ardata.resource_method(@parent_resource, '')}_url\"\n \n if @parent_resource\n send meth, @parent_resource, resource\n else\n send meth, resource\n end\n end",
"def resource_path(resource)\n \"#{test_dir}/#{resource}\"\n end",
"def bare_resource(resource)\n inner_name = \"bare_#{resource.name}\"\n inner_path = bare_d.join(\"#{resource.name}.conf\").to_s\n return inner_name, inner_path\n end",
"def resource_uri\n \"#{resource_name}/#{uid}\"\n end",
"def uri_path\n __getobj__.uri.path\n end",
"def path\n Rails.application.routes.url_helpers.send(self.class.to_s.underscore.concat('_path'), id)\n end",
"def path\n @path\n end",
"def path\n @path\n end",
"def path\n @path\n end",
"def path\n @path\n end",
"def path\n return @path\n end",
"def path\n return @path\n end",
"def path\n return @path\n end",
"def path\n return @path\n end",
"def resource\n self.class.to_s.split('::').last.downcase\n end",
"def resource(title)\n @catalog.resource(title) || @aliases[title]\n end",
"def resource_path(*args)\n segments = []\n segments.append(shift_segment!(args)) until args.empty?\n segments.flatten.compact.join '/'\n end",
"def path\n prefix.push(identifier, region.to_s, size.to_s, rotation.to_s, resource)\n .join('/').prepend '/'\n end",
"def get_resource_to_use\n return @resources.first\n end",
"def uri_path_for(resource:, version: :v1)\n res = resource.to_s\n\n ext = File.extname res\n if !ext.nil? and !ext.empty? and ext != \".json\"\n fail BayPhoto::Exceptions::BadRequestURIExtension, \"Tried to fetch a #{ext} URI, but only JSON is supported\"\n end\n\n res << \".json\" if res !~ /\\.json\\Z/\n\n URI.join(API_ENDPOINTS[version], res).request_uri\n end",
"def resource_path(*components)\n components.collect { |c| URI.escape c }.join('/')\n end",
"def path\n ensure_valid\n @path\n end",
"def resource\n return @resource\n end",
"def resource\n return @resource\n end",
"def resource\n return @resource\n end",
"def resource\n return @resource\n end",
"def resource\n return @resource\n end",
"def resource\n return @resource\n end",
"def path\n @path\n end",
"def path\n @path\n end",
"def resource_path(path)\n path = Pathname.new(path).expand_path.relative_path_from(Pathname.pwd).to_s\n path = path.sub('.rb', '')\n path = path.split('/')\n from_block_dir_path = false\n path.shift if path.first == 'app'\n path.shift if path.first == 'lib'\n if path.first == 'blocks'\n path.shift\n from_block_dir_path = true\n end\n path.shift if path.first == underscored_app_namespace\n if path.include?('derivatives')\n path.delete('derivatives')\n from_block_dir_path = true\n end\n if from_block_dir_path\n path.delete('sub_blocks')\n path.pop if path.last == 'model'\n if path.last == 'controller'\n path.pop\n path << \"#{path.pop}_controller\"\n end\n end\n path.join('/')\n end",
"def identifier\n rdf_resource\n end",
"def resource_name\n resource_class.resource_name\n end",
"def resource\n resource_model.find(params[:id])\n end",
"def path\n path_for({})\n end",
"def resource(path)\n File.expand_path(File.join(staging_resources_path, path))\n end",
"def get_path\n BINARY_PATH + \"/\" + sprintf(\"%08x\", self.id )\n end",
"def relative_path\n name\n end",
"def path\n [name]\n end",
"def path\n Pathname(super)\n end",
"def resource\n instance_variable_get(\"@#{resource_name}\")\n end",
"def full_path\n path\n end",
"def getPath()\n return @uri.path\n end",
"def path\n end",
"def resource_base_uri\n @resource ||= \"#{Hyperloop::Resource::ClientDrivers.opts[:resource_api_base_path]}/#{self.to_s.underscore.pluralize}\"\n end",
"def resource identifier\n Resource.new(Conjur::Authz::API.host, credentials)[self.class.parse_resource_id(identifier).join('/')]\n end",
"def path\n File.join class_variable_get(:@@base_path), id.to_s\n end",
"def resource_link\n return @resource_link\n end",
"def path\n @type.pathto @id\n end",
"def requested_resource(request_path)\n parts = request_path.split('/')\n raw_resource(parts)\n end",
"def full_url_helper(resource)\n \"#{root_url}fhir/r4/#{resource.class.name.split('::').last}/#{resource.id}\"\n end",
"def to_s\n path\n end",
"def resource_id\n return \"%s:%s\" % [self.resource_type, self.id]\n end",
"def resource(namespaces, id)\n # resource can only exist for an API version\n link = api_root\n # combine namespace and entity ID\n link << namespace(namespaces)\n link << \"/#{id}\" unless id.nil? || id.empty?\n # return the created link\n link\n end",
"def path\n\t\t@path\n\tend",
"def to_s\n path\n end",
"def resource\n @resource ||= resource_set.createResource(uri)\n end",
"def resource_name\n return @resource_name\n end",
"def resource_name\n return @resource_name\n end"
] | [
"0.78549296",
"0.7841048",
"0.770448",
"0.7329078",
"0.7217448",
"0.71895903",
"0.71292",
"0.7100359",
"0.7076423",
"0.7061897",
"0.70526206",
"0.7022241",
"0.69986403",
"0.695419",
"0.6952841",
"0.69357574",
"0.6925645",
"0.6804489",
"0.67951906",
"0.67750204",
"0.67750204",
"0.67381805",
"0.672329",
"0.67117643",
"0.6697001",
"0.6675882",
"0.6665284",
"0.66280776",
"0.6614647",
"0.6611297",
"0.6608227",
"0.6600585",
"0.6600585",
"0.6600585",
"0.6600585",
"0.6583272",
"0.6580343",
"0.6576612",
"0.65671706",
"0.65585333",
"0.65585333",
"0.65571487",
"0.6557127",
"0.6549889",
"0.6535501",
"0.6534235",
"0.65341944",
"0.6530476",
"0.6528679",
"0.6528679",
"0.6528679",
"0.6528679",
"0.65200883",
"0.650451",
"0.650451",
"0.650451",
"0.6499273",
"0.64942044",
"0.64918387",
"0.6486206",
"0.64834934",
"0.6476432",
"0.64732635",
"0.64644897",
"0.64535314",
"0.64535314",
"0.64535314",
"0.64535314",
"0.64535314",
"0.64535314",
"0.6447266",
"0.6447266",
"0.64396775",
"0.64318323",
"0.64283746",
"0.64186263",
"0.641669",
"0.6395527",
"0.6355956",
"0.6352141",
"0.6349849",
"0.6334336",
"0.632987",
"0.63275087",
"0.6317967",
"0.6317011",
"0.63165104",
"0.6310852",
"0.63028014",
"0.63019586",
"0.6295618",
"0.62954557",
"0.6272314",
"0.6269972",
"0.62619823",
"0.62543327",
"0.62480795",
"0.62453765",
"0.62448317",
"0.6243663",
"0.6243663"
] | 0.0 | -1 |
Returns a single Resource object, based on its _id_ ==== Arguments _id_ id of Resource | def find(id)
code, data = @session.get(element_path(id) + '.json')
if code == 200
key = @resource.name.to_s.split('::').last.downcase
@resource.new(data[key].merge(:session =>@session))
elsif code == 404
raise ResourceNotFound
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_one(id)\n response = request(:get, \"/#{resource_name}/#{id}\")\n #puts response\n construct_record_from_singular(response)\n end",
"def find(id)\n resource_hash = PrestaShop.get :resource => self.resource,\n :id => id\n\n resource_hash.nil? ? nil : self.new(resource_hash)\n end",
"def get_resource(id)\n raise 'To be implemented in child classes'\n end",
"def find_resource(id)\n query_service.find_by(id: Valkyrie::ID.new(id.to_s))\n end",
"def find_one(id, query = nil)\n response = request(:get, \"/#{resource_name}/#{id}\", query)\n construct_record_from_singular(response)\n end",
"def resource_by_id(resource_id)\n @resources.each do |r|\n return r if r.resource_id == resource_id\n end\n nil\n end",
"def read(id)\n perform(:get, \"#{@resource_type}/#{id}\")\n end",
"def resource(id)\n CODES.select{|hash| hash.has_key?(id.to_s)}[0]\n end",
"def find_resource(resource_id)\n query_service.find_by(id: Valkyrie::ID.new(resource_id))\n end",
"def find(id)\n return nil if id.blank?\n path = build_association_path -> { \"#{@parent.request_path(@params)}#{@opts[:path]}/#{id}\" }\n @klass.get_resource(path, @params)\n end",
"def find_by_id(client, id, params = {})\n params = default_params.merge(params)\n\n client.get(\"#{resource_name}/#{id}\", params).data[resource_name_singular]\n end",
"def get(resource, id)\n Api.new.get(resource, id)\n end",
"def get(id)\n klass.find(:first, params: { klass.primary_key => wrap_key(id) })\n end",
"def fetch(id)\n build_resource(raw.fetch(id))\n end",
"def getObject(id)\n\t\tdoc.search(\"[@id='#{id}']\").first\n\tend",
"def find_by_id(id)\n find(id)\n end",
"def get_resource_by_id(authorization, \n id)\n\n # prepare query url\n _query_builder = Configuration.get_base_uri()\n _query_builder << '/resources/{id}'\n _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {\n 'id' => id\n }\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'accept' => 'application/json',\n 'Authorization' => Configuration.authorization,\n 'Authorization' => authorization\n }\n\n # prepare and execute HttpRequest\n _request = @http_client.get _query_url, headers: _headers\n CustomAuth.apply(_request)\n _context = execute_request(_request)\n\n # validate response against endpoint and global error codes\n if _context.response.status_code == 400\n raise EntitiesErrorErrorException.new 'Bad Request', _context\n elsif _context.response.status_code == 401\n raise EntitiesErrorErrorException.new 'Unauthorized/Missing Token', _context\n elsif _context.response.status_code == 403\n raise EntitiesErrorErrorException.new 'Forbidden', _context\n elsif _context.response.status_code == 404\n raise EntitiesErrorErrorException.new 'Not Found', _context\n elsif !_context.response.status_code.between?(200, 208)\n raise APIException.new 'Unexpected error', _context\n end\n validate_response(_context)\n\n # return appropriate response type\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\n return GetResourceByIdResponse.from_hash(decoded)\n end",
"def find(id)\n found_id = redis.get \"#{klass}:id:#{id}\"\n\n if found_id\n object = self.new\n object.send(:id=, found_id.to_i)\n object\n end\n end",
"def get(id)\n Basuco::Resource.get(id)\n end",
"def find_by_id(id)\n find_by_attributes(:id => id).first\n end",
"def get_object_for_id(id, redis_pool = nil)\n redis_connection(redis_pool) do |conn|\n decode_object_from_redis(conn.get(key(id)))\n end\n end",
"def object_by_id(id)\n @lock.synchronize do\n object_by_id_internal(id)\n end\n end",
"def find(id)\n where({'id' => \"#{id}\"}).first\n end",
"def find_resource\n @resource = resource_class.find(params[:id])\n end",
"def get_resource(id, type)\n\t\[email protected](type).call.get(id)\n\tend",
"def find(id)\n fail(ArgumentError, \"Missing id/slug\") unless id\n\n result = access_token.get(\"#{API_BASE}#{self.class::API_PATH}#{id}\")\n fail(ArgumentError, \"Bad request\") unless result.code == \"200\"\n\n self.class::ITEM_CLASS.new(result.body)\n end",
"def find(id)\n response = client.get(endpoint(id))\n\n if response.success?\n new(response.body)\n else\n false\n end\n end",
"def find(id)\n end",
"def get(id:)\n response = client.get(path(id)).parsed_body\n new(response)\n end",
"def resource\n resource_model.find(params[:id])\n end",
"def find(id)\n @objects[id]\n end",
"def get( id )\n resource = begin # this is just in case the developer has already escaped the name\n CouchDB.get( \"#{database.uri}/#{CGI.escape(id)}\" )\n rescue\n CouchDB.get( \"#{database.uri}/#{id}\" ) \n end\n new( resource ) \n end",
"def find_single(id, *args)\n data = get(id.to_s, *args)\n return nil unless data && !data.empty?\n instantiate(id, data)\n end",
"def get_object_by_id(class_name, id)\n obj = nil\n get_objects_of_class(class_name).each do |o|\n if o.id == id\n obj = o\n break\n end\n end\n obj\n end",
"def find(id); end",
"def find(id); end",
"def find(id)\r\n find_one do |record|\r\n record.id == id\r\n end\r\n end",
"def find(id)\n @api.get(\"api/#{id.to_s}.json\")\n end",
"def find(id)\n klass.find(id)\n end",
"def find_by_id(id)\n resp = get(\"/#{exposed_as}/#{id}\")\n case resp.response.code.to_i\n when 200\n result = MultiJson.load resp.parsed_response\n new(result)\n when 404\n nil\n else\n raise \"#{self.class.name}#try_find with ID #{id.inspect} returned unexpected response: #{resp.inspect}\"\n end\n end",
"def get_resource resource_uuid\n return resource_uuid if resource_uuid.is_a?(Resource)\n \n tmp = @resources.find{|res|res.uuid == resource_uuid}\n \n raise \"unknown resource with uuid #{resource_uuid}\" unless tmp\n \n tmp\n end",
"def find(id)\n response = RestClient.get(\"#{@type.Resource}/#{id}\")\n @type.from_json response['data']\n end",
"def scaffold_get_object(id)\n self.get(id) || (raise scaffold_error_raised)\n end",
"def find(id, params = {}, header = {})\n request = requester.new(:get, \"#{to_url}/#{id}\", {}, params, header)\n build(request.resource)\n end",
"def find id\n model.find id\n end",
"def find_by_id!(id)\n new(one.find_by_id(id) || raise(RecordNotFound, \"A #{name} record for #{id} does not exist.\"))\n end",
"def find(id)\n # Used where so no exception will be raised if the instance\n # does not exist.\n @model.unscoped.where(@model_data['mappings']['id'].to_sym => id).first\n end",
"def find(id)\n repository.find(self, id)\n end",
"def find_by_id(id, options = {})\n if item = Dynamoid::Adapter.read(self.table_name, id, options)\n obj = self.new(item)\n obj.new_record = false\n return obj\n else\n return nil\n end\n end",
"def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end",
"def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end",
"def find(id)\n new.from_json(db_root.join(id).read)\n end",
"def get id\n doc = database.get id\n new(doc)\n end",
"def retrieve(id)\n instance = self.new(id)\n url = instance.url\n requestor = Requestor.new\n response = requestor.request(:get, url)\n instance.load_from(response)\n instance\n end",
"def get(id)\n return nil if id.nil?\n\n return objects[id] if objects.has_key?(id)\n\n type, content = get_object(id)\n\n klass = TYPE_CLASS[type] or raise NotImplementedError, \"type not supported: #{type}\"\n\n objects[id] = klass.new(self, id, content)\n end",
"def find_resource\n set_resource_ivar class_name.find(params[:id])\n end",
"def get(id)\n collection.find_one({\n Crocoduck::Store.id_field => id.to_i\n })\n end",
"def find_by_id(id, options={})\n name = self.class.name.demodulize.downcase\n route = Automatic::Client.routes.route_for(name)\n url = route.url_for(id: id)\n\n request = api_client.get(url, options)\n\n if request.success?\n self.class::INDIVIDUAL_MODEL.new(request.body)\n else\n nil\n end\n end",
"def read(resource_type, id)\n unless RESOURCES.include?(resource_type)\n raise Common::Exceptions::InvalidFieldValue.new('resource_type', resource_type)\n end\n\n perform(:get, \"#{resource_type}/#{id}\", nil)\n end",
"def find(id)\n all.find { |obj| obj.id == id }\n end",
"def find(id)\n data = client.get(asset_type, id: id )\n self.new_from_payload(data)\n end",
"def retrieve(id)\n raise NotFound.new(\"id '#{id}'\") unless ids.include?(id)\n\n storage[id]\n end",
"def find(id, query_options = {})\n raise 'ID is required' unless id\n\n response = request(:get, credentials, \"#{api_model.api_path}/#{id}\", query: query_options)\n api_model.parse(response.parsed_response).first\n end",
"def get_object_from_db_id(db_object_id)\n get_object_from_db_object(@db_class.find(db_object_id))\n end",
"def find(id)\n first(\"Id = '#{id}'\")\n end",
"def find(id)\n fetch([name, id]) do\n super\n end\n end",
"def get(id)\n @service.get(id)\n end",
"def get!(id, db = database)\n raise CouchRest::Model::DocumentNotFound if id.blank?\n\n doc = db.get id\n build_from_database(doc)\n rescue RestClient::ResourceNotFound\n raise CouchRest::Model::DocumentNotFound\n end",
"def fetch(id)\n fetch_by_id(id) or raise(ActiveRecord::RecordNotFound, \"Couldn't find #{self.class.name} with ID=#{id}\")\n end",
"def find_by_friendly_id(id)\n first_by_friendly_id(id) or raise_not_found_exception(id)\n end",
"def find_by_id(id)\n find_by(:id, id)\n end",
"def fetch(id)\n search(id: id)[:records].first\n end",
"def find(id)\n return nil if id.blank?\n path = build_association_path lambda { \"#{@owner.request_path(@params)}#{@opts[:path]}/#{id}\" }\n @klass.get(path, @params)\n end",
"def find_by_id(id)\n find_by_id!(id)\n rescue TopdeskAPI::Error::RecordNotFound\n nil\n end",
"def find_by_id(client, id, options: {})\n\n self.new(parse(client.get(\"/stories/#{id}\", options: options)).first, client: client)\n end",
"def find(id)\n find_by_id(id).tap { |result|\n if result.nil?\n raise RecordNotFound, \"#{self.class.name}#find with ID #{id.inspect} was not found\"\n end\n }\n end",
"def get!(id)\n klass.find(:all, params: { id: wrap_key(id) })\n end",
"def retrieve_resource(kind, id)\n resource = case kind\n when \"vdc\" then OZones::Vdc.get(id)\n when \"zone\" then OZones::Zones.get(id)\n else\n return OZones::Error.new(\n \"Error: #{kind} resource not supported\")\n end\n\n if resource\n return resource\n else\n return OZones::Error.new(\n \"Error: Resource #{kind} with id #{id} not found\")\n end\n end",
"def find_by_id(id)\n results = one.find_by_id_ne(id)\n results && !results['id'].blank? && new(results) || nil\n end",
"def fetch_by_id(id)\n ensure_base_model\n raise_if_scoped\n return unless id\n raise NotImplementedError, \"fetching needs the primary index enabled\" unless primary_cache_index_enabled\n if IdentityCache.should_use_cache?\n\n require_if_necessary do\n object = nil\n coder = IdentityCache.fetch(rails_cache_key(id)){ coder_from_record(object = resolve_cache_miss(id)) }\n object ||= record_from_coder(coder)\n IdentityCache.logger.error \"[IDC id mismatch] fetch_by_id_requested=#{id} fetch_by_id_got=#{object.id} for #{object.inspect[(0..100)]} \" if object && object.id != id.to_i\n object\n end\n\n else\n self.reorder(nil).where(primary_key => id).first\n end\n end",
"def lookup(id)\n\t\t@objects[id]\n\tend",
"def find(id)\n params = {\n 'sys.id': id\n }\n entry = fetch(params).first\n raise Exceptions::RecordNotFound if entry.blank?\n\n to_recipe(entry)\n end",
"def method_missing(id, *args, &block)\n # Figure out what kind of resource we're trying to get.\n klass = Scrumy::Models.const_get(id.to_s.capitalize.singularize)\n # Special case for handling id=:current - this really only applies to Sprint resources\n # but if other resources specified the `current` sub-resources then it should still work.\n if klass.current_url and args.first==:current\n @url = format(klass.current_url, :current)\n else\n # TODO\n # Figure out a better way of determining if the resource is singular or plural\n \n # The only argument that resources ever take is an ID, so pass the first arg as the ID.\n @url = format((id.to_s =~ /s$/ ? klass.list_url : klass.show_url), args.first)\n end\n\n # Here we request the resource using the singular of the resource name as the root\n # to extract from the returned JSON hash.\n response = get(@url, id.to_s.singularize)\n \n # Responses are of two types, either arrays of hashes or a single hash\n if response.kind_of? Array\n # If it's array collect a new array by constructing objects based on the resource\n # name capitalized and singularized.\n response.collect do |obj| \n klass.new(obj, self)\n end\n else\n # Otherwise create a single new object of the correct type.\n klass.new(response, self)\n end\n end",
"def resource\n klass, param = resource_class\n klass&.find(params[param.to_sym])\n end",
"def find_obj\n @obj = eval(resource_name).find_by(id: params[:id])\n end",
"def find(id)\n find_by_index(id: id)\n end",
"def find(id, params = {})\n from_base id, params\n end",
"def find(id, optional = {})\n find_all([id], optional).first\n end",
"def find(id)\n table_name = self.to_s.pluralize.underscore\n \n result = CONNECTION.execute(\"SELECT * FROM '#{table_name}' WHERE id = ?;\", id).first\n \n self.new(result)\n end",
"def read(id)\n begin\n find(id).read\n rescue\n nil\n end\n end",
"def [](resource_id, options = {})\n response = client.get(\"#{base_uri}/#{resource_id}\", options)\n if response.success?\n object_class.new(response.body, client)\n else\n raise Kippt::APIError.new(\"Resource could not be loaded: #{response.body[\"message\"]}\")\n end\n end",
"def fetch(id)\n fetch_by_id(id) or raise(ActiveRecord::RecordNotFound, \"Couldn't find #{self.name} with ID=#{id}\")\n end",
"def find_by_id(id)\n results = one.find_by_id_ne(id)\n results && new(results) || nil\n end",
"def find_record\n self.class.resource_model.find(params[:id])\n end",
"def retrieve\n self.class.get( id )\n end",
"def get_by_id(id)\n if @data == nil\n url = make_url(:fq => \"id:#{id}\")\n\n begin\n @data = Net::HTTP.get(URI.parse(url))\n rescue Exception => e\n @error = \"Unable to connect to #{url}\"\n end\n end\n \n return @data\n end",
"def get_by_db4o_id(id)\n obj = database.get_by_id(id.to_i)\n # NOTE: Activate depth should be configurable\n database.connection.activate(obj, 5)\n obj.load_attributes!\n end",
"def find(id, options = {})\n response = fetch({:key => id})\n response.parsed_response['id'] = id\n new(response.parsed_response)\n end",
"def get(id)\n Ribs.with_handle(self.database) do |h|\n h.get(self.metadata.persistent_class.entity_name, id)\n end\n end",
"def get_details(resource, id, **params)\n ops_hash = {\n id: id\n }\n ops_hash.merge! params\n resp = _make_request(resource, ops_hash)\n ComicVine::Resource.create_resource(resp['results'])\n end"
] | [
"0.8232799",
"0.8091343",
"0.78325975",
"0.772683",
"0.763369",
"0.7620556",
"0.760358",
"0.74612874",
"0.7311808",
"0.7298465",
"0.72212017",
"0.7176473",
"0.7161151",
"0.71201265",
"0.71052885",
"0.7062926",
"0.7056969",
"0.7056342",
"0.70525306",
"0.70272386",
"0.70071274",
"0.69925076",
"0.69879293",
"0.6942234",
"0.6910319",
"0.6909283",
"0.6896811",
"0.688248",
"0.68392634",
"0.6829615",
"0.6789305",
"0.67846626",
"0.67730546",
"0.6760086",
"0.67558974",
"0.67558974",
"0.6753612",
"0.6747808",
"0.6737356",
"0.6736071",
"0.6708434",
"0.67006123",
"0.6700468",
"0.6692523",
"0.66902524",
"0.66869545",
"0.66801953",
"0.6678493",
"0.66552573",
"0.6647927",
"0.6647927",
"0.66430444",
"0.6614374",
"0.6606512",
"0.660381",
"0.6601325",
"0.6584244",
"0.65747267",
"0.6573971",
"0.65639764",
"0.65628797",
"0.65580213",
"0.6546784",
"0.6543603",
"0.6529317",
"0.6518437",
"0.6514843",
"0.6507977",
"0.65061224",
"0.6502255",
"0.65000093",
"0.64993596",
"0.6465868",
"0.6465518",
"0.64536095",
"0.64315826",
"0.6426563",
"0.6424105",
"0.6413695",
"0.64035976",
"0.6402906",
"0.6395989",
"0.63954145",
"0.639211",
"0.63754374",
"0.637362",
"0.63719994",
"0.6370363",
"0.6362685",
"0.6361944",
"0.6360878",
"0.6355493",
"0.6354489",
"0.6354197",
"0.6339236",
"0.63339907",
"0.63234794",
"0.6318675",
"0.6316123",
"0.6308844"
] | 0.7596603 | 7 |
Returns an Array of Resource objects | def all(params = {})
query = params.map { |key, value| "#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}" }.join("&")
query = "?" + query unless query.empty?
code, data = @session.get(collection_path + '.json' + query)
data.collect { |data|
key = @resource.name.to_s.split('::').last.downcase
@resource.new(data[key].merge(:session => @session, :prefix => @prefix))
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resources\n @resources ||= @response[@resource_field].to_a\n end",
"def resources\n @resources ||= []\n end",
"def resources\n return @resources\n end",
"def resources\n return @resources\n end",
"def resources\n return @resources\n end",
"def resources\n @resources.values\n end",
"def resource_list\n self.resources\n end",
"def to_a\n resources\n end",
"def resources\n @resources\n end",
"def getMembersAsArray() \n ret = []\n it = self.getIterator() \n while(it.hasMoreResources())\n ret << it.nextResource().getContentAsREXML()\n end\n \n return ret\n end",
"def index\n @resources = resource_class.send(:all)\n render json: @resources\n end",
"def get_nested_resource_objects\n end",
"def list_resources\n resources = []\n addr = create_address(:sliceID => @@sliceID, :domain => @@domain)\n resource_prefix = \"#{addr.generate_address}/\"\n nodes = list_nodes(@@domain)\n nodes.each{|node|\n next if !node.include?(resource_prefix)\n node.slice!(resource_prefix)\n resources << node if !node.empty?\n }\n resources\n end",
"def resources\n typed_set(entities, Occi::Core::Resource)\n end",
"def resources\n nodeset = query_root_node(\"gdacs:resources/gdacs:resource\", @@NAMESPACES)\n @items = []\n if !nodeset.nil?\n nodeset.each do |item|\n item_obj = SemanticCrawler::Gdacs::Resource.new(item)\n @items << item_obj\n end\n end\n @items\n end",
"def resources\n body && [*body]\n end",
"def list(abs_url = nil)\n @ro_resource_mixin.list(abs_url)\n end",
"def resources\n @resources = {\n :lumber => Lumber.new,\n :clay => Clay.new,\n :iron => Iron.new,\n :crop => Crop.new\n } if @resources.nil?\n return @resources\n end",
"def resources\n @resources ||= process_data(decoded_body[resources_key])\n end",
"def resources\n @resources ||= Marshal.load(Marshal.dump(@@resources))\n end",
"def all\n PaginatedResource.new(self)\n end",
"def all\n PaginatedResource.new(self)\n end",
"def all\n PaginatedResource.new(self)\n end",
"def all\n PaginatedResource.new(self)\n end",
"def all\n PaginatedResource.new(self)\n end",
"def all\n PaginatedResource.new(self)\n end",
"def all\n PaginatedResource.new(self)\n end",
"def all\n PaginatedResource.new(self)\n end",
"def all\n PaginatedResource.new(self)\n end",
"def all\n PaginatedResource.new(self)\n end",
"def collection\n resource_class.all\n end",
"def resources\n @resources ||= Resources.new\n if block_given?\n yield(@resources)\n end\n @resources\n end",
"def resources\n @resources ||= {}\n end",
"def index\n @resources = Resource.all\n end",
"def index\n @resources = Resource.all\n end",
"def index\n @resources = Resource.all\n end",
"def index\n @resources = Resource.all\n end",
"def generate_resources_list\n resources = YARD::Registry.all(:resource).uniq.sort_by {|resource| resource.name.to_s}\n generate_full_list(resources, 'Resource', 'resources')\nend",
"def instances\n instances = []\n JSON.parse(resource['/instances'].get)[\"instances\"].each do |i|\n instances << Instance.new(i)\n end\n return instances\n end",
"def resources\n self.collection.find({}, :sort => [:_id, :asc]).map do |hash|\n self.normalize hash\n end\n end",
"def resources\n @resources ||=\n query_service.custom_queries.find_by_property(property: :source_metadata_identifier, value: [], lazy: true).select do |resource|\n id = resource.source_metadata_identifier.first\n next if /99.*3506421/.match?(id)\n next if transform_id(id).length > 18\n RemoteRecord.catalog?(id)\n end.to_a\n end",
"def get_resources(url, resource_class, params={})\n get(url, params).map do |result|\n resource_class.from_hash(result, client: self)\n end\n end",
"def resources\n @data.keys\n end",
"def index\n @api_v1_resources = Api::V1::Resource.all\n end",
"def resource_all(stack)\n result = request(\n :method => :get,\n :path => \"/stacks/#{stack.name}/#{stack.id}/resources\",\n :expects => 200\n )\n result.fetch(:body, :resources, []).map do |resource|\n Stack::Resource.new(\n stack,\n :id => resource[:physical_resource_id],\n :name => resource[:resource_name],\n :type => resource[:resource_type],\n :logical_id => resource[:logical_resource_id],\n :state => resource[:resource_status].downcase.to_sym,\n :status => resource[:resource_status],\n :status_reason => resource[:resource_status_reason],\n :updated => Time.parse(resource[:updated_time])\n ).valid_state\n end\n end",
"def resource_all(stack)\n request(\n :path => \"global/deployments/#{stack.name}/resources\"\n ).fetch('body', 'resources', []).map do |resource|\n Stack::Resource.new(stack,\n :id => resource[:id],\n :type => resource[:type],\n :name => resource[:name],\n :logical_id => resource[:name],\n :created => Time.parse(resource[:insertTime]),\n :updated => resource[:updateTime] ? Time.parse(resource[:updateTime]) : nil,\n :state => :create_complete,\n :status => 'OK',\n :status_reason => resource.fetch(:warnings, []).map{|w| w[:message]}.join(' ')\n ).valid_state\n end\n end",
"def resources\n instance_variable_get(\"@#{resources_name}\")\n end",
"def array\n self.allObjects\n end",
"def index\n @resources = Resource.eager_load(:resource_type).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resources }\n end\n end",
"def get_all(klass = nil, search_params = {})\n replies = get_all_bundles(klass, search_params)\n return nil unless replies\n resources = []\n\t\treplies.each do |reply|\n resources.push(reply.entry.collect{ |singleEntry| singleEntry.resource })\n end\n resources.compact!\n resources.flatten(1)\n\tend",
"def all(params = {})\n response = http_get(resource_url, params)\n format_object(response, TYPE)\n end",
"def decorated_collection\n @collection.map do |element|\n Resource.new(element, @controller)\n end\n end",
"def resources\n @resources ||= @internal_struct[:resources] || {}\n end",
"def resources\n Loader.resources.keys\n end",
"def elements\n begin\n if %w(tags posts).include?(@resource.to_s)\n return parsed_response[@resource.to_s][singular_r_name] || []\n elsif %w(bundles).include?(@resource.to_s)\n return parsed_response[@resource.to_s].empty? ? [] : parsed_response[@resource.to_s].map {|el| el[singular_r_name] } \n end\n rescue NoMethodError => e \n return parsed_response\n end\n end",
"def index\n @resources = Resource.all\n converted_resources = @resources.map do |r|\n {\n id: r.id,\n name: r.name,\n timeLimit: r.time_limit,\n visible: r.visible,\n vaccine: r.vaccine,\n questions: r.questions\n }\n end\n render json: converted_resources, status: :ok\n end",
"def get_all_resources(klasses = nil)\n replies = get_all_replies(klasses)\n return nil unless replies\n resources = []\n replies.each do |reply|\n resources.push(reply.resource.entry.collect{ |singleEntry| singleEntry.resource })\n end\n resources.compact!\n resources.flatten(1)\n end",
"def resource_all(stack)\n all_result_pages(nil, :body,\n \"ListStackResourcesResponse\", \"ListStackResourcesResult\",\n \"StackResourceSummaries\", \"member\") do |options|\n request(\n :method => :post,\n :path => \"/\",\n :form => options.merge(\n Smash.new(\n \"Action\" => \"ListStackResources\",\n \"StackName\" => stack.id,\n )\n ),\n )\n end.map do |res|\n Stack::Resource.new(\n stack,\n :id => res[\"PhysicalResourceId\"],\n :name => res[\"LogicalResourceId\"],\n :logical_id => res[\"LogicalResourceId\"],\n :type => res[\"ResourceType\"],\n :state => res[\"ResourceStatus\"].downcase.to_sym,\n :status => res[\"ResourceStatus\"],\n :updated => res[\"LastUpdatedTimestamp\"],\n ).valid_state\n end\n end",
"def [](*args)\n resources[*args]\n end",
"def initialize\n @resource_parts = Array.new\n end",
"def get_resources\n init_folder unless @init # have I been initialized?\n return @resources \n end",
"def resources\n instance_variable_get(\"@#{mapping.plural}\")\n end",
"def resource_names\n JSON.parse(@body).fetch('Resources', {}).keys\n end",
"def api_get_resources(url, page, resource_type, o = {})\n json = api_get_json(url, page, o)\n json.is_a?(Hash) ? resource_type.new(json) : json.map { |r| resource_type.new(r) }\n end",
"def update \n items = changed_since(last_run)\n resources = []\n items.each do |item|\n resource = construct_resource(item)\n resource.populate\n resources << resource\n end\n return resources\n end",
"def resources\n collection = Miasma::Models::Orchestration::Stack::Resources.new(self)\n collection.define_singleton_method(:perform_population) do\n valid = stack.sparkleish_template.fetch(:resources, {}).keys\n stack.custom[:resources].find_all { |r| valid.include?(r[:name]) }.map do |attrs|\n Miasma::Models::Orchestration::Stack::Resource.new(stack, attrs).valid_state\n end\n end\n collection\n end",
"def all\n setup_request \"#{@@resource_url}s\"\n end",
"def resources options={}\n @resources ||= find_resources options\n end",
"def all\n resource_gateway.json_index.map { |model| build(model) }\n end",
"def linked_resources\n return @linked_resources\n end",
"def getObjects\n readObjects\n\n return @Objects\n end",
"def associations_array\n resource.reflect_on_all_associations.map { |association| association.name.to_s }\n end",
"def index\n @resources = Resource.order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resources }\n end\n end",
"def resource_all(stack)\n raise NotImplementedError\n end",
"def get_resources\n routes_doc = get_routes_doc\n resources_names = routes_doc.get_resources_names - resources_black_list\n\n resources_names.map do |resource|\n puts \"Generating #{resource} documentation...\" if trace?\n ResourceDoc.new( resource, routes_doc.get_actions_route_info( resource ) )\n end\n end",
"def index\n @resources = Resource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resources }\n end\n end",
"def index\n build_resource({})\n respond_with self.resource\n end",
"def loaded_resources\n @_loaded_resources ||= []\n end",
"def resources\n resources = []\n\n default_storage = {\n 'swift_zone' => 100,\n 'object_port'=>6000,\n 'container_port'=>6001,\n 'account_port'=>6002,\n 'mountpoints'=> \"1 1\\n2 1\",\n 'weight'=> 100,\n 'types'=>['container', 'object', 'account'],\n }\n\n self[:storages].each do |storage|\n merged_storage = default_storage.merge(storage)\n merged_storage['types'].collect do |type|\n port = merged_storage[\"#{type}_port\"]\n options = {\n :name=>\"#{merged_storage['storage_address']}:#{port}\",\n :mountpoints=>merged_storage['mountpoints'],\n :zone => merged_storage['swift_zone']\n }\n resources += [Puppet::Type.type(\"ring_#{type}_device\".to_sym).new(options)]\n end\n end\n resources\n end",
"def catalog_resources\n # This method exists to supply a common interface to the puppet catalog\n # for different versions of puppet.\n @catalog.resources.map do |r|\n if r.is_a?(String)\n # puppet 0.25 and older\n resource(r)\n elsif r.is_a?(Puppet::Resource)\n # puppet 2.6 and newer\n r\n else\n raise \"Unknown resource object #{r.class}\"\n end\n end\n end",
"def find_resources(with_current_resource=true)\n ary = nil\n case depth\n when 0\n ary = []\n when 1\n ary = resource.children\n else\n ary = resource.descendants\n end\n with_current_resource ? [resource] + ary : ary\n end",
"def all\n describe(resource_uri)\n end",
"def resources\n @task[:resources]\n end",
"def index\n self.resources = resource_class.all.paginate(per_page: 15, page: (params[:page] || 1).to_i)\n end",
"def resources(resource_uri = nil)\n load unless loaded?\n if resource_uri.nil?\n @resources.values\n else\n @resources[resource_uri]\n end\n end",
"def index\n @temp_resources = TempResource.all\n end",
"def get_resource_types\n get_types(Occi::Core::Resource.kind)\n end",
"def related_resources(resource)\n if resource.respond_to?(:related_resources_recursive)\n return resource.related_resources_recursive\n else\n return []\n end\n end",
"def index\n @fundamental_resource_pools = Fundamental::ResourcePool.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fundamental_resource_pools }\n end\n end",
"def resource_requests\n return @resource_requests\n end",
"def ar_retrieve_resources\n run_callbacks :ar_retrieve_resources do\n if params[:_search]\n # Fulltext search\n\n @resources = ar_model.search(params[:_search])\n @resources_count = @resources.count\n else\n intf = ar_model.interfaces[:rest]\n\n @resources_relation ||= ar_model.all\n\n # Authorization\n if intf.authorization_required?\n @resources_relation = @resources_relation.with_capability(aaa_context)\n end\n\n @authorized_resources_relation = @resources_relation\n\n # Filters\n @resources_relation = apply_scopes_to_relation(@resources_relation)\n @resources_relation = apply_json_filter_to_relation(@resources_relation)\n @resources_relation = apply_simple_filter_to_relation(@resources_relation)\n\n # Display filters\n @resources_relation = apply_sorting_to_relation(@resources_relation)\n @paginated_resources_relation = apply_pagination_to_relation(@resources_relation)\n\n @resources = @paginated_resources_relation\n @resources_count = @resources_relation.count\n end\n end\n\n @resources\n rescue ActiveRecord::RecordNotFound => e\n raise Exception::NotFound.new(e.message,\n :retry_possible => false)\n end",
"def build_resources(param)\n resources = []\n param.each { |r|\n obj_parts = r.split(',')\n res = LessonPlanResource.new\n res.obj_id = obj_parts[0]\n res.obj_type = obj_parts[1]\n resources.push(res)\n }\n\n resources\n end",
"def build_resources(param)\n resources = []\n param.each { |r|\n obj_parts = r.split(',')\n res = LessonPlanResource.new\n res.obj_id = obj_parts[0]\n res.obj_type = obj_parts[1]\n resources.push(res)\n }\n\n resources\n end",
"def list_all\n arr = []\n thr = []\n\n subscriptions.each do |sub|\n sub_id = sub['subscriptionId']\n resource_groups(sub_id).each do |group|\n @api_version = '2014-06-01'\n url = build_url(sub_id, group['name'])\n\n thr << Thread.new{\n res = JSON.parse(rest_get(url))['value'].first\n arr << res if res\n }\n end\n end\n\n thr.each{ |t| t.join }\n\n arr\n end",
"def index\n @q_resources = QResource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @q_resources }\n end\n end",
"def list(resource_type,limit=0,params={})\n path = '/api/' + resource_type.to_s\n params.merge!({limit: limit.to_s})\n response = http_get(path,params)\n hydrate_list(resource_type, response['objects'])\n end",
"def resource_scope\n resource_class.all\n end",
"def objects\n @objects ||= []\n end",
"def resources()\n end",
"def get_linked_resources(resource_type, filters = {})\n Util.convert_to_clever_object Clever.request(:get, get_uri(resource_type), filters)[:data]\n end"
] | [
"0.777672",
"0.7664756",
"0.7269483",
"0.7269483",
"0.7269483",
"0.72271603",
"0.71752894",
"0.71239513",
"0.6867364",
"0.68267524",
"0.68176955",
"0.67858124",
"0.6774142",
"0.6757139",
"0.6752189",
"0.6734408",
"0.67284864",
"0.6712926",
"0.6686244",
"0.6673482",
"0.66716176",
"0.66716176",
"0.66716176",
"0.66716176",
"0.66716176",
"0.66716176",
"0.66716176",
"0.66716176",
"0.66716176",
"0.66716176",
"0.6662516",
"0.6623593",
"0.66064537",
"0.65888876",
"0.65888876",
"0.65888876",
"0.6577758",
"0.65377116",
"0.65163964",
"0.6497696",
"0.64929336",
"0.6487154",
"0.6463785",
"0.64593416",
"0.6417553",
"0.6391729",
"0.6379064",
"0.63621294",
"0.6357684",
"0.63236904",
"0.63046855",
"0.6296103",
"0.6271749",
"0.62624806",
"0.62418795",
"0.620104",
"0.61987424",
"0.6195127",
"0.61760134",
"0.61555827",
"0.6147151",
"0.61441267",
"0.61438954",
"0.61369",
"0.61347085",
"0.61187994",
"0.6116077",
"0.6111593",
"0.60948807",
"0.60880375",
"0.60864365",
"0.60747045",
"0.6067686",
"0.60673016",
"0.6065189",
"0.6062662",
"0.60576177",
"0.60448766",
"0.6043596",
"0.6043144",
"0.60305774",
"0.60216665",
"0.6002884",
"0.5997966",
"0.59836257",
"0.59368294",
"0.5935732",
"0.5930544",
"0.5927168",
"0.59247106",
"0.5921914",
"0.5921884",
"0.5921884",
"0.5921823",
"0.59110993",
"0.5908843",
"0.59036535",
"0.59020066",
"0.5888612",
"0.5884256"
] | 0.6012502 | 82 |
Creates and returns a Resource object ==== Arguments _attrs_ a Hash of attributes passed to the constructor of the Resource | def create(attrs)
resource = @resource.new(attrs.merge(:session => @session, :prefix => @prefix))
resource.save
resource
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(attributes = {})\n resource = new(attributes)\n resource.__send__(:_create)\n resource\n end",
"def resource\n resource_klass.new(attributes.symbolize_keys.merge(new_record: false))\n end",
"def initialize(attrs = {})\n # Registro Nacional de Transportadores Rodoviarios de Carga\n @rntrc = attrs[:RNTRC]\n # Previsao\n @date = attrs[:dPrev]\n # Lotacao\n @capacity = attrs[:lota]\n # Conta Frete\n @ciot = attrs[:CIOT]\n\n # Coletas\n if attrs[:occ]\n @collections = create_resources(Collection, attrs[:occ])\n end\n\n # Vales pedagios\n if attrs[:valePed]\n @tolls = create_resources(Toll, attrs[:valePed])\n end\n\n # Veiculo\n if attrs[:veic]\n @vehicles = create_resources(Vehicle, attrs[:veic])\n end\n\n # Lacres\n if attrs[:lacRodo]\n @seals = to_array(attrs[:lacRodo])\n end\n\n if attrs[:moto]\n @drivers = create_resources(Person, attrs[:moto])\n end\n end",
"def create_resource(_params)\n resource_class.new(resource_params)\n end",
"def initialize(attrs = {})\n super\n\n instance_uri = self.class.resource_path + '/(:release)/(:uid)'\n instance_path = PDC::Resource::Path.new(instance_uri, attrs).expanded\n @url = connection.build_url(instance_path).to_s\n end",
"def resource\n @resource ||= begin\n resource_constant.new(attributes)\n end\n end",
"def create(attrs = {})\n instance = self.new(attrs)\n instance.save\n instance\n end",
"def create(attrs = {})\n record = new(attrs)\n record.save\n record\n end",
"def new(attrs = {})\n obj = self.model.new\n attrs.each do |k,v|\n obj.send(\"#{k}=\", v)\n end\n obj\n end",
"def create(name, attributes)\n attributes = attributes.dup\n\n # Add the objectclasses\n attributes[\"objectClass\"] = objectclasses.collect { |o| o.to_s }\n attributes[\"objectClass\"] << \"top\" unless attributes[\"objectClass\"].include?(\"top\")\n\n attributes[rdn.to_s] = [name]\n\n # Generate any new values we might need.\n generate(attributes)\n\n # And create our resource.\n connect { |conn| conn.add dn(name), attributes }\n end",
"def create(attrs)\n new(decorated_class.create(decorated_attributes(attrs)))\n end",
"def create(attributes = {})\n build(attributes).tap { |resource| resource.save }\n end",
"def create(attrs = {})\n val = new(attrs)\n R(val, self.database).save\n val\n end",
"def create_resource\n class_name.new(get_secure_params).tap do |model|\n model.save\n set_resource_ivar model\n end\n end",
"def new(attributes = {})\n resource = repository.scope { model.new(default_attributes.update(attributes)) }\n self << resource\n resource\n end",
"def create(attrs = {})\n super(attrs)\n end",
"def initialize (attrs = {})\n @attributes = {}\n @json_attributes = {}\n self.attributes = attrs\n end",
"def build_resource(hash = {})\n self.resource = resource_class.new(hash)\n end",
"def build(attributes)\n Model.new(resource_gateway, attributes)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def new(attrs = {})\n instance = super()\n instance.load_attributes!\n instance.update(attrs)\n instance\n end",
"def initialize(attrs = {})\n @attributes = {}.with_indifferent_access\n process(defaults.merge(attrs))\n @new_record = true if id.nil?\n generate_key\n end",
"def create_resource(new_resource, attributes)\n new_resource.attributes = attributes\n new_resource.save\n new_resource\n end",
"def initialize(attrs = {})\n @attrs = attrs\n end",
"def initialize(attrs={})\n @attrs = attrs\n end",
"def initialize(attrs={})\n @attrs = attrs\n end",
"def build_resource(hash = {})\n self.resource = resource_class.new_with_session(hash, session)\n end",
"def build_resource(hash = {})\n self.resource = resource_class.new_with_session(hash, session)\n end",
"def initialize(attrs = {})\n load_attributes(attrs)\n load_properties(attrs)\n end",
"def initialize(resource)\n @attributes = OpenStruct.new(resource.attributes.to_hash)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def resource(uri, opts = {})\n #resource = Resource.new(self, uri, opts)\n @resources ||= {}\n @resources[uri] ||= Resource.new(self, uri, opts)\n end",
"def create(*args)\n raise NotImplementedError, 'Implement a method to create the resource.'\n end",
"def initialize(attrs={})\n @attrs = attrs || {}\n end",
"def build_resource(hash = nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource\n resource = resource_base.new\n\n unless @options[:bypass_params_assignation]\n resource.assign_attributes(resource_params || {})\n end\n\n assign_attributes(resource)\n end",
"def create(attrs)\n super(attrs)\n end",
"def create(attrs)\n super(attrs)\n end",
"def create(attrs)\n super(attrs)\n end",
"def create(attrs)\n super(attrs)\n end",
"def create(attributes = {})\n resource = build(attributes)\n reset if resource.save and @cached_result\n resource\n end",
"def initialize(attrs)\n @uri = attrs['uri']\n @action = attrs['action'].upcase\n @headers = attrs['headers'] || {}\n @auth = !!attrs['authentication']\n @params = attrs['params'] || {}\n @status_codes = attrs['status_codes'] || {}\n @description = attrs['description']\n @example_id = attrs['example_id'] || ''\n @response_body = attrs['response_body']\n @request_body = attrs['request_body']\n @request_description = attrs['request_description'] || {}\n @tryit = attrs['tryit']\n end",
"def initialize(attrs={})\n load_attributes!(attrs)\n end",
"def initialize(attrs = {})\n @attrs = attrs || {}\n end",
"def create_with(attrs = {})\n tap do\n @create_attrs ||= {}\n @create_attrs.update(attrs)\n end\n end",
"def new_resource(*args)\n Freemle::Client::Resource.new(*args)\n end",
"def add(name, resource, attributes = {})\n resources[name] = resource\n resource.update_attributes(attributes) if attributes.any?\n resource\n end",
"def initialize(attrs = {})\n self.class.api_attrs.each_pair do |name, clazz|\n str = name.to_s\n if attrs.include?(str)\n v = attrs[str]\n val = if v.is_a?(Array)\n v.map {|it| clazz.nil?? it : clazz.new(it)}\n else\n clazz.nil?? v : clazz.new(v)\n end\n instance_variable_set(\"@#{str}\".to_sym, val)\n end\n end\n end",
"def initialize(attrs)\n @attributes = {}\n attrs.each { |k, v| self[k] = v }\n end",
"def build(attributes = {})\n params = attributes\n return self.new(params) unless self.request_new_object_on_build?\n\n path = self.build_request_path(params.merge(self.primary_key => 'new'))\n method = self.method_for(:new)\n\n resource = nil\n self.request(params.merge(:_method => method, :_path => path)) do |parsed_data, response|\n if response.success?\n resource = self.new_from_parsed_data(parsed_data)\n end\n end\n resource\n end",
"def build(args={})\n Resource.new(stack, args.to_smash)\n end",
"def load(attributes)\n raise ArgumentError, \"expected an attributes Hash, got #{attributes.inspect}\" unless attributes.is_a?(Hash)\n attributes.each do |key, value|\n @attributes[key.to_s] =\n case value\n when Array\n resource = find_or_create_resource_for_collection(key)\n value.map { |attrs| resource.new(attrs) }\n when Hash\n resource = find_or_create_resource_for(key)\n resource.new(value)\n when ActiveResource::Base\n value.class.new(value.attributes, value.prefix_options)\n else\n value.dup rescue value\n end\n end\n self\n end",
"def initialize(attrs={})\n from_hash(attrs)\n end",
"def create(attributes = {})\n resource = repository.scope { model.create(default_attributes.update(attributes)) }\n self << resource unless resource.new_record?\n resource\n end",
"def initialize(attrs)\n @uri = attrs['uri']\n @action = attrs['action'].upcase\n @headers = attrs['headers'] || {}\n @auth = !attrs['authentication']\n @params = attrs['params'] || {}\n @errors = attrs['errors'] || {}\n @sub_errors = attrs['sub_errors'] || {}\n @description = attrs['description']\n @example_url = attrs['example_url']\n @request_parameters = attrs['request_parameters']\n @response = attrs['response']\n @failure_response = attrs['failure_response']\n @tryit = attrs['tryit']\n end",
"def initialize( args={} )\n\n # Create from another instance. Used for transmuting class.\n if args[:resource]\n other = args[:resource]\n @project = other.project\n @type = other.type\n @id = other.id\n @content = other.content(:load => false)\n @yaml = other.yaml_content(:load => false)\n\n # Create from a project and id\n else\n @project = args[:project]\n @type = args[:type]\n @id = args[:id]\n if SUFFIX_REGEXP =~ @id\n suffix = $2\n @id = $1 + suffix\n @type = TYPE_SUFFIXES.invert[suffix]\n end\n @content = nil\n @yaml = nil\n end\n\n if @project.nil? or @id.nil?\n raise ArgumentError, \"Insufficient resource args: #{args.inspect}\"\n end\n end",
"def initialize(attrs = {})\n if attrs.respond_to?(:with_indifferent_access)\n attrs = attrs.with_indifferent_access\n end\n @id = attrs.delete(:id)\n @_key = attrs.delete(:_key)\n @_value = attrs.delete(:_value)\n @_doc = attrs.delete(:_doc)\n @_meta = attrs.delete(:_meta)\n @_attributes = ::Hash.new do |h, k|\n default = self.class.attributes[k]\n h[k] = if default.respond_to?(:call)\n default.call\n else\n default\n end\n end\n update_attributes(@_doc || attrs)\n end",
"def build_resource\n self.resource = resource_class.new(resource_params)\n end",
"def resource type, labels = {}\n Resource.new.tap do |r|\n r.type = type\n r.labels = labels\n end\n end",
"def new(attributes = {}, &block)\n assert_valid\n\n model = if discriminator = properties(repository_name).discriminator\n attributes[discriminator.name]\n end\n\n model ||= self\n\n resource = model.allocate\n resource.send(:initialize, attributes, &block)\n resource\n end",
"def build_resource(hash=nil, student_id=nil)\n hash[:student_id] = student_id\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def create(attributes = {})\n resource = build(attributes)\n @parent.attributes[@name] = resource if resource.save\n resource\n end",
"def initialize(attrs = {})\n # Tipo de Arma\n @kind = attrs[:tpArma]\n # Serie\n @serie = attrs[:nSerie]\n # Cano\n @barrel = attrs[:nCano]\n # Descricao\n @description = attrs[:descr]\n end",
"def create\n @property_hash = {\n name: @resource[:name],\n ensure: :present,\n primitive: @resource[:primitive],\n clone_max: @resource[:clone_max],\n clone_node_max: @resource[:clone_node_max],\n notify_clones: @resource[:notify_clones],\n globally_unique: @resource[:globally_unique],\n ordered: @resource[:ordered],\n interleave: @resource[:interleave],\n cib: @resource[:cib],\n existing_resource: :false\n }\n end",
"def from_hash(attrs)\n object = self.new\n \n attrs.each do |attribute, value|\n object.send(\"#{attribute}=\", value)\n end\n \n object\n end",
"def instantiate(attrs = {})\n attributes = attrs.with_indifferent_access\n if attributes[:_id]\n document = allocate\n document.instance_variable_set(:@attributes, attributes)\n return document\n else\n return new(attributes)\n end\n end",
"def create(type, opts = nil)\n proxy_info = OmfRc::ResourceFactory.proxy_list[type]\n if proxy_info && proxy_info.create_by && !proxy_info.create_by.include?(self.type.to_sym)\n raise StandardError, \"Resource #{type} is not designed to be created by #{self.type}\"\n end\n\n before_create(type, opts) if respond_to? :before_create\n new_resource = OmfRc::ResourceFactory.new(type.to_sym, opts, @comm)\n after_create(new_resource) if respond_to? :after_create\n children << new_resource\n new_resource\n end",
"def instantiate\n resource.new(data)\n end",
"def initialize(attrs = {})\n @attributes = attrs\n\n # Set values where we have defined a reader, probably\n @attributes.each do |key, val|\n if respond_to?(key.to_sym)\n instance_variable_set(\"@#{key}\", val)\n end\n end\n end",
"def create\n debug \"Call: create on cs_resource '#{@resource[:name]}'\"\n @property_hash = {\n :name => @resource[:name],\n :ensure => :present,\n :primitive_class => @resource[:primitive_class],\n :provided_by => @resource[:provided_by],\n :primitive_type => @resource[:primitive_type],\n :complex_type => @resource[:complex_type],\n }\n @property_hash[:parameters] = @resource[:parameters] if @resource[:parameters]\n @property_hash[:operations] = @resource[:operations] if @resource[:operations]\n @property_hash[:metadata] = @resource[:metadata] if @resource[:metadata]\n @property_hash[:ms_metadata] = @resource[:ms_metadata] if @resource[:ms_metadata]\n @property_hash[:cib] = @resource[:cib] if @resource[:cib]\n end",
"def factory(attrs)\n # available values of `distributionMethod` at this point: ['adhoc', 'store', 'limited', 'direct', 'inhouse']\n klass = case attrs['distributionMethod']\n when 'limited'\n Development\n when 'store'\n AppStore\n when 'adhoc'\n AdHoc\n when 'inhouse'\n InHouse\n when 'direct'\n Direct # Mac-only\n else\n raise \"Can't find class '#{attrs['distributionMethod']}'\"\n end\n\n # Parse the dates\n # rubocop:disable Style/RescueModifier\n attrs['dateExpire'] = (Time.parse(attrs['dateExpire']) rescue attrs['dateExpire'])\n # rubocop:enable Style/RescueModifier\n\n # When a profile is created with a template name, the response\n # (provisioning profiles info) already contains the data about\n # template, which is used to instantiate the\n # ProvisioningProfileTemplate model.\n # Doing so saves an API call needed to fetch profile details.\n #\n # Verify if `attrs` contains the info needed to instantiate a template.\n # If not, the template will be lazily loaded.\n if attrs['profile'] && attrs['profile']['description']\n attrs['template'] = ProvisioningProfileTemplate.factory(attrs['template'])\n end\n\n klass.client = @client\n obj = klass.new(attrs)\n\n return obj\n end",
"def initialize(attrs = nil)\n attrs ||= {}\n raise ArgumentError, \"Hash object is expected\" unless attrs.is_a?(Hash)\n\n @new_record = true\n @attributes ||= {}\n process_attributes(attrs)\n apply_defaults\n self.id = BSON::ObjectId.new unless self.id\n run_callbacks(:initialize) unless _initialize_callbacks.empty?\n end",
"def build_resource(hash=nil)\n super\n end",
"def new_from_resource(rsrc); self.class.new_from_resource(rsrc) end",
"def load(attributes)\r\n raise ArgumentError, \"expected an attributes Hash, got #{attributes.inspect}\" unless attributes.is_a?(Hash)\r\n attributes.each do |key, value|\r\n @attributes[key.to_s] =\r\n case value\r\n when Array\r\n resource = find_or_create_resource_for_collection(key)\r\n value.map { |attrs| resource.new(attrs) }\r\n when Hash\r\n resource = find_or_create_resource_for(key)\r\n resource.new(value)\r\n when ActiveTamino::Base\r\n value.class.new(value.attributes, value.prefix_options)\r\n else\r\n value.dup rescue value\r\n end\r\n end\r\n self\r\n end",
"def with(attrs = {})\n self.class.new(to_h.merge(attrs))\n end",
"def initialize(attrs = {})\n self.attributes = {}\n attrs.each {|attribute, value| self.send(\"#{attribute}=\", value)}\n end",
"def construct_new_resource(response)\n data = JSON.parse(response.body, symbolize_names: true)\n new(data)\n end",
"def initialize(attrs = {})\n run_callbacks :initialize do\n @new_record = true\n @attributes ||= {}\n @associations ||= {}\n @attributes_before_type_cast ||= {}\n\n attrs_with_defaults = self.class.attributes.each_with_object({}) do |(attribute, options), res|\n if attrs.key?(attribute)\n res[attribute] = attrs[attribute]\n elsif options.key?(:default)\n res[attribute] = evaluate_default_value(options[:default])\n end\n end\n\n attrs_virtual = attrs.slice(*(attrs.keys - self.class.attributes.keys))\n\n load(attrs_with_defaults.merge(attrs_virtual))\n end\n end",
"def create\n @property_hash = {\n name: @resource[:name],\n ensure: :present,\n first: @resource[:first],\n second: @resource[:second],\n kind: @resource[:kind],\n symmetrical: @resource[:symmetrical],\n new: true\n }\n end",
"def create_remote_resource(attributes_hash)\n path = \"/#{resource_name}/\"\n UserEngage.client.post(path, attributes_hash)\n end",
"def build_resource(type, name, created_at=nil, &resource_attrs_block)\n created_at ||= caller[0]\n\n # Checks the new platform => short_name => resource mapping initially\n # then fall back to the older approach (Chef::Resource.const_get) for\n # backward compatibility\n resource_class = resource_class_for(type)\n\n raise ArgumentError, \"You must supply a name when declaring a #{type} resource\" if name.nil?\n\n resource = resource_class.new(name, run_context)\n resource.source_line = created_at\n resource.declared_type = type\n # If we have a resource like this one, we want to steal its state\n # This behavior is very counter-intuitive and should be removed.\n # See CHEF-3694, https://tickets.opscode.com/browse/CHEF-3694\n # Moved to this location to resolve CHEF-5052, https://tickets.opscode.com/browse/CHEF-5052\n resource.load_prior_resource(type, name)\n resource.cookbook_name = cookbook_name\n resource.recipe_name = recipe_name\n # Determine whether this resource is being created in the context of an enclosing Provider\n resource.enclosing_provider = self.is_a?(Chef::Provider) ? self : nil\n\n # XXX: This is very crufty, but it's required for resource definitions\n # to work properly :(\n resource.params = @params\n\n # Evaluate resource attribute DSL\n resource.instance_eval(&resource_attrs_block) if block_given?\n\n # Run optional resource hook\n resource.after_created\n\n resource\n end",
"def initialize(name, prov={}, attrs={}, sanitize_attributes:false)\n if name.is_a? ResourceLoader\n @provider, @type, @name, @id = name.provider, name.type, name.name, nil\n @path, @namespace = name.path, name.namespace\n else\n @provider, @type, @name, @id = prov[:name], prov[:type], name, prov[:id]\n @path, @namespace = nil, nil\n end\n\n # Duplicate each attribute to ensure they are unique to the instance.\n attributes.each { |key,val| attributes[key] = val.dup }\n\n # Take any named attribute and set its value from the resource name.\n attributes[named_attribute].value = @name unless named_attribute.equal?(NULL)\n\n # Update the attributes with the values from the `attrs` argument.\n attrs.each do |key,val|\n attributes[key].set_value val, sanitize_attributes: sanitize_attributes\n end\n end",
"def initialize(attrs = {})\n @attrs = attrs || {}\n @attrs.each do |key, value|\n self.class.class_eval { attr_reader key }\n instance_variable_set(\"@#{key}\", value)\n end\n end",
"def initialize( attrs = {} )\n @attributes = self.class.__properties.merge( attrs ).with_indifferent_access\n end",
"def build_resource\n get_resource_ivar || begin\n set_resource_ivar class_name.new\n end\n end",
"def initialize(attrs = {})\n @id = attrs[:id]\n @title = attrs[:title]\n @body = attrs[:body]\n @user_id = attrs[:user_id]\n end",
"def initialize(attrs = { })\n if attrs.present?\n attrs.each do |k, v|\n self.send(:\"#{k}=\", v)\n end\n end\n end",
"def initialize(attrs = {})\n return if attrs.blank?\n\n attrs = attrs.with_indifferent_access\n\n self.class.properties.each do |prop|\n write_attribute(prop.name, attrs[prop.name]) if attrs.key?(prop.name)\n end\n end",
"def initialize(attrs = {})\n # attrs => { name: \"Harry\", cured: true }\n @id = attrs[:id] # Integer\n @name = attrs[:name] # String\n @cured = attrs[:cured] || false # boolean\n @room = attrs[:room]\n end"
] | [
"0.71360934",
"0.6867871",
"0.6858949",
"0.6736247",
"0.6680484",
"0.6660236",
"0.66534483",
"0.662158",
"0.66204166",
"0.6600757",
"0.6591682",
"0.65770143",
"0.65630984",
"0.6530028",
"0.6517323",
"0.65079045",
"0.6505748",
"0.6502497",
"0.64885",
"0.6477456",
"0.64578694",
"0.6446794",
"0.6434462",
"0.64207023",
"0.64144427",
"0.64144427",
"0.64041156",
"0.64041156",
"0.6390549",
"0.63762885",
"0.6352949",
"0.6352949",
"0.6352949",
"0.6352949",
"0.6352949",
"0.6352949",
"0.6352949",
"0.6352949",
"0.6352949",
"0.6352949",
"0.6351941",
"0.6344748",
"0.63376284",
"0.63266623",
"0.63101155",
"0.6301333",
"0.6282209",
"0.6282209",
"0.6282209",
"0.6282209",
"0.6277571",
"0.6272143",
"0.62543005",
"0.6247174",
"0.621833",
"0.6191501",
"0.6184904",
"0.61848426",
"0.6184685",
"0.61691797",
"0.61677235",
"0.6167456",
"0.6161383",
"0.6157483",
"0.61218417",
"0.61205345",
"0.6120305",
"0.6113771",
"0.61085826",
"0.6104296",
"0.6089374",
"0.60701114",
"0.6070009",
"0.6065336",
"0.6046187",
"0.6033962",
"0.6015715",
"0.60071415",
"0.60040903",
"0.5994379",
"0.59939337",
"0.59771556",
"0.59767723",
"0.5974216",
"0.5968705",
"0.5961994",
"0.59590185",
"0.595745",
"0.59555674",
"0.59515977",
"0.59389067",
"0.59277844",
"0.59242964",
"0.5911687",
"0.59008414",
"0.5892046",
"0.5887797",
"0.5884985",
"0.58813953",
"0.58801126"
] | 0.7811263 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.